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/README.md b/README.md index 3a89fec4d97e..a93b2e3fb049 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Each service might have a number of libraries available from each of the followi * [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). +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`. 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/containerregistry/resource-manager/v2016_06_27_preview/pom.xml b/containerregistry/resource-manager/v2016_06_27_preview/pom.xml index 64400aeff25d..6bc1f83e6ce1 100644 --- a/containerregistry/resource-manager/v2016_06_27_preview/pom.xml +++ b/containerregistry/resource-manager/v2016_06_27_preview/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-containerregistry 1.0.0-beta 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..320c7d6f12ea 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,6 +76,9 @@ + + + @@ -86,47 +89,104 @@ - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + - - - + + - - + + + + + + + + + + + + - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..6e081c416f3c 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..84984a56b2ce 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 @@ + + + @@ -446,12 +449,19 @@ - + + + + + + + + @@ -512,7 +522,12 @@ - + @@ -522,6 +537,7 @@ name="com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials$AuthorizationHeaderProvider"/> + @@ -534,7 +550,40 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index bfe7f05dbccd..015665b9897b 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -25,12 +25,14 @@ 1.0.0-preview.4 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 12.0.0-preview.3 @@ -60,6 +62,11 @@ azure-core-amqp ${azure-core.version} + + com.azure + azure-core-http-netty + ${azure-core-http-netty.version} + com.azure azure-core-management @@ -90,6 +97,11 @@ azure-messaging-eventhubs ${azure-messaging-eventhubs.version} + + com.azure + azure-storage-common + ${azure-storage-common.version} + com.azure azure-storage-blob 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..95e4d6e7f883 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,12 +61,14 @@ 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 + 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) @@ -112,6 +114,18 @@ jobs: Options: --batch-mode MavenOptions: $(LoggingOptions) + - 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 all client libraries (for SpotBugs analysis)' inputs: @@ -153,10 +167,9 @@ 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' @@ -172,18 +185,6 @@ 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: @@ -226,8 +227,11 @@ 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)' 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..c2afc3c0a2ea 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -1,5 +1,6 @@ variables: - DefaultOptions: '--batch-mode -Dmaven.wagon.http.pool=false --settings eng/settings.xml' + DefaultOptions: '--batch-mode --fail-at-end -Dmaven.wagon.http.pool=false --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 + #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..c2129a35c138 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -27,6 +27,7 @@ 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 12.0.0-preview.3 @@ -57,6 +58,9 @@ ..\..\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 @@ -67,12 +71,13 @@ - - - - - - + ..\..\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-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 @@ -149,6 +154,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 @@ -179,6 +194,11 @@ azure-keyvault-secrets ${azure-keyvault.version} + + com.azure + azure-storage-common + ${azure-storage-common.version} + com.azure azure-storage-blob 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..590f618180e1 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -1,7 +1,7 @@ - + 4.0.0 com.azure azure-client-sdk-parent @@ -19,7 +19,7 @@ com.azure azure-sdk-parent - 1.2.0 + 1.3.0 ./parent/pom.xml @@ -164,12 +164,13 @@
- Max + max Low true ${project.build.directory}/spotbugs spotbugs/spotbugs-exclude.xml true + false @@ -243,6 +244,7 @@ ${packageOutputDirectory} true true + all @@ -341,7 +343,6 @@ false - com.microsoft.azure.template: *.impl*: *.implementation*: com.azure.tools.checkstyle* @@ -361,6 +362,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* @@ -401,6 +410,10 @@ Azure Storage - Queues com.azure.storage.queue* + + Azure Telemetry + com.azure.tracing.opentelemetry* + https://docs.oracle.com/javase/8/docs/api/ @@ -415,9 +428,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 +455,13 @@ - Max + max Low true ${project.build.directory}/spotbugs spotbugs/spotbugs-exclude.xml true + false @@ -511,12 +529,13 @@ 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 true + false @@ -542,6 +561,7 @@ -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-keys/src/samples/java -snippetpath ${project.basedir}/sdk/keyvault/azure-keyvault-secrets/src/samples/java @@ -549,6 +569,7 @@ -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 +692,32 @@ + + + modulename + + + src/main/java/module-info.java + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + + ${project.automatic.module.name} + + + + + + + + @@ -729,7 +776,8 @@ template-module - include-template + env.ENABLETEMPLATEDOCS + true @@ -743,6 +791,8 @@ ./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 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/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index cf9bfa46796e..8ee71afb4ab4 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -197,3 +197,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) \ No newline at end of file diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index 17733f2f7427..1708c2bf7f17 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -32,6 +32,10 @@ HEAD + + com.azure.data.appconfiguration + + com.azure @@ -49,6 +53,12 @@ 1.0.0-preview.4 test + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + test + junit junit 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..367d64d78734 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 @@ -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. @@ -102,7 +103,7 @@ public Mono addSetting(String key, String value) { * * @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). + * 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 exists. @@ -125,8 +126,8 @@ 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 ResourceModifiedException If a ConfigurationSetting with the same key and label exists. @@ -143,7 +144,15 @@ 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.key(), + setting.label(), + setting, + null, + getETagValue(ETAG_ANY), + context) .doOnRequest(ignoredValue -> logger.info("Adding ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Added ConfigurationSetting - {}", response.value())) .onErrorMap(ConfigurationAsyncClient::addSettingExceptionMapper) @@ -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. @@ -189,14 +198,14 @@ 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. + * 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) @@ -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. + * 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,7 +254,8 @@ 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.key(), setting.label(), setting, getETagValue(setting.etag()), + null, context) .doOnRequest(ignoredValue -> logger.info("Setting ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Set ConfigurationSetting - {}", response.value())) .doOnError(error -> logger.warning("Failed to set ConfigurationSetting - {}", setting, error)); @@ -254,8 +264,7 @@ Mono> setSetting(ConfigurationSetting setting, Co /** * 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,11 +272,11 @@ 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) @@ -285,18 +294,19 @@ public Mono updateSetting(String key, String value) { * *

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 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 HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -313,18 +323,20 @@ public Mono updateSetting(ConfigurationSetting setting) { * *

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. + * exist, the setting is locked, or {@link ConfigurationSetting#etag() etag} is specified but does not match + * the current value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -338,7 +350,8 @@ Mono> updateSetting(ConfigurationSetting setting, String etag = setting.etag() == null ? ETAG_ANY : setting.etag(); - return service.setKey(serviceEndpoint, setting.key(), setting.label(), setting, getETagValue(etag), null, context) + return service.setKey(serviceEndpoint, setting.key(), setting.label(), setting, getETagValue(etag), + null, context) .doOnRequest(ignoredValue -> logger.info("Updating ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Updated ConfigurationSetting - {}", response.value())) .doOnError(error -> logger.warning("Failed to update ConfigurationSetting - {}", setting, error)); @@ -355,7 +368,7 @@ Mono> updateSetting(ConfigurationSetting setting, * * @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). + * 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. @@ -378,7 +391,7 @@ public Mono getSetting(String key) { * * @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). + * 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 ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. @@ -400,8 +413,9 @@ 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 ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. @@ -433,7 +447,7 @@ Mono> getSetting(ConfigurationSetting setting, Co * * @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). + * 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. @@ -460,13 +474,13 @@ public Mono deleteSetting(String key) { * * @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 - * current etag (which will also throw HttpResponseException described below). + * 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}. * @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 - * character, and does not match the current etag value. + * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -489,14 +503,14 @@ 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). + * @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}. * @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 - * character, and does not match the current etag value. + * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -508,7 +522,8 @@ 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.key(), setting.label(), getETagValue(setting.etag()), + null, context) .doOnRequest(ignoredValue -> logger.info("Deleting ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Deleted ConfigurationSetting - {}", response.value())) .doOnError(error -> logger.warning("Failed to delete ConfigurationSetting - {}", setting, error)); @@ -526,7 +541,7 @@ Mono> deleteSetting(ConfigurationSetting setting, * * @param options Optional. Options to filter configuration setting results from the service. * @return A Flux of ConfigurationSettings that matches the {@code options}. If no options were provided, the Flux - * contains all of the current settings in the service. + * contains all of the current settings in the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listSettings(SettingSelector options) { @@ -603,10 +618,13 @@ Mono> listSettingRevisionsFirstPage(SettingS 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)); + 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)); } else { result = service.listKeyValueRevisions(serviceEndpoint, null, null, null, null, null, context) .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions")) @@ -621,7 +639,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 +654,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); } 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..b6c184c0e328 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 @@ -51,12 +51,12 @@ 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. * @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). + * is an invalid value (which will also throw ServiceRequestException 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. @@ -74,11 +74,11 @@ 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). + * 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 exists. @@ -97,12 +97,13 @@ 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 ResourceModifiedException If a ConfigurationSetting with the same key and label exists. @@ -124,12 +125,12 @@ 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. * @return The {@link ConfigurationSetting} that was created or updated, or {@code null}, if the key is an invalid - * value (which will also throw ServiceRequestException described below). + * value (which will also throw ServiceRequestException 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. @@ -151,17 +152,17 @@ public ConfigurationSetting setSetting(String key, String value) { * *

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). + * 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. + * 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) @@ -181,18 +182,18 @@ public ConfigurationSetting setSetting(ConfigurationSetting setting) { * *

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. * @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). + * 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. + * 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) { @@ -210,15 +211,16 @@ 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) @@ -234,18 +236,20 @@ public ConfigurationSetting updateSetting(String key, String value) { * *

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 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 HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -261,19 +265,21 @@ public ConfigurationSetting updateSetting(ConfigurationSetting setting) { * *

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 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 HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -296,7 +302,7 @@ private Response updateSetting(ConfigurationSetting settin * * @param key The key of the setting to retrieve. * @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). + * not exist or the key is an invalid value (which will also throw ServiceRequestException 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. @@ -317,7 +323,7 @@ public ConfigurationSetting getSetting(String key) { * * @param setting The setting to retrieve based on its key and optional label combination. * @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). + * 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 ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. @@ -339,8 +345,9 @@ 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 ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. @@ -366,7 +373,7 @@ private Response getSetting(ConfigurationSetting setting, * * @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). + * 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. @@ -391,13 +398,13 @@ public ConfigurationSetting deleteSetting(String key) { * * @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 - * current etag (which will also throw ServiceRequestException described below). + * 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}. * @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 - * character, and does not match the current etag value. + * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -420,14 +427,14 @@ 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). + * @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}. * @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 - * character, and does not match the current etag value. + * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -450,8 +457,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 +477,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) { 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..4d033db2c3c6 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. */ @@ -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. 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..b96108a7cc2a 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); } @@ -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/policy/ConfigurationCredentialsPolicy.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java index 7d32848c2041..f8c966d8346f 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.httpRequest().body() == null + ? Flux.just(getEmptyBuffer()) + : context.httpRequest().body(); - return credentials.getAuthorizationHeadersAsync(context.httpRequest().url(), context.httpRequest().httpMethod().toString(), contents.defaultIfEmpty(getEmptyBuffer())) + return credentials + .getAuthorizationHeadersAsync( + context.httpRequest().url(), + context.httpRequest().httpMethod().toString(), + contents.defaultIfEmpty(getEmptyBuffer())) .flatMapMany(headers -> Flux.fromIterable(headers.entrySet())) .map(header -> context.httpRequest().header(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..e46b22e5ddd0 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} */ @@ -68,9 +72,9 @@ public void setSettingsCodeSnippet() { }); // 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.key(), response.value()); + }); // END: com.azure.data.appconfiguration.configurationasyncclient.setSetting#string-string /** @@ -187,7 +191,7 @@ public void getSettingsCodeSnippet() { // END: com.azure.data.appconfiguration.configurationasyncclient.getSettingWithResponse#ConfigurationSetting } - /** + /** * Code snippets for {@link ConfigurationAsyncClient#deleteSetting(String)} */ public void deleteSettingsCodeSnippet() { @@ -252,9 +256,17 @@ public void listSettingRevisionsCodeSnippet() { /** * 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..3ffce424c997 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 @@ -92,31 +92,31 @@ 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 + // 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 + // 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 + // END: com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context } /** @@ -124,7 +124,7 @@ 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()); @@ -132,12 +132,12 @@ public void setSetting() { // 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 + // 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")); @@ -148,12 +148,12 @@ public void setSetting() { .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 + // 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") @@ -165,7 +165,7 @@ public void setSetting() { .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 + // END: com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context } /** @@ -206,13 +206,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 + // END: com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String /* Generates code sample for using {@link ConfigurationClient#updateSetting(ConfigurationSetting)} 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..3706a3100e9c 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().setWiretap(true).build()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) .addPolicy(new RetryPolicy()) @@ -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)); } /** @@ -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))); } /** @@ -135,7 +135,7 @@ 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())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); final String etag = client.addSetting(initial).block().etag(); @@ -144,7 +144,7 @@ public void setSettingIfEtag() { .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)); } /** @@ -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))); } /** @@ -244,7 +244,7 @@ public void updateSettingIfEtag() { // 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())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.getSetting(update)) .assertNext(response -> assertConfigurationEquals(update, response)) @@ -259,7 +259,7 @@ public void updateSettingIfEtag() { .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())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); }); } @@ -286,11 +286,11 @@ public void getSettingNotFound() { .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)); }); } @@ -325,11 +325,11 @@ public void deleteSettingNotFound() { .verifyComplete(); StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().key("myNonExistentKey"))) - .assertNext(response -> assertConfigurationEquals(null, response, HttpResponseStatus.NO_CONTENT.code())) + .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())) + .assertNext(response -> assertConfigurationEquals(null, response, HttpURLConnection.HTTP_NO_CONTENT)) .verifyComplete(); StepVerifier.create(client.getSetting(neverDeletedConfiguration.key())) @@ -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)); }); } @@ -656,7 +656,7 @@ public void listRevisionsInvalidRange() { .verifyComplete(); StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10)))) - .verifyErrorSatisfies(exception -> assertRestException(exception, HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE.code())); + .verifyErrorSatisfies(exception -> assertRestException(exception, 416)); // REQUESTED_RANGE_NOT_SATISFIABLE } /** 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..8f34e6f28489 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().setWiretap(true).build()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) .addPolicy(new RetryPolicy()) @@ -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); } /** @@ -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.etag("badEtag")), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); final String etag = client.addSetting(initial).etag(); assertConfigurationEquals(update, client.setSetting(update.etag(etag))); - assertRestException(() -> client.setSetting(initial), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + 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); } /** @@ -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) ); } @@ -201,7 +201,7 @@ public void updateSettingIfEtag() { // 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)), 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))); @@ -209,7 +209,7 @@ public void updateSettingIfEtag() { assertRestException(() -> client.updateSetting(new ConfigurationSetting().key(initial.key()).label(initial.label()).value(initial.value()).etag(updateEtag)), ResourceNotFoundException.class, - HttpResponseStatus.PRECONDITION_FAILED.code()); + HttpURLConnection.HTTP_PRECON_FAILED); }); } @@ -241,8 +241,8 @@ public void getSettingNotFound() { 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); }); } @@ -271,7 +271,7 @@ public void deleteSettingNotFound() { 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())); } @@ -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); }); } @@ -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"); 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().keys(key).range(new Range(0, 10))), + 416); // REQUESTED_RANGE_NOT_SATISFIABLE } /** 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..1419e3cca47c 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 @@ -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 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..62e0394ca71b 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.1 jar Microsoft Azure SDK for Cognitive Service Custom Vision Prediction This package contains Microsoft Cognitive Service Custom Vision Prediction SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml b/sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml index 491e94891644..48dfa47e0712 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.1 jar Microsoft Azure SDK for Cognitive Service Custom Vision Training This package contains Microsoft Cognitive Service Custom Vision Training SDK. 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..1c8402a7e798 100644 --- a/sdk/core/README.md +++ b/sdk/core/README.md @@ -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) \ No newline at end of file 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..999ac6a2bcc2 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -44,6 +44,7 @@ UTF-8 + com.azure.core.amqp @@ -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/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/RetryPolicy.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java index 5424f705ff1f..b81c5d1ac9e7 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 @@ -101,8 +101,8 @@ public Duration calculateRetryDelay(Exception lastException, int retryCount) { } /** - * 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 retryCound}, + * {@code baseDelay}, and {@code baseJitter}. * * @param retryCount The number of attempts that have been made, including the initial attempt before any * retries. 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/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/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..cbd06e146641 --- /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.3.0 + ../../../pom.client.xml + + + com.azure + azure-core-http-netty + jar + 1.0.0-preview.4 + + 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.4 + + + + 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.4 + 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..6c515bdbc6f9 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java @@ -0,0 +1,187 @@ +// 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#setNioEventLoopGroup(NioEventLoopGroup) thread pooling}, + * {@link NettyAsyncHttpClientBuilder#setWiretap(boolean) wiretapping}, + * {@link NettyAsyncHttpClientBuilder#setProxy(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.httpMethod()); + Objects.requireNonNull(request.url()); + Objects.requireNonNull(request.url().getProtocol()); + + return nettyClient + .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)); + } + + 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); + } + }).map(ByteBuf::nioBuffer); + } + + @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(); + } + + // 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..6b34d177d233 --- /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.type()) { + 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.type() + + "' in use. Not configuring Netty proxy.")); + } + + return tcpConfig.proxy(ts -> ts.type(nettyProxy).address(proxyOptions.address())); + } + + 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 setProxy(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 setWiretap(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 setPort(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 setNioEventLoopGroup(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..1604f0f26dd5 --- /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() + .setPort(8080) + .setWiretap(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() + .setNioEventLoopGroup(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..c76c223c2dad --- /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.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 { + ReactorNettyHttpResponse 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() { + ReactorNettyHttpResponse 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(); + Assert.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 -> 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.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; +// 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.bodyAsByteArray().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..c0d49b1ada3c --- /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 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-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..f30f66fba274 --- /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().setProxy(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..54b40c56c1a8 --- /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.3.0 + ../../../pom.client.xml + + + com.azure + azure-core-http-okhttp + jar + 1.0.0-preview.4 + + 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.4 + + + + com.squareup.okhttp3 + okhttp + + + + + com.azure + azure-core + 1.0.0-preview.4 + 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..4d6b777653bb --- /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.url()); + if (request.headers() != null) { + return rb.headers(okhttp3.Headers.of(request.headers().toMap())); + } else { + return rb.headers(okhttp3.Headers.of(new HashMap<>())); + } + }) + .flatMap((Function>) rb -> { + if (request.httpMethod() == HttpMethod.GET) { + return Mono.just(rb.get()); + } else if (request.httpMethod() == HttpMethod.HEAD) { + return Mono.just(rb.head()); + } else { + return toOkHttpRequestBody(request.body(), request.headers()) + .map(requestBody -> rb.method(request.httpMethod().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.request(request); + } + + @Override + public int statusCode() { + return this.statusCode; + } + + @Override + public String headerValue(String name) { + return this.headers.value(name); + } + + @Override + public HttpHeaders headers() { + return this.headers; + } + + @Override + public Flux body() { + return this.responseBodyMono + .flatMapMany(irb -> toFluxByteBuffer(irb.byteStream())); + } + + @Override + public Mono bodyAsByteArray() { + 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 bodyAsString() { + 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 bodyAsString(Charset charset) { + return bodyAsByteArray() + .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..22e635afd65d --- /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.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 testFlowableWhenServerReturnsBodyAndNoErrorsWhenHttp500Returned() { + HttpResponse response = getResponse("/error"); + StepVerifier.create(response.bodyAsString()) + .expectNext("error") // TODO: .awaitDone(20, TimeUnit.SECONDS) [See previous todo] + .verifyComplete(); + Assert.assertEquals(500, response.statusCode()); + } + + @Ignore("Not working accurately at present") + @Test + 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 -> 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.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 -> 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.bodyAsByteArray().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..3767e2db548e 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -44,6 +44,7 @@ UTF-8 + com.azure.core.management @@ -69,7 +70,13 @@ com.azure azure-core-test - 1.0.0-preview.3 + 1.0.0-preview.4 + test + + + com.azure + azure-core-http-netty + 1.0.0-preview.4 test @@ -79,4 +86,5 @@ test + 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..d5e44cc951c1 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. 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..d6066d6c3ad3 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. */ @@ -67,7 +70,7 @@ private void cachePage(String nextPageLink) { } } } catch (IOException ex) { - throw new RuntimeException(ex); + throw logger.logExceptionAsError(new RuntimeException(ex)); } } @@ -137,6 +140,8 @@ protected void setCurrentPage(Page currentPage) { * 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/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..353cf960e03e 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.bodyAsString() + .map(bodyString -> { + AsyncOperationResource operationResource = null; + try { + operationResource = deserialize(bodyString, AsyncOperationResource.class); + } catch (IOException ignored) { + } + // + if (operationResource == null || operationResource.status() == null) { + throw logger.logExceptionAsError(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 logger.logExceptionAsError(new CloudException( + "Async operation failed with provisioning state: " + status, + bufferedHttpPollResponse)); + } + + if (operationResource.id() != 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) { @@ -192,9 +207,10 @@ 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.url(), locationUrl, originalHttpRequest.httpMethod(), delayInMilliseconds)) + : null; } static String getHeader(HttpResponse httpResponse) { 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..e155da58dcde 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 @@ -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; @@ -52,12 +53,13 @@ */ 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". + * this RestProxy "implements". */ private AzureProxy(HttpPipeline httpPipeline, SwaggerInterfaceParser interfaceParser) { super(httpPipeline, createDefaultSerializer(), interfaceParser); @@ -73,7 +75,7 @@ public static long defaultDelayInMilliseconds() { /** * 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. + * long running operation status poll. */ public static void setDefaultPollingDelayInMilliseconds(long defaultPollingDelayInMilliseconds) { AzureProxy.defaultPollingDelayInMilliseconds = defaultPollingDelayInMilliseconds; @@ -139,21 +141,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. + * string. * @return the default HttpPipeline. */ public static HttpPipeline createDefaultPipeline(Class swaggerInterface) { @@ -163,7 +166,7 @@ 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. + * string. * @param credentials The credentials to use to apply authentication to the pipeline. * @return the default HttpPipeline. */ @@ -174,9 +177,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. + * string. * @param credentialsPolicy The credentials policy factory to use to apply authentication to the - * pipeline. + * pipeline. * @return the default HttpPipeline. */ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, HttpPipelinePolicy credentialsPolicy) { @@ -200,13 +203,14 @@ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, Http * @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 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 +220,199 @@ 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.fullyQualifiedMethodName() + "())" + + " 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); - }); + .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); + }); }); } } else { - final Mono lastAsyncHttpResponse = createPollStrategy(httpRequest, asyncHttpResponse, methodParser) + final Mono lastAsyncHttpResponse = + createPollStrategy(httpRequest, asyncHttpResponse, methodParser) .flatMap((Function>) pollStrategy -> pollStrategy.pollUntilDone()); - return handleRestReturnType(new HttpResponseDecoder(this.serializer()).decode(lastAsyncHttpResponse, methodParser), methodParser, returnType, context); + return handleRestReturnType(new HttpResponseDecoder(this.serializer()).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.fullyQualifiedMethodName() + "()) if " + + "the Flux's inner type that is OperationStatus (not " + returnType.toString() + ").")); } PollStrategy.PollStrategyData pollStrategyData = - (PollStrategy.PollStrategyData) operationDescription.pollStrategyData(); + (PollStrategy.PollStrategyData) operationDescription.pollStrategyData(); 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.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 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(); 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); + .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 = 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)); } - 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..798069a1147e 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() { 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..c55f7700bc90 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.statusCode(); + 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,13 +115,15 @@ 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; @@ -141,9 +146,9 @@ 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) { 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..747834126181 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,15 +45,15 @@ 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") @@ -66,7 +66,8 @@ 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.serializer()).decode(Mono.just(httpResponse), this.methodParser); return asyncDecodedResponse.flatMap(decodedResponse -> { return restProxy.ensureExpectedStatus(decodedResponse, methodParser, additionalAllowedStatusCodes); }).map(decodedResponse -> httpResponse); @@ -164,13 +165,18 @@ Mono sendPollRequestWithDelay() { })).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); + final Object resultObject = + restProxy.handleRestReturnType( + new HttpResponseDecoder(restProxy.serializer()).decode(Mono.just(httpResponse), + this.methodParser), + methodParser, operationStatusResultType, context); operationStatus = new OperationStatus<>(resultObject, status()); } catch (HttpResponseException e) { operationStatus = new OperationStatus<>(e, OperationState.FAILED); @@ -179,18 +185,20 @@ 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(); } /** 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..9e402a2a829c 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); @@ -86,10 +87,15 @@ 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); + if (resource == null + || resource.properties() == null + || resource.properties().provisioningState() == null) { + throw logger.logExceptionAsError(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); + throw logger.logExceptionAsError(new CloudException("Async operation failed with " + + "provisioning state: " + resource.properties().provisioningState(), + bufferedHttpPollResponse)); } else { setStatus(resource.properties().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/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/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..161fe537a0e1 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. @@ -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.body()) .map(bytes -> new String(bytes, StandardCharsets.UTF_8)); return asyncString.block(); } 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..a1711c507603 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -32,6 +32,10 @@ scm:git:https://github.com/Azure/azure-sdk-for-java.git + + com.azure.core.test + + com.azure 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..2f1a9aa734cd 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 @@ -82,8 +82,8 @@ 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. */ 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..d3b3e3d0bdff 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; @@ -135,11 +134,11 @@ public Mono bodyAsByteArray() { * {@inheritDoc} */ @Override - public Flux body() { + public Flux body() { if (bodyBytes == null) { return Flux.empty(); } else { - return Flux.just(Unpooled.wrappedBuffer(bodyBytes)); + return Flux.just(ByteBuffer.wrap(bodyBytes)); } } 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..362902be3a70 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,33 @@ 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 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#response() 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,30 +52,6 @@ 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(); @@ -88,14 +64,21 @@ private Mono playbackHttpResponse(final HttpRequest request) { 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)); } + if (networkCallRecord.exception() != null) { + throw logger.logExceptionAsWarning(Exceptions.propagate(networkCallRecord.exception().get())); + } + + // Overwrite the request header if any. + if (networkCallRecord.headers().containsKey(X_MS_CLIENT_REQUEST_ID)) { + request.header(X_MS_CLIENT_REQUEST_ID, networkCallRecord.headers().get(X_MS_CLIENT_REQUEST_ID)); + } + int recordStatusCode = Integer.parseInt(networkCallRecord.response().get("StatusCode")); HttpHeaders headers = new HttpHeaders(); @@ -112,7 +95,7 @@ private Mono playbackHttpResponse(final HttpRequest request) { } String rawBody = networkCallRecord.response().get("Body"); - byte[] bytes = new byte[0]; + byte[] bytes = null; if (rawBody != null) { for (Map.Entry rule : textReplacementRules.entrySet()) { @@ -121,7 +104,20 @@ private Mono playbackHttpResponse(final HttpRequest request) { } } - bytes = rawBody.getBytes(StandardCharsets.UTF_8); + String contentType = networkCallRecord.response().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 +137,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.query().containsKey("sig")) { + urlBuilder.setQueryParameter("sig", "REDACTED"); + } + + return String.format("%s%s", urlBuilder.path(), 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..5277716b6371 --- /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 throwable(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 className(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 errorMessage(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..ca6446e591ff 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,6 +23,9 @@ public class NetworkCallRecord { @JsonProperty("Response") private Map response; + @JsonProperty("Exception") + private NetworkCallError exception; + /** * Gets the HTTP method for with this network call * @@ -96,4 +99,22 @@ public Map response() { public void response(Map response) { this.response = response; } + + /** + * Gets the throwable thrown during evaluation of the network call. + * + * @return Throwable thrown during the network call. + */ + public NetworkCallError exception() { + return exception; + } + + /** + * Sets the throwable thrown during evaluation of the network call. + * + * @param exception Throwable thrown during the network call. + */ + public void exception(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..02f003e77ffe 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 @@ -8,30 +8,49 @@ 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_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,45 +68,57 @@ 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_CLIENT_REQUEST_ID) != null) { + headers.put(X_MS_CLIENT_REQUEST_ID, context.httpRequest().headers().value(X_MS_CLIENT_REQUEST_ID)); } - 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(CONTENT_TYPE) != null) { + headers.put(CONTENT_TYPE, context.httpRequest().headers().value(CONTENT_TYPE)); } - if (context.httpRequest().headers().value("User-Agent") != null) { - headers.put("User-Agent", context.httpRequest().headers().value("User-Agent")); + 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("\\?$", "")); - - return next.process().flatMap(httpResponse -> { - final HttpResponse bufferedResponse = httpResponse.buffer(); - - 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.httpRequest().url()); + if (urlBuilder.query().containsKey(SIG)) { + urlBuilder.setQueryParameter(SIG, "REDACTED"); + } + networkCallRecord.uri(urlBuilder.toString().replaceAll("\\?$", "")); + + return next.process() + .doOnError(throwable -> { + networkCallRecord.exception(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.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(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 Mono> extractResponseData(final HttpResponse response) { final Map responseData = new HashMap<>(); - responseData.put("StatusCode", Integer.toString(response.statusCode())); + responseData.put(STATUS_CODE, Integer.toString(response.statusCode())); boolean addedRetryAfter = false; for (HttpHeader header : response.headers()) { @@ -104,40 +135,77 @@ private Mono> extractResponseData(final HttpResponse respons responseData.put("retry-after", "0"); } - String contentType = response.headerValue("content-type"); + String contentType = response.headerValue(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.bodyAsByteArray().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.headerValue(CONTENT_ENCODING) == null) { + return response.bodyAsString(StandardCharsets.UTF_8).switchIfEmpty(Mono.just("")).map(content -> { + responseData.put(BODY, redactUserDelegationKey(content)); return responseData; }); } else { - return response.bodyAsByteArray().map(bytes -> { + return response.bodyAsByteArray().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.headerValue(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..6d5e5e6b2c36 100644 --- a/sdk/core/azure-core/README.md +++ b/sdk/core/azure-core/README.md @@ -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) \ No newline at end of file diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 445d02a09685..f81d06772c01 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -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..139337af5c6a 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"); 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..ec508ea6bb58 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. 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/HttpResponseException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java index 559b0e5934fc..d6320a6abcd7 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; } 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..ad755a401bd0 --- /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 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/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/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/HttpRequest.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java index 930153ab1459..b406c5ae9b4c 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; @@ -127,7 +126,7 @@ public HttpRequest header(String name, String value) { * * @return the content to be send */ - public Flux body() { + public Flux body() { return body; } @@ -151,8 +150,7 @@ public HttpRequest body(String content) { */ public HttpRequest body(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 body(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 body(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..c5382a6620ae 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; /** @@ -66,9 +65,9 @@ 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 body(); /** * Get the response content as a byte[]. @@ -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..1d042ee93a65 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; /** @@ -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/CookiePolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java index a9e84bb6ad44..89bac5c9cbfc 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,6 +26,7 @@ * 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 @@ -51,7 +53,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN 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..d3431a66e3f5 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,7 +31,7 @@ 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()); 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..f87e55dff645 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; @@ -62,10 +61,11 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN final long startNs = System.nanoTime(); // Mono logRequest = logRequest(logger, context.httpRequest()); - Function> logResponseDelegate = logResponseDelegate(logger, context.httpRequest().url(), startNs); + Function> logResponseDelegate = + logResponseDelegate(logger, context.httpRequest().url(), 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) { @@ -86,15 +86,19 @@ private Mono logRequest(final ClientLogger logger, final HttpRequest reque logger.info("(empty body)"); logger.info("--> END {}", request.httpMethod()); } else { - boolean isHumanReadableContentType = !"application/octet-stream".equalsIgnoreCase(request.headers().value("Content-Type")); + boolean isHumanReadableContentType = + !"application/octet-stream".equalsIgnoreCase(request.headers().value("Content-Type")); final long contentLength = getContentLength(request.headers()); if (contentLength < MAX_BODY_LOG_SIZE && isHumanReadableContentType) { try { - Mono collectedBytes = FluxUtil.collectBytesInByteBufStream(request.body(), true); + Mono collectedBytes = FluxUtil.collectBytesInByteBufferStream(request.body()); 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.headers().value("Content-Type"), + bodyString); logger.info("{}-byte body:%n{}", contentLength, bodyString); logger.info("--> END {}", request.httpMethod()); return Mono.empty(); @@ -111,7 +115,8 @@ private Mono logRequest(final ClientLogger logger, final HttpRequest reque 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); // @@ -123,9 +128,9 @@ 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.statusCode(), url, tookMs, bodySize); } if (detailLevel.shouldLogHeaders()) { @@ -138,7 +143,7 @@ private Function> logResponseDelegate(final Cli long contentLength = getContentLength(response.headers()); final String contentTypeHeader = response.headerValue("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 -> { bodyStr = prettyPrintIfNeeded(logger, contentTypeHeader, bodyStr); @@ -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..f182b04a7b90 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. @@ -36,7 +35,7 @@ public PortPolicy(int port, boolean overwrite) { 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); + logger.info("Changing port to {}", port); try { context.httpRequest().url(urlBuilder.port(port).toURL()); 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..343b0b520d7a 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. @@ -36,7 +35,7 @@ public ProtocolPolicy(String protocol, boolean overwrite) { 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); + logger.info("Setting protocol to {}", protocol); try { context.httpRequest().url(urlBuilder.scheme(protocol).toURL()); 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..c9f00fdac04e 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; @@ -48,46 +48,49 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN return attemptAsync(context, next, context.httpRequest(), 0); } - private Mono attemptAsync(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next, final HttpRequest originalHttpRequest, final int tryCount) { + private Mono attemptAsync(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next, + final HttpRequest originalHttpRequest, final int tryCount) { context.httpRequest(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(); 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(); // 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; } 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/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..ec0427a395be --- /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.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} + */ + private Publisher extractAndFetchPage(P page) { + String nextPageLink = page.nextLink(); + if (nextPageLink == null) { + return Flux.just(page); + } + return Flux.just(page).concatWith(byPage(page.nextLink())); + } +} 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/StreamResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java index 2d425664720b..eb9ca543d242 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,7 +29,7 @@ public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, * @return the stream content */ @Override - public Flux value() { + public Flux value() { return super.value(); } 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..4da29a09f521 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. */ 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..efb91b6faca2 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; @@ -131,27 +134,68 @@ public Object invoke(Object proxy, final Method method, Object[] args) { 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)); - + // 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); request = createHttpRequest(methodParser, args); - Context context = methodParser.context(args).addData("caller-method", methodParser.fullyQualifiedMethodName()); + Context context = + methodParser.context(args).addData("caller-method", methodParser.fullyQualifiedMethodName()); context = startTracingSpan(method, context); + if (request.body() != null) { + request.body(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.returnType(), + context); } } catch (Exception e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } } + private Flux validateLength(final HttpRequest request) { + final Flux bbFlux = request.body(); + if (bbFlux == null) { + return Flux.empty(); + } + + return Flux.defer(() -> { + Long expectedLength = Long.valueOf(request.headers().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)) { @@ -196,16 +240,22 @@ private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] } 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.scheme(args); urlBuilder.scheme(scheme); 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.path(); + if (hostPath == null || hostPath.isEmpty() || hostPath.equals("/")) { + urlBuilder.path(path); + } else { + urlBuilder.path(hostPath + "/" + path); + } + } } for (final EncodedParameter queryParameter : methodParser.encodedQueryParameters(args)) { @@ -231,8 +281,10 @@ 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.httpMethod(), operationDescription.url()), methodParser, args); // Headers from Swagger method arguments always take precedence over inferred headers from body types for (final String headerName : operationDescription.headers().keySet()) { @@ -243,7 +295,8 @@ private HttpRequest createHttpRequest(OperationDescription operationDescription, } @SuppressWarnings("unchecked") - private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser methodParser, Object[] args) throws IOException { + private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser methodParser, Object[] args) + throws IOException { final Object bodyContentObject = methodParser.body(args); if (bodyContentObject == null) { request.headers().put("Content-Length", "0"); @@ -271,10 +324,11 @@ 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. + } else if (FluxUtil.isFluxByteBuffer(methodParser.bodyJavaType())) { + // 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.body((Flux) bodyContentObject); } else if (bodyContentObject instanceof byte[]) { request.body((byte[]) bodyContentObject); } else if (bodyContentObject instanceof String) { @@ -282,8 +336,11 @@ private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser metho if (!bodyContentString.isEmpty()) { request.body(bodyContentString); } + } else if (bodyContentObject instanceof ByteBuffer) { + request.body(Flux.just((ByteBuffer) bodyContentObject)); } else { - final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.headers())); + final String bodyContentString = + serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.headers())); request.body(bodyContentString); } } @@ -291,15 +348,14 @@ private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser metho 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) { + HttpResponse httpResponse, String responseContent, Object responseDecodedContent) { final int responseStatusCode = httpResponse.statusCode(); String contentType = httpResponse.headerValue("Content-Type"); String bodyRepresentation; @@ -311,14 +367,16 @@ private static Exception instantiateUnexpectedException(UnexpectedExceptionInfor Exception result; try { - final Constructor exceptionConstructor = exception.exceptionType().getConstructor(String.class, HttpResponse.class, exception.exceptionBodyType()); + final Constructor exceptionConstructor = + exception.exceptionType().getConstructor(String.class, HttpResponse.class, + exception.exceptionBodyType()); 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.exceptionType().getCanonicalName() + " cannot be created." + + " Response body: " + bodyRepresentation; result = new IOException(message, e); } @@ -334,12 +392,13 @@ 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) { + public Mono ensureExpectedStatus(final HttpDecodedResponse decodedResponse, + final SwaggerMethodParser methodParser, int[] additionalAllowedStatusCodes) { final int responseStatusCode = decodedResponse.sourceResponse().statusCode(); final Mono asyncResult; if (!methodParser.isExpectedResponseStatusCode(responseStatusCode, additionalAllowedStatusCodes)) { @@ -349,27 +408,34 @@ public Mono ensureExpectedStatus(final HttpDecodedResponse // bodyAsString() emits non-empty string, now look for decoded version of same string Mono decodedErrorBody = decodedResponse.decodedBody(); // - 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.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); + // + })); }).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), + // bodyAsString() emits empty, indicate no body, create exception empty content string no exception + // body object. + Throwable exception = + instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), decodedResponse.sourceResponse(), "", null); @@ -382,7 +448,8 @@ 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)) { @@ -390,11 +457,13 @@ private Mono handleRestResponseReturnType(HttpDecodedResponse response, Swagg if (TypeUtil.isTypeOrSubTypeOf(bodyType, Void.class)) { asyncResult = response.sourceResponse().body().ignoreElements() - .then(Mono.just(createResponse(response, entityType, null))); + .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. @@ -420,7 +489,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 +507,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,26 +523,30 @@ 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.decodedHeaders().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) { + 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(); 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)) { @@ -480,11 +554,12 @@ protected final Mono handleBodyReturnType(final HttpDecodedResponse response, Mono responseBodyBytesAsync = response.sourceResponse().bodyAsByteArray(); 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> + } else if (FluxUtil.isFluxByteBuffer(entityType)) { + // Mono> asyncResult = Mono.just(response.sourceResponse().body()); } else { // Mono or Mono> @@ -493,13 +568,16 @@ protected final Mono handleBodyReturnType(final HttpDecodedResponse response, 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 +589,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 +605,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 + } else if (FluxUtil.isFluxByteBuffer(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 (TypeUtil.isTypeOrSubTypeOf(returnType, void.class) || TypeUtil.isTypeOrSubTypeOf(returnType, + Void.class)) { // ProxyMethod ReturnType: Void asyncExpectedResponse.block(); result = null; @@ -538,8 +619,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; } @@ -613,7 +694,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 +739,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 +749,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/SwaggerMethodParser.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java index 1fd98ca0298c..15475460e706 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; } @@ -201,12 +207,11 @@ public HttpMethod 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() { @@ -220,7 +225,8 @@ public int[] expectedStatusCodes() { * @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); + final String substitutedHost = + applySubstitutions(rawHost, hostSubstitutions, swaggerMethodArguments, UrlEscapers.PATH_ESCAPER); final String[] substitutedHostParts = substitutedHost.split("://"); return substitutedHostParts.length < 1 ? null : substitutedHostParts[0]; } @@ -232,7 +238,8 @@ public String scheme(Object[] swaggerMethodArguments) { * @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); + final String substitutedHost = + applySubstitutions(rawHost, hostSubstitutions, swaggerMethodArguments, UrlEscapers.PATH_ESCAPER); final String[] substitutedHostParts = substitutedHost.split("://"); return substitutedHostParts.length < 2 ? substitutedHost : substitutedHost.split("://")[1]; } @@ -251,8 +258,7 @@ 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) { @@ -263,8 +269,7 @@ 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) { @@ -272,11 +277,11 @@ public Iterable encodedFormParameters(Object[] swaggerMethodAr } 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) { @@ -309,8 +314,8 @@ public Iterable headers(Object[] swaggerMethodArguments) { if (0 <= parameterIndex && parameterIndex < swaggerMethodArguments.length) { final Object methodArgument = swaggerMethodArguments[headerSubstitution.methodParameterIndex()]; if (methodArgument instanceof Map) { - @SuppressWarnings("unchecked") - final Map headerCollection = (Map) methodArgument; + @SuppressWarnings("unchecked") final Map headerCollection = + (Map) methodArgument; final String headerCollectionPrefix = headerSubstitution.urlParameterName(); for (final Map.Entry headerCollectionEntry : headerCollection.entrySet()) { final String headerName = headerCollectionPrefix + headerCollectionEntry.getKey(); @@ -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. @@ -407,15 +412,15 @@ public Object body(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()])) .collect(Collectors.joining("&")); @@ -475,13 +480,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 +503,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,7 +536,8 @@ 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) { @@ -539,12 +547,17 @@ private String applySubstitutions(String originalValue, Iterable s 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.urlParameterName() + "}", substitutionValue); } } } 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..75d5b500f9fd 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 { /** 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..3fa0766ea563 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; @@ -52,8 +51,8 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { - return bodyAsByteArray().flatMapMany(bytes -> Flux.just(Unpooled.wrappedBuffer(bytes))); + public Flux body() { + return bodyAsByteArray().flatMapMany(bytes -> Flux.just(ByteBuffer.wrap(bytes))); } @Override 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..60d0fe8918bf 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) { + 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, 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; 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..088310ed22ac 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,6 +26,7 @@ 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. */ @@ -36,6 +41,7 @@ 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() { @@ -44,6 +50,7 @@ public String 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. */ @@ -58,6 +65,7 @@ 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() { @@ -66,6 +74,7 @@ public String 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. */ @@ -80,6 +89,7 @@ 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. */ @@ -89,6 +99,7 @@ public UrlBuilder port(int port) { /** * Get the port that has been assigned to this UrlBuilder. + * * @return the port that has been assigned to this UrlBuilder. */ public Integer port() { @@ -97,6 +108,7 @@ public Integer 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. */ @@ -111,6 +123,7 @@ 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() { @@ -119,10 +132,10 @@ public String 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,6 +144,7 @@ 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. */ @@ -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() { 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. */ 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..d2e65a3e83d6 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,28 +43,29 @@ 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(); - }); + .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) { // RFC: A response to a HEAD method should not have a body. If so, it must be ignored return Mono.empty(); @@ -72,20 +73,21 @@ static Mono decode(HttpResponse httpResponse, SerializerAdapter serializ 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)); - } - }); + .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)); + } + }); } }); } @@ -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; @@ -274,13 +280,13 @@ private static Object convertToResultType(Object wireResponse, Type resultType, 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,15 +311,22 @@ 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.request(), restResponse.statusCode(), + restResponse.headers(), restResponse.items(), restResponse.nextLink(), + restResponse.deserializedHeaders()); } else if (TypeUtil.isTypeOrSubTypeOf(resultType, ResponseBase.class)) { ResponseBase restResponseBase = (ResponseBase) wireResponse; Object wireResponseBody = restResponseBase.value(); - // 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.request(), restResponseBase.statusCode(), + restResponseBase.headers(), resultBody, restResponseBase.deserializedHeaders()); } else { result = restResponseBase; } @@ -321,10 +334,14 @@ private static Object convertToResultType(Object wireResponse, Type resultType, Response restResponse = (Response) wireResponse; Object wireResponseBody = restResponse.value(); - // 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.request(), restResponse.statusCode(), + restResponse.headers(), resultBody); } else { result = restResponse; } @@ -339,17 +356,17 @@ 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. */ @@ -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); } @@ -396,12 +415,27 @@ private static boolean isReturnTypeDecodable(HttpResponseDecodeData decodeData) Type returnType = decodeData.returnType(); 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); } /** 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..a610c0f54df0 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 @@ -30,8 +30,9 @@ 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 */ @@ -77,8 +78,8 @@ default Type returnValueWireType() { } /** - * 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..1b768d79a129 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 { @@ -84,8 +85,8 @@ public HttpResponse sourceResponse() { public Mono decodedBody() { if (this.bodyCached == null) { this.bodyCached = HttpResponseBodyDecoder.decode(this.response, - this.serializer, - this.decodeData).cache(); + this.serializer, + this.decodeData).cache(); } return this.bodyCached; } @@ -99,15 +100,15 @@ public Mono decodedBody() { public Mono decodedHeaders() { 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() { 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..c66591bc89cd 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,9 +33,10 @@ 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) { + static Mono decode(HttpResponse httpResponse, SerializerAdapter serializer, + HttpResponseDecodeData decodeData) { Type headerType = decodeData.headersType(); if (headerType == null) { return Mono.empty(); @@ -44,7 +45,10 @@ static Mono decode(HttpResponse httpResponse, SerializerAdapter serializ try { return Mono.justOrEmpty(deserializeHeaders(httpResponse.headers(), 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 { + private static Object deserializeHeaders(HttpHeaders headers, SerializerAdapter serializer, + HttpResponseDecodeData decodeData) throws IOException { final Type deserializedHeadersType = decodeData.headersType(); 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(); if (headerName.toLowerCase(Locale.ROOT).startsWith(headerCollectionPrefix)) { - headerCollection.put(headerName.substring(headerCollectionPrefixLength), header.value()); + headerCollection.put(headerName.substring(headerCollectionPrefixLength), + header.value()); } } 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..f106991f6e9d 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"}) 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/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..f82cefaa1968 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

@@ -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..7ef1742c4b58 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,7 +147,8 @@ 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) { + public static Publisher extractAndFetch(PagedResponse page, Context context, + BiFunction> content) { String nextPageLink = page.nextLink(); if (nextPageLink == null) { return Flux.fromIterable(page.items()); 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..9de4f91f0bf5 --- /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.items())) + .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.items())) + .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.items())) + .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.items())) + .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..a3ba1cc4e9f3 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 @@ -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; } 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..d348faf10951 --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java @@ -0,0 +1,120 @@ +// 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.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.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 + Iterator> ite = myIterableStream.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.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.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.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/UserAgentTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java index c97baf2b59ad..a04e4b60d26f 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"), "AutoRest-Java"); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy("AutoRest-Java")) @@ -42,12 +42,12 @@ public Mono send(HttpRequest request) { @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"); Assert.assertEquals("Awesome", header); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy("Awesome")) 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..b6f28d8c5de9 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; @@ -30,7 +30,7 @@ public void basicCredentialsTest() throws Exception { }; // 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()); @@ -58,7 +58,7 @@ public Mono getToken(String... scopes) { }; 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/http/HttpPipelineTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java index fc4d59e79685..c846ccf7cab5 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,13 +79,13 @@ 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)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .build(); @@ -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)); + return Mono.just(new MockHttpResponse(request, 200)); } }; @@ -111,7 +126,7 @@ 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()); @@ -121,7 +136,7 @@ public Mono send(HttpRequest request) { assertEquals(expectedHttpMethod, request.httpMethod()); assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new RequestIdPolicy()) @@ -131,25 +146,4 @@ public Mono send(HttpRequest request) { 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"); - } - } } 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..04a76ab62541 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; @@ -32,7 +31,7 @@ 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(); 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..697e26422496 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; @@ -83,11 +82,11 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { + public Flux body() { if (bodyBytes == null) { return Flux.empty(); } else { - return Flux.just(Unpooled.wrappedBuffer(bodyBytes)); + return Flux.just(ByteBuffer.wrap(bodyBytes)); } } 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 90% 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..73e370c9bc8f 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") @@ -143,7 +144,7 @@ public Mono send(HttpRequest request) { 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,6 +154,7 @@ 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()); @@ -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.body()) + .map(bytes -> new MockHttpResponse(request, 200, new HttpHeaders(request.headers()), 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) { @@ -218,7 +200,7 @@ 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) + Mono asyncString = FluxUtil.collectBytesInByteBufferStream(request.body()) .map(bytes -> new String(bytes, StandardCharsets.UTF_8)); body = asyncString.block(); } 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..a4f39303b7c3 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,7 +30,7 @@ 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()); @@ -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..13bbe6b1e793 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,7 +30,7 @@ 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()); @@ -45,7 +41,7 @@ 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()); @@ -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..8741b9434e49 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,7 +25,7 @@ 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")); 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..272b5c0155eb 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; @@ -44,7 +44,7 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { + public Flux body() { return Flux.empty(); } @@ -64,7 +64,7 @@ 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) { @@ -91,7 +91,7 @@ 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 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..d389040ec7c4 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))) @@ -45,13 +45,13 @@ public Mono send(HttpRequest request) { 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))) 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/RestProxyStressTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java index a8a7258c419f..c63e1168289c 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"; @@ -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())); + .doOnNext(buf -> messageDigest.update(buf.slice())); return content.last().doOnSuccess(b -> { assertArrayEquals(md5, messageDigest.digest()); @@ -424,7 +419,7 @@ 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) @@ -453,7 +448,9 @@ 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) 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..9aba6f97d524 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 { @@ -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.value().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. @@ -1542,7 +1630,7 @@ 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()); } @@ -1550,7 +1638,7 @@ public void segmentUploadTest() throws Exception { @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..e7d937fa1073 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); } }; @@ -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."); - } } 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..d362c71e3f64 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; @@ -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") @@ -116,7 +99,7 @@ static class MockXMLReceiverClient implements HttpClient { @Override public Mono send(HttpRequest request) { if (request.url().toString().endsWith("SetContainerACLs")) { - return FluxUtil.collectBytesInByteBufStream(request.body(), false) + return FluxUtil.collectBytesInByteBufferStream(request.body()) .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 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..dc2000d4a03f 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 @@ -463,6 +463,46 @@ public void pathWhenBuilderPathIsForwardSlashAndPath() { assertEquals("test/path.html", builder.path()); } + @Test + public void pathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .host("www.example.com/site") + .path("index.html"); + assertEquals("www.example.com", builder.host()); + assertEquals("index.html", builder.path()); + assertEquals("www.example.com/index.html", builder.toString()); + } + + @Test + public void pathFirstWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .path("index.html") + .host("www.example.com/site"); + assertEquals("www.example.com", builder.host()); + assertEquals("/site", builder.path()); + assertEquals("www.example.com/site", builder.toString()); + } + + @Test + public void emptyPathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .path("") + .host("www.example.com/site"); + assertEquals("www.example.com", builder.host()); + assertEquals("/site", builder.path()); + assertEquals("www.example.com/site", builder.toString()); + } + + @Test + public void slashPathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .path("//") + .host("www.example.com/site"); + assertEquals("www.example.com", builder.host()); + assertEquals("/site", builder.path()); + assertEquals("www.example.com/site", builder.toString()); + } + @Test public void withAbsolutePath() { final UrlBuilder builder = new UrlBuilder() 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/ci.yml b/sdk/core/ci.yml index 1f44374c8d28..a299d26560f1 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,13 @@ stages: Artifacts: - name: azure-core safeName: azurecore + stagingProfileId: 88192f04117501 - name: azure-core-amqp safeName: azurecoreamqp + 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..aca30d8f51f7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml @@ -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/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..07ca4dae678c 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos/pom.xml @@ -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..bbc4511fa889 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 @@ -21,6 +21,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 +53,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); @@ -380,7 +385,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/CosmosClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java index cafe847f1b5b..9a0ac20c65c4 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 @@ -8,6 +8,8 @@ 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 +22,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 +66,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 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/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/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/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/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/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/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/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..b480f1619782 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -7,7 +7,7 @@ Licensed under the MIT License. com.azure azure-data-sdk-parent - 1.1.0 + 1.2.0 ../../pom.data.xml @@ -36,12 +36,14 @@ Licensed under the MIT License. UTF-8 3.1.0 3.1.0 + 4.1.0 + 1.2.0 1.10.19 - 4.1.36.Final + 4.1.38.Final + 2.0.25.Final 3.1.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/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 3c185370c177..6971f65710b8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -386,3 +386,5 @@ Guidelines](./CONTRIBUTING.md) for more information. [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) \ No newline at end of file diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index 51c992af0178..15e1c9a62cbf 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -33,6 +33,10 @@ HEAD + + com.azure.messaging.eventhubs + + com.azure 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 index 3cfbb85f9597..332a798e0c16 100644 --- 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 @@ -5,9 +5,10 @@ import com.azure.messaging.eventhubs.models.Checkpoint; import com.azure.messaging.eventhubs.models.PartitionContext; +import reactor.core.publisher.Mono; +import java.util.Objects; 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 @@ -24,18 +25,19 @@ public class CheckpointManager { * 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. + * @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; + public CheckpointManager(String ownerId, PartitionContext partitionContext, PartitionManager partitionManager, + String eTag) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId cannot be null"); + this.partitionContext = Objects.requireNonNull(partitionContext, "partitionContext cannot be null"); + this.partitionManager = Objects.requireNonNull(partitionManager, "partitionManager cannot be null"); this.eTag = new AtomicReference<>(eTag); } @@ -49,7 +51,7 @@ public class CheckpointManager { public Mono updateCheckpoint(EventData eventData) { String previousETag = this.eTag.get(); Checkpoint checkpoint = new Checkpoint() - .consumerGroupName(partitionContext.consumerGroupName()) + .consumerGroupName(partitionContext.consumerGroup()) .eventHubName(partitionContext.eventHubName()) .ownerId(ownerId) .partitionId(partitionContext.partitionId()) @@ -69,10 +71,10 @@ public Mono updateCheckpoint(EventData eventData) { * @param offset The offset to update the checkpoint. * @return a representation of deferred execution of this call. */ - public Mono updateCheckpoint(long sequenceNumber, String offset) { + public Mono updateCheckpoint(long sequenceNumber, Long offset) { String previousETag = this.eTag.get(); Checkpoint checkpoint = new Checkpoint() - .consumerGroupName(partitionContext.consumerGroupName()) + .consumerGroupName(partitionContext.consumerGroup()) .eventHubName(partitionContext.eventHubName()) .ownerId(ownerId) .partitionId(partitionContext.partitionId()) 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..5b8927f73758 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 @@ -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<>() @@ -164,40 +204,58 @@ 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)} + * 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() { 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 context() { + 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() { return systemProperties; @@ -218,12 +276,22 @@ public ByteBuffer body() { return body.duplicate(); } + /** + * Returns event data as UTF-8 decoded string. + * + * @return UTF-8 decoded string representation of the event data. + */ + public String bodyAsString() { + 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() { + public Long offset() { return systemProperties.offset(); } @@ -231,7 +299,8 @@ public String offset() { * 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(); @@ -240,7 +309,8 @@ public String partitionKey() { /** * 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(); @@ -250,11 +320,10 @@ public Instant enqueuedTime() { * 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() { + public Long sequenceNumber() { return systemProperties.sequenceNumber(); } @@ -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 offset() { + return offset; } /** @@ -327,7 +430,7 @@ private String offset() { * @return A partition key for this Event Data. */ private String partitionKey() { - return this.getSystemProperty(PARTITION_KEY_ANNOTATION_NAME.getValue()); + return partitionKey; } /** @@ -336,8 +439,7 @@ 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; + return enqueuedTime; } /** @@ -346,22 +448,16 @@ private Instant enqueuedTime() { * * @return Sequence number for this event. * @throws IllegalStateException if {@link SystemProperties} does not contain the sequence number in a - * retrieved event. + * 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 sequenceNumber() { 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..5a880c9c7f13 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 @@ -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) 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..e19180bed5d3 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,13 +84,17 @@ 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.tracerProvider = tracerProvider; this.eventHubName = connectionOptions.eventHubName(); this.connectionId = StringUtil.getRandomString("MF"); this.connectionMono = Mono.fromCallable(() -> { @@ -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)); } /** @@ -156,7 +168,7 @@ 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(); @@ -185,7 +197,7 @@ public EventHubAsyncProducer createProducer(EventHubProducerOptions options) { .cast(AmqpSendLink.class); }); - return new EventHubAsyncProducer(amqpLinkMono, clonedOptions); + return new EventHubAsyncProducer(amqpLinkMono, clonedOptions, tracerProvider); } /** @@ -236,20 +248,23 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti * @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. + * @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."); + 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(); @@ -268,8 +283,6 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti return connection.createSession(entityPath).cast(EventHubSession.class); }).flatMap(session -> { logger.verbose("Creating consumer for path: {}", entityPath); - - logger.verbose("Creating producer for {}", entityPath); final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.retry()); return session.createConsumer(linkName, entityPath, getExpression(eventPosition), @@ -293,8 +306,9 @@ public void close() { 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.host()))); } } } @@ -304,11 +318,18 @@ private static String getExpression(EventPosition eventPosition) { // order of preference if (eventPosition.offset() != null) { - return String.format(AmqpConstants.AMQP_ANNOTATION_FORMAT, OFFSET_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.offset()); + return String.format( + AmqpConstants.AMQP_ANNOTATION_FORMAT, OFFSET_ANNOTATION_NAME.getValue(), + isInclusiveFlag, + eventPosition.offset()); } if (eventPosition.sequenceNumber() != null) { - return String.format(AmqpConstants.AMQP_ANNOTATION_FORMAT, SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.sequenceNumber()); + return String.format( + AmqpConstants.AMQP_ANNOTATION_FORMAT, + SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), + isInclusiveFlag, + eventPosition.sequenceNumber()); } if (eventPosition.enqueuedDateTime() != null) { @@ -319,12 +340,20 @@ private static String getExpression(EventPosition eventPosition) { 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 eventHubName() { + 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..acb652f26197 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 @@ -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); @@ -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..3a02bdaa378e 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 @@ -58,28 +69,25 @@ *

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

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

+ * * {@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#partitionKey(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)}. *

* 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. @@ -88,9 +96,11 @@ * 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()}. - *

+ *

* {@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, * 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.tracerProvider = tracerProvider; } /** @@ -133,11 +146,10 @@ 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(); @@ -166,16 +178,19 @@ public Mono createBatch(BatchOptions options) { /** * 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."); @@ -288,7 +303,14 @@ private Mono sendInternal(Flux events, SendOptions options) { final String partitionKey = options.partitionKey(); 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 -> { @@ -303,6 +325,64 @@ private Mono sendInternal(Flux events, SendOptions options) { }); } + 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() + .partitionKey(partitionKey) + .maximumSizeInBytes(batchSize); + + return events.map(eventData -> { + Context parentContext = eventData.context(); + 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.context().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,20 +398,22 @@ 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.partitionId()))); } 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 { @@ -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; @@ -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..c47442269302 --- /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.retry(); + this.defaultProducerOptions = new EventHubProducerOptions() + .retry(connectionOptions.retry()); + this.defaultConsumerOptions = new EventHubConsumerOptions() + .retry(connectionOptions.retry()) + .scheduler(connectionOptions.scheduler()); + } + + /** + * 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.tryTimeout()); + } + + /** + * 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.tryTimeout()); + } + + /** + * 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#partitionId() 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.retry() != null && options.retry().tryTimeout() != null + ? options.retry().tryTimeout() + : defaultProducerOptions.retry().tryTimeout(); + + 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.retry().tryTimeout()); + } + + /** + * 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#ownerLevel(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.retry() == null || options.retry().tryTimeout() == null + ? defaultConsumerOptions.retry().tryTimeout() + : options.retry().tryTimeout(); + + 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..c0bde2799e68 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,39 +32,44 @@ 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() @@ -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,14 +105,13 @@ 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 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. + * connection string. */ public EventHubClientBuilder connectionString(String connectionString) { final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); @@ -118,7 +120,8 @@ public EventHubClientBuilder connectionString(String connectionString) { tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), properties.sharedAccessKey(), 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); @@ -129,18 +132,25 @@ public EventHubClientBuilder connectionString(String connectionString) { * 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. + * 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 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. + * 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); @@ -149,14 +159,16 @@ public EventHubClientBuilder connectionString(String connectionString, String ev tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), properties.sharedAccessKey(), 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.eventHubName()) && !eventHubName.equals(properties.eventHubName())) { + 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.eventHubName(), eventHubName))); } return credential(properties.endpoint().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. + * 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; } @@ -221,7 +231,7 @@ public EventHubClientBuilder proxyConfiguration(ProxyConfiguration proxyConfigur * specified, an elastic pool is used. * * @param scheduler The scheduler for operations such as connecting to and receiving or sending data to - * Event Hubs. + * Event Hubs. * @return The updated {@link EventHubClientBuilder} object. */ public EventHubClientBuilder scheduler(Scheduler scheduler) { @@ -253,8 +263,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 +283,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 +354,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,15 +366,12 @@ 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) { @@ -335,7 +388,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 +399,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..2b373b902259 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java @@ -0,0 +1,128 @@ +// 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#ownerLevel()} 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 + * referred to as a "Non-Epoch Consumer."
  • + *
+ * + * @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..eb4ad120613b --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java @@ -0,0 +1,199 @@ +// 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#partitionId() 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#partitionId() 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#partitionId(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#partitionKey(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)}. + * + *

+ * 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#partitionKey()}. + *

+ * {@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..7cb9789e40ee 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 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..fe224b16eb6c 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.eventHubName(), + 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; } /** @@ -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..83d7f8617a8b 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 { 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..8708a0bf6d04 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.partitionId()); + 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.partitionId(), + 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.partitionId(), 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/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..8c8cca1165af 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,7 +66,8 @@ 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); 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..c6f2da94f801 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; 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..bc482d0a1ded 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 @@ -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..d84eff99a4a7 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 @@ -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..0988018b2180 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancer.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import static java.util.stream.Collectors.mapping; +import static java.util.stream.Collectors.toList; + +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 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 reactor.core.Exceptions; +import reactor.core.publisher.Mono; +import reactor.util.function.Tuple2; + +/** + * 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::partitionId, 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::ownerId, 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.eventHubName() == null + || !partitionOwnership.eventHubName().equals(this.eventHubName) + || partitionOwnership.consumerGroupName() == null + || !partitionOwnership.consumerGroupName().equals(this.consumerGroupName) + || partitionOwnership.partitionId() == null + || partitionOwnership.lastModifiedTime() == null + || partitionOwnership.eTag() == 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)).partitionId(); + } + + /* + * 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().lastModifiedTime() < TimeUnit.SECONDS + .toMillis(inactiveTimeLimitInSeconds)) && !ImplUtils.isNullOrEmpty(entry.getValue().ownerId()); + }).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.partitionId())) + .doOnError(ex -> logger + .warning("Failed to claim ownership of partition {} - {}", ownershipRequest.partitionId(), + ex.getMessage(), ex)) + .subscribe(partitionPumpManager::startPartitionPump); + } + + private PartitionOwnership createPartitionOwnershipRequest( + final Map partitionOwnershipMap, + final String partitionIdToClaim) { + PartitionOwnership previousPartitionOwnership = partitionOwnershipMap.get(partitionIdToClaim); + PartitionOwnership partitionOwnershipRequest = new PartitionOwnership() + .ownerId(this.ownerId) + .partitionId(partitionIdToClaim) + .consumerGroupName(this.consumerGroupName) + .eventHubName(this.eventHubName) + .sequenceNumber(previousPartitionOwnership == null ? null : previousPartitionOwnership.sequenceNumber()) + .offset(previousPartitionOwnership == null ? null : previousPartitionOwnership.offset()) + .eTag(previousPartitionOwnership == null ? null : previousPartitionOwnership.eTag()) + .ownerLevel(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..28784a547053 --- /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.CheckpointManager; +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 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 reactor.core.publisher.Signal; + +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 by {@link CheckpointManager} to update checkpoints of + * partitions. + * @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.partitionId())) { + logger.info("Consumer is already running for this partition {}", claimedOwnership.partitionId()); + return; + } + + PartitionContext partitionContext = new PartitionContext(claimedOwnership.partitionId(), + claimedOwnership.eventHubName(), claimedOwnership.consumerGroupName(), + claimedOwnership.ownerId(), claimedOwnership.eTag(), partitionManager); + PartitionProcessor partitionProcessor = this.partitionProcessorFactory.get(); + partitionProcessor.initialize(partitionContext); + + EventPosition startFromEventPosition; + if (claimedOwnership.offset() != null) { + startFromEventPosition = EventPosition.fromOffset(claimedOwnership.offset()); + } else if (claimedOwnership.sequenceNumber() != null) { + startFromEventPosition = EventPosition.fromSequenceNumber(claimedOwnership.sequenceNumber()); + } else { + startFromEventPosition = initialEventPosition; + } + + EventHubConsumerOptions eventHubConsumerOptions = new EventHubConsumerOptions().ownerLevel(0L); + EventHubAsyncConsumer eventHubConsumer = eventHubAsyncClient + .createConsumer(claimedOwnership.consumerGroupName(), claimedOwnership.partitionId(), + startFromEventPosition, + eventHubConsumerOptions); + + partitionPumps.put(claimedOwnership.partitionId(), 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.partitionId(), 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.partitionId(), ex); + } finally { + try { + // close the consumer + eventHubConsumer.close(); + } catch (IOException ex) { + logger.warning("Failed to close EventHubConsumer for partition {}", claimedOwnership.partitionId(), ex); + } finally { + // finally, remove the partition from partitionPumps map + partitionPumps.remove(claimedOwnership.partitionId()); + } + } + } + + /* + * Starts a new process tracing span and attached context the EventData object for users. + */ + private Context startProcessTracingSpan(EventData eventData) { + Object diagnosticId = eventData.properties().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..0147b2edfbad 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 @@ -82,7 +82,8 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption this::notifyError, () -> notifyEndpointState(EndpointState.CLOSED))); - tokenResourceProvider = new TokenResourceProvider(connectionOptions.authorizationType(), connectionOptions.host()); + tokenResourceProvider = + new TokenResourceProvider(connectionOptions.authorizationType(), connectionOptions.host()); this.managementChannelMono = connectionMono.then( Mono.fromCallable(() -> (EventHubManagementNode) new ManagementChannel(this, 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..eeaa993c99a2 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); } @@ -305,7 +321,8 @@ private void processSendWork() { delivery.setMessageFormat(workItem.messageFormat()); sentMsgSize = sender.send(workItem.message(), 0, workItem.encodedMessageSize()); - assert sentMsgSize == workItem.encodedMessageSize() : "Contract of the ProtonJ library for Sender.Send API changed"; + assert sentMsgSize == workItem.encodedMessageSize() + : "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(); 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.encodedMessageSize()); if (delivery != null) { delivery.free(); @@ -328,8 +348,12 @@ 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); + ? 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); } 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..6c8e87ef2b89 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; @@ -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..9cc9930cf5c1 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; 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..b2eed58b2147 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 { 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..458c89b675d8 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; /** @@ -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 offset() { 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 offset(Long offset) { this.offset = offset; 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..394aebd84d74 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) { 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; @@ -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) { 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; @@ -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) { 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; @@ -190,7 +196,7 @@ 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() { return prefetchCount; 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..4b2245c47a55 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. @@ -50,16 +50,16 @@ 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() { 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. 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..12e518702c03 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); } /** @@ -168,9 +172,9 @@ public Long 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() { 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..9af649096429 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"); } /** @@ -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 consumerGroup() { + 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() + .consumerGroupName(consumerGroup) + .eventHubName(eventHubName) + .ownerId(ownerId) + .partitionId(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, Long offset) { + String previousETag = this.eTag.get(); + Checkpoint checkpoint = new Checkpoint() + .consumerGroupName(consumerGroup) + .eventHubName(eventHubName) + .ownerId(ownerId) + .partitionId(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/models/PartitionOwnership.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionOwnership.java index d2f54b75f375..cc1da0a32bfd 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; @@ -105,7 +106,8 @@ public PartitionOwnership ownerId(String ownerId) { /** * Gets 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 #ownerId() this instance}. + * @return The owner level (aka epoch number) for the event processor identified by {@link #ownerId() this + * instance}. */ public long ownerLevel() { return ownerLevel; @@ -114,8 +116,8 @@ public long ownerLevel() { /** * Sets 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 #ownerId() this - * instance}. + * @param ownerLevel The owner level (aka epoch number) for the event processor identified by {@link #ownerId() + * this instance}. * @return The updated {@link PartitionOwnership} instance. */ public PartitionOwnership ownerLevel(long ownerLevel) { @@ -128,7 +130,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 offset() { return offset; } @@ -138,7 +140,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 offset(Long offset) { this.offset = offset; return this; } @@ -155,7 +157,8 @@ public Long 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) { @@ -184,13 +187,13 @@ public PartitionOwnership lastModifiedTime(Long lastModifiedTime) { } /** - * 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. */ 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..d7b8e4351d63 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,8 +74,8 @@ 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() { return this.authentication; @@ -82,8 +84,8 @@ public ProxyAuthenticationType 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() { return this.proxyAddress; @@ -92,8 +94,8 @@ public Proxy 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() { 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..2da468ccc781 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) 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..2f33f372ba32 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 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..f176ebb2825e 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,7 +40,8 @@ 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. */ 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/EventHubProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java new file mode 100644 index 000000000000..a525234d4bad --- /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() + .tryTimeout(Duration.ofSeconds(45)); + EventHubProducerOptions options = new EventHubProducerOptions() + .partitionId("foo") + .retry(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() + .partitionKey("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() + .partitionKey("telemetry") + .maximumSizeInBytes(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..8947c5e11b6d --- /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.sequenceNumber()); + 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/LogPartitionProcessor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java index e5747d55d577..2fbea26fb37a 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(), + partitionContext.eventHubName(), partitionContext.consumerGroup(), 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(); + return partitionContext.updateCheckpoint(eventData); } } 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..d121727a12ba 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,6 +3,7 @@ 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.ReactorHandlerProvider; @@ -10,6 +11,7 @@ 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,11 +23,18 @@ 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; @@ -55,8 +64,9 @@ protected String testName() { @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() @@ -88,10 +98,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); 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..fd6932a6687d 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,6 +3,7 @@ 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; @@ -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; @@ -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(); } 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..c5095ab41f2c 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); } @@ -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 @@ -146,6 +157,13 @@ public void deserializeProtonJMessage() { Assert.assertEquals(value, eventData.properties().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.systemProperties().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..94e03c89d0be --- /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.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 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.*; +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 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(); + + private EventHubAsyncClient client; + + @Rule + public TestName testName = new TestName(); + + public EventHubAsyncClientIntegrationTest(TransportType transportType) { + super(new ClientLogger(EventHubAsyncClientIntegrationTest.class)); + + setTransportType(transportType); + } + + @Override + protected String testName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + skipIfNotRecordMode(); + + 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() + .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(); + } + + /** + * 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 { + skipIfNotRecordMode(); + + // 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().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); + } + } + + /** + * 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().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); + } + } +} 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..8cd453839c3b 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,6 +5,7 @@ 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; @@ -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; @@ -75,8 +77,9 @@ protected void beforeTest() { final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), properties.eventHubName(), 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 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..1741a14c08c7 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.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; @@ -45,13 +40,13 @@ protected String testName() { @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()); + skipIfNotRecordMode(); - client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .scheduler(Schedulers.parallel()) + .buildAsyncClient(); } @Override @@ -64,8 +59,6 @@ protected void afterTest() { */ @Test public void sendMessageToPartition() throws IOException { - skipIfNotRecordMode(); - // Arrange final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); final List events = Arrays.asList( @@ -86,8 +79,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 +97,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 +123,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)), 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..a767a8f3e21d 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().tryTimeout(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); @@ -79,7 +92,8 @@ 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); + 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); + 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,8 +143,8 @@ 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()); @@ -137,8 +152,9 @@ public void partitionProducerCannotSendWithPartitionKey() { final EventHubProducerOptions producerOptions = new EventHubProducerOptions() .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))) .partitionId("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() + .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))) + .partitionId("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() + .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))) + .partitionId("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 TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.send(testData, options)) @@ -202,7 +301,8 @@ public void createsEventDataBatch() { 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 TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch()) @@ -240,7 +340,8 @@ public void createsEventDataBatchWithPartitionKey() { 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 TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) @@ -266,7 +367,8 @@ public void createEventDataBatchWhenMaxSizeIsTooBig() { // 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 TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) @@ -299,7 +401,8 @@ public void createsEventDataBatchWithSize() { 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 TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) @@ -328,7 +431,8 @@ public void batchOptionsIsCloned() { 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 TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) @@ -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().retry(new RetryOptions().tryTimeout( + 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..31fbc407153a 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,66 +3,27 @@ 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 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); - } +import java.util.stream.Collectors; - 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; +public class EventHubClientIntegrationTest extends ApiTestBase { + private EventHubClient client; @Rule public TestName testName = new TestName(); - public EventHubClientIntegrationTest(TransportType transportType) { + public EventHubClientIntegrationTest() { super(new ClientLogger(EventHubClientIntegrationTest.class)); - - setTransportType(transportType); } @Override @@ -74,12 +35,10 @@ protected String testName() { 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 +46,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.eventHubName(), properties.name()); + Assert.assertTrue(properties.createdAt().isBefore(Instant.now())); + + Assert.assertNotNull(properties.partitionIds()); + Assert.assertTrue(properties.partitionIds().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.partitionIds()[0]; + + // Act + final PartitionProperties partitionProperties = client.getPartitionProperties(partitionId); + + // Assert + Assert.assertNotNull(partitionProperties); + + Assert.assertEquals(connectionProperties.eventHubName(), partitionProperties.eventHubName()); + Assert.assertEquals(partitionId, partitionProperties.id()); } } 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..be44677ee06d 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,6 +6,7 @@ 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; @@ -24,6 +25,7 @@ import java.net.URI; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.Collections; import java.util.Locale; /** @@ -53,7 +55,9 @@ protected void beforeTest() { eventHubName = getConnectionOptions().eventHubName(); 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 @@ -134,7 +138,9 @@ public void getPartitionPropertiesInvalidToken() throws InvalidKeyException, NoS 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); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider, tracerProvider); // Act & Assert StepVerifier.create(client.getProperties()) @@ -159,7 +165,9 @@ public void getPartitionPropertiesNonExistentHub() { final ConnectionOptions connectionOptions = new ConnectionOptions(original.endpoint().getHost(), "invalid-event-hub", getTokenCredential(), getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); - final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + 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..bfb90e6bd870 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerIntegrationTest.java @@ -0,0 +1,289 @@ +// 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.ApiTestBase; +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 ApiTestBase { + 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 testName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + skipIfNotRecordMode(); + + 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::sequenceNumber, Function.identity())); + Assert.assertEquals(numberOfEvents, asList.size()); + + final Map asList2 = actual2.stream() + .collect(Collectors.toMap(EventData::sequenceNumber, 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().partitionId(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().partitionId(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().partitionId(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::sequenceNumber).collect(Collectors.toList()); + final List asList2 = receive2.stream().map(EventData::sequenceNumber).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().partitionId(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().partitionId(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..6c94f17d2e7c --- /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() + .identifier("an-identifier") + .prefetchCount(PREFETCH) + .retry(new RetryOptions()) + .scheduler(Schedulers.elastic()); + EventHubAsyncConsumer asyncConsumer = new EventHubAsyncConsumer(receiveLinkMono, options); + consumer = new EventHubConsumer(asyncConsumer, options.retry().tryTimeout()); + } + + @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.properties().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.properties().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..524d7981611e --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java @@ -0,0 +1,135 @@ +// 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.ApiTestBase; +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 ApiTestBase { + 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 testName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + skipIfNotRecordMode(); + + 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().partitionId(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().partitionKey("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..831b1fa8e411 --- /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().tryTimeout(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().retry(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.tryTimeout()); + 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().retry(retryOptions), tracerProvider); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + 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().retry(retryOptions), tracerProvider); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + 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.tryTimeout()); + + // 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().retry(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.tryTimeout()); + + // 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() + .partitionKey("some-key") + .maximumSizeInBytes(maxBatchSize); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + + // Act + final EventDataBatch batch = producer.createBatch(options); + + // Arrange + Assert.assertEquals(options.partitionKey(), 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() + .maximumSizeInBytes(maxBatchSize); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + 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/EventHubSharedAccessKeyCredentialTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java index 095b3a4cb034..1c44f320c239 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 @@ -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..f48dd380344e 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,6 +3,7 @@ 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.ReactorHandlerProvider; @@ -65,7 +66,9 @@ 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); } 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..329f373dab18 --- /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.sequenceNumber())); + } + })) + .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.sequenceNumber())); + } + })) + .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..e147c9fe5391 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,22 +3,40 @@ 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.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -54,6 +72,7 @@ public void setup() { @Test public void testWithSimplePartitionProcessor() throws Exception { // Arrange + when(eventHubAsyncClient.eventHubName()).thenReturn("test-eh"); when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); when(eventHubAsyncClient .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class))) @@ -61,36 +80,29 @@ public void testWithSimplePartitionProcessor() throws Exception { 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.offset()).thenReturn(1L); + when(eventData2.offset()).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()); - StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) .expectNextCount(1).verifyComplete(); @@ -100,7 +112,7 @@ public void testWithSimplePartitionProcessor() throws Exception { 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("Offset", Long.valueOf(100), partitionOwnership.offset()); assertEquals("OwnerId", eventProcessor.identifier(), partitionOwnership.ownerId()); assertTrue("LastModifiedTime", partitionOwnership.lastModifiedTime() >= beforeTest); assertTrue("LastModifiedTime", partitionOwnership.lastModifiedTime() <= System.currentTimeMillis()); @@ -115,36 +127,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.eventHubName()).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.eventHubName()).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.sequenceNumber()).thenReturn(1L); + when(eventData2.sequenceNumber()).thenReturn(2L); + when(eventData1.offset()).thenReturn(1L); + when(eventData2.offset()).thenReturn(100L); + + String diagnosticId = "00-08ee063508037b1719dddcbf248e30e2-1365c684eb25daed-01"; + Map properties = new HashMap<>(); + properties.put(DIAGNOSTIC_ID_KEY, diagnosticId); + + when(eventData1.properties()).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.eventHubName()).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.sequenceNumber()).thenReturn(1L); + when(eventData2.sequenceNumber()).thenReturn(2L); + when(eventData1.offset()).thenReturn(1L); + when(eventData2.offset()).thenReturn(100L); + + String diagnosticId = "00-08ee063508037b1719dddcbf248e30e2-1365c684eb25daed-01"; + Map properties = new HashMap<>(); + properties.put(DIAGNOSTIC_ID_KEY, diagnosticId); + + when(eventData1.properties()).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 +285,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.eventHubName()).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(consumer1.receive()).thenReturn( + Mono.fromRunnable(() -> count.countDown()).thenMany(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.offset()).thenReturn(1L); + when(eventData2.offset()).thenReturn(100L); when(eventHubAsyncClient .createConsumer(anyString(), eq("2"), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer2); - when(consumer2.receive()).thenReturn(Flux.just(eventData3)); + when(consumer2.receive()).thenReturn(Mono.fromRunnable(() -> count.countDown()).thenMany(Flux.just(eventData3))); when(eventData3.sequenceNumber()).thenReturn(1L); - when(eventData3.offset()).thenReturn("1"); + when(eventData3.offset()).thenReturn(1L); when(eventHubAsyncClient .createConsumer(anyString(), eq("3"), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer3); - when(consumer3.receive()).thenReturn(Flux.just(eventData4)); + when(consumer3.receive()).thenReturn(Mono.fromRunnable(() -> count.countDown()).thenMany(Flux.just(eventData4))); when(eventData4.sequenceNumber()).thenReturn(1L); - when(eventData4.offset()).thenReturn("1"); + when(eventData4.offset()).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.partitionId().equals("1")) { + verify(consumer1, atLeastOnce()).receive(); + verify(consumer1, atLeastOnce()).close(); + } else if (po.partitionId().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..cebdad993d68 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,6 +5,7 @@ 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.ReactorHandlerProvider; @@ -25,12 +26,19 @@ 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; @@ -57,7 +65,8 @@ protected String testName() { @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))); @@ -102,8 +111,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 +130,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,7 +139,7 @@ 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(); } 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..8c5e41301af4 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,6 +3,7 @@ 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.ReactorHandlerProvider; @@ -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; @@ -64,7 +66,8 @@ 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); } 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..e46d648aa0f2 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; @@ -31,9 +33,9 @@ final class TestUtils { // 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,8 +65,12 @@ static Message getMessage(byte[] contents) { * Creates a mock message with the contents provided. */ static Message getMessage(byte[] contents, String messageTrackingValue) { + return getMessage(contents, messageTrackingValue, Collections.emptyMap()); + } + + static Message getMessage(byte[] contents, String messageTrackingValue, Map additionalProperties) { final Map systemProperties = new HashMap<>(); - systemProperties.put(getSymbol(OFFSET_ANNOTATION_NAME), OFFSET); + systemProperties.put(getSymbol(OFFSET_ANNOTATION_NAME), String.valueOf(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); @@ -80,6 +86,10 @@ 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)); message.setBody(new Data(new Binary(contents))); @@ -91,6 +101,10 @@ static Flux getEvents(int numberOfEvents, String messageTrackingValue .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); 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..eb6ae91dee40 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) 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..0f7b6b091c66 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancerTest.java @@ -0,0 +1,388 @@ +// 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.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.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.LogPartitionProcessor; +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 java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +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 List eventDataList; + private PartitionManager partitionManager; + + @Mock + private EventHubAsyncClient eventHubAsyncClient; + + @Mock + private EventHubAsyncConsumer eventHubConsumer; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + eventDataList = new ArrayList<>(); + IntStream.range(0, 25) + .forEach(index -> { + EventData eventData = mock(EventData.class); + when(eventData.sequenceNumber()).thenReturn((long) index); + when(eventData.offset()).thenReturn(Long.valueOf(index)); + eventDataList.add(eventData); + }); + this.partitionManager = new InMemoryPartitionManager(); + } + + @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(); + assertEquals(index + 1, partitionOwnership.size()); + partitionOwnership.forEach(po -> assertEquals("owner1", partitionOwnership.get(0).ownerId())); + assertEquals(index + 1, partitionOwnership.stream().map(po -> po.partitionId()).distinct().count()); + }); + } + + 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.ownerId()).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.ownerId())).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.ownerId())).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).ownerId())); + assertEquals(index + 1, + partitionOwnership.stream().map(PartitionOwnership::partitionId).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::ownerId).distinct().count()); + assertEquals(2, partitionOwnership.stream().filter(po -> po.ownerId().equals("owner1")).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> po.ownerId().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.ownerId()).distinct().count()); + }); + + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + + assertEquals(3, partitionOwnership.stream().map(po -> po.ownerId()).distinct().count()); + + // each should have 1 partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner0".equals(po.ownerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner1".equals(po.ownerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.ownerId())).count()); + // owner4 should not be in the list + assertTrue(partitionOwnership.stream().noneMatch(po -> po.ownerId().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.ownerId()).distinct().count()); + }); + + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + + assertEquals(3, partitionOwnership.stream().map(po -> po.ownerId()).distinct().count()); + + // each should have 1 partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner0".equals(po.ownerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner1".equals(po.ownerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.ownerId())).count()); + // owner4 should not be in the list + assertTrue(partitionOwnership.stream().noneMatch(po -> po.ownerId().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::ownerId).distinct().count()); + + // each should have 1 partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner0".equals(po.ownerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.ownerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner3".equals(po.ownerId())).count()); + // owner2 should not be in the list as it was stopped + assertTrue(partitionOwnership.stream().noneMatch(po -> "owner1".equals(po.ownerId()))); + } + + @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() + .eventHubName(eventHubName) + .consumerGroupName(consumerGroupName) + .partitionId("1") + .eTag(UUID.randomUUID().toString()) + .ownerLevel(0) + .lastModifiedTime(System.currentTimeMillis()); + // owner id is an empty string + PartitionOwnership claim2 = new PartitionOwnership() + .eventHubName(eventHubName) + .consumerGroupName(consumerGroupName) + .partitionId("2") + .eTag(UUID.randomUUID().toString()) + .ownerLevel(0) + .lastModifiedTime(System.currentTimeMillis()) + .ownerId(""); + 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).ownerId())); + assertEquals(3, partitionOwnership.stream().map(po -> po.partitionId()).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, + LogPartitionProcessor::new, EventPosition.earliest(), eventHubAsyncClient, tracerProvider); + return new PartitionBasedLoadBalancer(partitionManager, eventHubAsyncClient, + eventHubName, consumerGroupName, owner, TimeUnit.SECONDS.toSeconds(5), partitionPumpManager); + } +} 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..2a3a544fa8f3 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,5 @@ stages: ServiceDirectory: eventhubs Artifacts: - name: azure-messaging-eventhubs - safeName: azuremessagingeventhubs \ No newline at end of file + safeName: azuremessagingeventhubs + 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..9c863056e145 100644 --- a/sdk/eventhubs/pom.service.xml +++ b/sdk/eventhubs/pom.service.xml @@ -1,20 +1,41 @@ - + 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 + azure-messaging-eventhubs + + + diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index ee4d6ec67669..3728533b39aa 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -253,3 +253,5 @@ 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 + +![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..1c89785d3b81 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -8,6 +8,10 @@ azure-identity 1.0.0-preview.3 + 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 @@ -15,6 +19,10 @@ ../../../pom.client.xml + + com.azure.identity + + com.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..708eb64c128b 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; 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..06d14d6e8b10 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,7 +13,7 @@ public abstract class AadCredentialBuilderBase} itself + * @return itself */ @SuppressWarnings("unchecked") public T authorityHost(String authorityHost) { @@ -24,7 +24,7 @@ public T authorityHost(String authorityHost) { /** * 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/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..5e1073df9d79 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,7 +22,7 @@ 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) { @@ -33,7 +33,7 @@ public T maxRetry(int maxRetry) { /** * 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) { @@ -44,7 +44,7 @@ public T retryTimeout(Function retryTimeout) { /** * 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) { 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..f8ce50e6032d 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); @@ -43,7 +46,9 @@ 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(); + return this.appServiceMSICredential != null + ? this.appServiceMSICredential.clientId() + : this.virtualMachineMSICredential.clientId(); } /** 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/implementation/AuthorizationCodeListener.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/AuthorizationCodeListener.java index 453f94697411..1b11af265310 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(); + }); } /** 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..9b8b56e72c0b 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 @@ -109,13 +109,18 @@ public class IdentityClient { public Mono authenticateWithClientSecret(String clientSecret, String[] scopes) { String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; try { - ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(clientSecret)).authority(authorityUrl); + ConfidentialClientApplication.Builder applicationBuilder = + ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(clientSecret)) + .authority(authorityUrl); if (options.proxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); } 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) { + public Mono authenticateWithPfxCertificate(String pfxCertificatePath, String pfxCertificatePassword, + String[] scopes) { String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; try { - ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(new FileInputStream(pfxCertificatePath), pfxCertificatePassword)).authority(authorityUrl); + ConfidentialClientApplication.Builder applicationBuilder = + ConfidentialClientApplication.builder(clientId, + ClientCredentialFactory.create(new FileInputStream(pfxCertificatePath), pfxCertificatePassword)) + .authority(authorityUrl); if (options.proxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); } 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); } } @@ -155,13 +172,19 @@ public Mono authenticateWithPemCertificate(String pemCertificatePat String authorityUrl = options.authorityHost().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); + 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 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,12 +199,15 @@ 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 */ @@ -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); } /** @@ -247,8 +281,11 @@ public Mono authenticateWithBrowserInteraction(String[] scopes, int p 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(); @@ -347,7 +385,9 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { 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,11 +409,16 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { } catch (IOException e) { return Mono.error(e); } - if (responseCode == 410 || responseCode == 429 || responseCode == 404 || (responseCode >= 500 && responseCode <= 599)) { + if (responseCode == 410 + || responseCode == 429 + || responseCode == 404 + || (responseCode >= 500 && responseCode <= 599)) { int retryTimeoutInMs = options.retryTimeout().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()) { break; @@ -380,7 +426,9 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { 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.maxRetry()))); } private static void sleep(int millis) { 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..90b9217bfe69 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,7 +40,9 @@ 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; @@ -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..32ed82086c8e 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,7 +23,8 @@ 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(); } 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/DefaultAzureCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DefaultAzureCredentialTest.java index 9c25f03cdca8..65e816001396 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; @@ -84,7 +85,7 @@ public void testUseManagedIdentityCredential() throws Exception { Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().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/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..027a53adeb08 --- /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("Record".equalsIgnoreCase(System.getenv("AZURE_TEST_MODE"))); + //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..d78fb4b8e1c9 --- /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("Record".equalsIgnoreCase(System.getenv("AZURE_TEST_MODE"))); + // 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..c9cbd131a7c8 --- /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("Record".equalsIgnoreCase(System.getenv("AZURE_TEST_MODE"))); + // 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-keys/README.md b/sdk/keyvault/azure-keyvault-keys/README.md index 25205aa60b89..cb9e39c42900 100644 --- a/sdk/keyvault/azure-keyvault-keys/README.md +++ b/sdk/keyvault/azure-keyvault-keys/README.md @@ -446,3 +446,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) \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/pom.xml b/sdk/keyvault/azure-keyvault-keys/pom.xml index c1819383b7dc..0bdc9fc4c538 100644 --- a/sdk/keyvault/azure-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-keyvault-keys/pom.xml @@ -3,8 +3,8 @@ 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 + azure-client-sdk-parent 1.3.0 ../../../pom.client.xml @@ -15,7 +15,8 @@ azure-keyvault-keys 4.0.0-preview.3 - 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,6 +32,10 @@ HEAD + + com.azure.security.keyvault.keys + + @@ -62,6 +67,12 @@ 1.0.0-preview.4 test + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + test + com.azure 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..781dfeaeed22 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#value() 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) { @@ -124,33 +132,37 @@ 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)); + 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)); } /** * 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) { @@ -163,34 +175,38 @@ Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptions, Con .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())) + 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())) .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#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#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#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#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#value() 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) { @@ -228,34 +248,39 @@ Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOpt .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)); + 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)); } /** - * 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#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#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#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#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#value() 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) { @@ -297,28 +327,33 @@ Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOption .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)); + 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)); } /** - * 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#value() 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) { @@ -327,37 +362,42 @@ 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)) + 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())) .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#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.

* *

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

* *

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#value() 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) { @@ -401,14 +448,16 @@ Mono> importKeyWithResponse(KeyImportOptions keyImportOptions, Con .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())) + 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())) .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#value() 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.value().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#value() 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) { @@ -542,29 +607,35 @@ Mono> updateKeyWithResponse(KeyBase key, Context context) { 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())) + 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())) .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#value() 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) { @@ -600,29 +675,31 @@ Mono> updateKeyWithResponse(KeyBase key, Context context, KeyOpera .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())) + 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())) .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#value() 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.value().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#value() 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.value().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#value() 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.value().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#value() 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(), + .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()))); } /** - * 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#value() 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) { @@ -896,19 +990,23 @@ 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)); + 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)); } /** - * 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/KeyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java index 3144c1feeb0d..57a3ff0dec43 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,9 +65,9 @@ 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(); @@ -73,23 +75,26 @@ public Key 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 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(); @@ -97,136 +102,153 @@ public Key createKey(KeyCreateOptions keyCreateOptions) { /** * 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#value() 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#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#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(); } /** - * 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#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#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#value() 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#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#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(); } /** - * 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#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#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#value() 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(); } /** - * 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#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.

* *

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(); } /** - * 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#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.

* *

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#value() 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(); } /** - * 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. - * @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 A {@link Response} whose {@link Response#value() 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. */ 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(); } /** - * 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(); } /** - * 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}. + * @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(); } /** - * 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. - * @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 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, KeyOperation... keyOperations) { return updateKeyWithResponse(key, Context.NONE, keyOperations).value(); } /** - * 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. - * @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 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 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(); } /** - * 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#value() 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(); } /** - * 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#value() 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(); } /** - * 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#value() 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(); } /** - * 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#value() 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(); } /** - * 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. - * @throws ResourceModifiedException when {@code backup} blob is malformed. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key restored key}. + * @throws ResourceModifiedException when {@code backup} blob is malformed. */ 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/KeyRequestAttributes.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestAttributes.java index 608c5c273100..cb92ccdbb7c6 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 */ 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..ec0a1285670c 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 @@ -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/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..6c06c349c0d9 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} @@ -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.kty().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#value() 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#cipherText() 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#cipherText() 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."); @@ -214,63 +237,80 @@ Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Con } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Encrypt Operation is missing " + + "permission/not supported for key with id %s", key.kid()))); } 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(); @@ -280,30 +320,36 @@ Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, by } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Decrypt Operation is not allowed for " + + "key with id %s", key.kid()))); } - 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#signature() 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)); @@ -319,32 +365,36 @@ Mono sign(SignatureAlgorithm algorithm, byte[] digest, Context conte } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key " + + "with id %s", key.kid()))); } 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)); @@ -361,7 +411,8 @@ Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] si } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Verify Operation is not allowed for " + + "key with id %s", key.kid()))); } 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#encryptedKey() 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)); @@ -397,29 +452,36 @@ Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context cont } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Wrap Key Operation is not allowed for " + + "key with id %s", this.key.kid()))); } 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)); @@ -436,30 +498,35 @@ Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Unwrap Key Operation is not allowed " + + "for key with id %s", this.key.kid()))); } 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#signature() 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)); @@ -476,31 +543,36 @@ Mono signData(SignatureAlgorithm algorithm, byte[] data, Context con } 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()))); + return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key " + + "with id %s", this.key.kid()))); } 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)); @@ -517,14 +589,15 @@ Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] } 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()))); + return Mono.error(new UnsupportedOperationException(String.format( + "Verify Operation is not allowed for key with id %s", this.key.kid()))); } 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)); } } 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..aa0295fc0278 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,14 +44,15 @@ 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() { @@ -58,15 +60,16 @@ public Key getKey() { } /** - * 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. - * @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}. + * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. */ @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}. * - *

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

*

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#cipherText() 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#cipherText() 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#cipherText() 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#signature() 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#signature() 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#encryptedKey() 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#encryptedKey() 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#signature() 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#signature() 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..3f9561139abd 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.value().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))); + 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))); } 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()))); + 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()))); } 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))); + 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))); } 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()))); + 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()))); } 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))); + 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))); } 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()))); + 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()))); } 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/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..8e41fb52b60f 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. 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..e0528e56ed39 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,17 +25,17 @@ 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. 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..11c00568427c 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. 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..c84cccc40fcd 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,12 +23,12 @@ 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. 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..e895e1bac7a9 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,12 +23,12 @@ 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. 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/models/DeletedKey.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/DeletedKey.java index bd320ec67a1a..007f60d326ed 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 @@ -61,17 +61,18 @@ public OffsetDateTime 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) { 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..800095c0531c 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. 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..a7c0ec33cf15 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. @@ -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)); } } @@ -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")); } } @@ -650,18 +653,18 @@ 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())); + .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); + .e(toByteArray(publicKey.getPublicExponent())).d(null).p(null).q(null).dp(null) + .dq(null).qi(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)); } } @@ -792,12 +795,12 @@ public static JsonWebKey fromEC(KeyPair keyPair, Provider provider) { 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); + .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); + .x(point.getAffineX().toByteArray()).y(point.getAffineY().toByteArray()) + .kty(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)); @@ -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/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java index 1d7141b1b621..a2825703065c 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 @@ -118,7 +118,7 @@ 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) @@ -126,16 +126,16 @@ public void encrypt() { .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 + // 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())); - // 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 + // 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)); - // 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"); @@ -189,14 +189,14 @@ public void signVerify() throws NoSuchAlgorithmException { .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 + // 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,31 +209,31 @@ 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 + // 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) @@ -241,14 +241,14 @@ public void wrapKeyUnwrapKey() { .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 + // 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 + // 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..88cab358f41e 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 @@ -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 + // 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()); - // 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()); - // 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 + // 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 + // 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 + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context } /** @@ -149,7 +149,7 @@ 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"); @@ -158,9 +158,9 @@ public void signVerify() throws NoSuchAlgorithmException { 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 + // 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"); @@ -169,17 +169,17 @@ public void signVerify() throws NoSuchAlgorithmException { 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 + // 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 + // 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, 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 + // 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 + // 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 + // 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 + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context } /** 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..f42a323cc483 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)); + + }); } /** @@ -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)); } @@ -178,15 +180,16 @@ public void deleteKey() { 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.statusCode()); + }).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.statusCode()); + }).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)); } /** @@ -311,8 +315,9 @@ public void getDeletedKey() { }).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.statusCode()); + }).verifyComplete(); pollOnKeyPurge(keyToDeleteAndGet.name()); sleepInRecordMode(15000); }); @@ -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.statusCode()); + }).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.statusCode()); + }).verifyComplete(); pollOnKeyPurge(keyName); }); 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..eed62076cd22 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); }); } @@ -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); } /** @@ -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); } /** 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..f4a96f64431a 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; @@ -83,7 +84,7 @@ T clientSetup(Function clientBuilder) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { - httpClient = HttpClient.createDefault().wiretap(true); + httpClient = new NettyAsyncHttpClientBuilder().setWiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } 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..a75b6cf9ff56 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; @@ -86,7 +87,7 @@ T clientSetup(Function clientBuilder) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { - httpClient = HttpClient.createDefault().wiretap(true); + httpClient = new NettyAsyncHttpClientBuilder().setWiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } diff --git a/sdk/keyvault/azure-keyvault-secrets/README.md b/sdk/keyvault/azure-keyvault-secrets/README.md index 2268426828d9..b455abfa80d7 100644 --- a/sdk/keyvault/azure-keyvault-secrets/README.md +++ b/sdk/keyvault/azure-keyvault-secrets/README.md @@ -306,3 +306,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..f23be8cce034 100644 --- a/sdk/keyvault/azure-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-keyvault-secrets/pom.xml @@ -3,8 +3,8 @@ 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 + azure-client-sdk-parent 1.3.0 ../../../pom.client.xml @@ -13,7 +13,8 @@ azure-keyvault-secrets 4.0.0-preview.3 - 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,6 +30,10 @@ HEAD + + com.azure.security.keyvault.secrets + + @@ -60,6 +65,12 @@ 1.0.0-preview.4 test + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + test + com.azure 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..9cc2b34a0cec 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 @@ -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/SecretAsyncClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java index af394d45d880..5bcf8080e668 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 @@ -32,9 +32,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 +62,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 +72,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#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.

* *

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}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono setSecret(Secret secret) { @@ -94,20 +97,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#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.

* *

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#value() 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}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> setSecretWithResponse(Secret secret) { @@ -122,10 +127,11 @@ Mono> setSecretWithResponse(Secret secret, Context context) { .contentType(secret.contentType()) .secretAttributes(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.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)); } /** @@ -151,31 +157,30 @@ 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) + 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())) .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. + * 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}. + * 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 +190,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#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. * @throws HttpRequestException if {@code name} name} or {@code version} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -210,7 +212,8 @@ 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())) .doOnError(error -> logger.warning("Failed to get secret - {}", name, error)); @@ -222,19 +225,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. + * 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. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSecret(SecretBase secretBase) { @@ -247,33 +250,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}. + * @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. + * 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. */ @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.name(), secretBase.version() == null ? "" : secretBase.version(), + 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 +286,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 +296,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#name() name} and {@link SecretBase#version() + * 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#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. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSecret(SecretBase secret) { @@ -315,22 +323,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#name() name} and {@link SecretBase#version() + * 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#value() 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#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. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateSecretWithResponse(SecretBase secret) { @@ -340,30 +353,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)); + .tags(secret.tags()) + .contentType(secret.contentType()) + .secretAttributes(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.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)); } /** - * 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 +386,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 +397,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#value() 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 +409,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.value().name())) + .doOnError(error -> logger.warning("Failed to delete secret - {}", name, error)); } /** @@ -403,16 +420,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 +441,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#value() 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 +458,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.value().name())) + .doOnError(error -> logger.warning("Failed to retrieve deleted secret - {}", name, error)); } /** @@ -458,16 +472,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 +488,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 +518,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#value() 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 +541,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.value().name())) + .doOnError(error -> logger.warning("Failed to recover deleted secret - {}", name, error)); } /** @@ -537,15 +554,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 +574,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. + * 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,10 +591,10 @@ 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(), + .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()))); } @@ -590,9 +604,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 +624,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}. + * contains the {@link Secret restored secret}. * @throws ResourceModifiedException when {@code backup} blob is malformed. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -629,20 +641,24 @@ 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)); + 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)); } /** - * 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 +680,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 +734,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 PagedResponse#nextLink()} 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 +796,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/SecretClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java index 86c25a17ba65..435885aa9ef9 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#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.

* *

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}. */ public Secret setSecret(Secret secret) { return setSecretWithResponse(secret, Context.NONE).value(); } /** - * 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(); } /** - * 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#value() 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(); } /** - * 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}. + * @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. */ 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#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. */ public Secret getSecret(SecretBase secretBase) { return getSecretWithResponse(secretBase, Context.NONE).value(); } /** - * 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,9 +183,9 @@ 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(); @@ -175,24 +193,20 @@ public Secret getSecret(String name) { /** * 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. + * @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#name() name} and {@link SecretBase#version() + * 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. - * @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 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. */ 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#name() name} and {@link SecretBase#version() + * 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#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. */ public SecretBase updateSecret(SecretBase secret) { return updateSecretWithResponse(secret, Context.NONE).value(); } /** - * 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#value() 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(); } /** - * 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#value() 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,15 +314,15 @@ 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(); @@ -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#value() 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(); } /** - * 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#value() 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#value() 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(); } /** - * 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#value() 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,14 +475,14 @@ 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. - * @throws ResourceModifiedException when {@code backup} blob is malformed. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Secret restored secret}. + * @throws ResourceModifiedException when {@code backup} blob is malformed. */ public Secret restoreSecret(byte[] backup) { return restoreSecretWithResponse(backup, Context.NONE).value(); @@ -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. - * @throws ResourceModifiedException when {@code backup} blob is malformed. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Secret restored secret}. + * @throws ResourceModifiedException when {@code backup} blob is malformed. */ 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..f5d6cdb9fec5 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,8 +16,8 @@ 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) { 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..e87121c5dbcf 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; @@ -75,17 +75,18 @@ public OffsetDateTime 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) { 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..81b1fee43812 --- /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.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +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.value()); + } +} 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..5e99b0b7c4b8 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)); } /** @@ -115,7 +115,7 @@ public void updateDisabledSecret() { .verifyComplete(); StepVerifier.create(client.getSecret(original.name())) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.FORBIDDEN.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_FORBIDDEN)); }); } @@ -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)); } @@ -180,7 +180,7 @@ public void deleteSecret() { StepVerifier.create(client.purgeDeletedSecret(secretToDelete.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).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)); } /** @@ -218,7 +218,7 @@ public void getDeletedSecret() { StepVerifier.create(client.purgeDeletedSecret(secretToDeleteAndGet.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(secretToDeleteAndGet.name()); 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)); } /** @@ -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)); } /** @@ -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)); } /** @@ -308,7 +308,7 @@ public void restoreSecret() { StepVerifier.create(client.purgeDeletedSecret(secretToBackupAndRestore.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(secretToBackupAndRestore.name()); @@ -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)); } /** @@ -371,7 +371,7 @@ public void listDeletedSecrets() { for (DeletedSecret deletedSecret : deletedSecrets) { StepVerifier.create(client.purgeDeletedSecret(deletedSecret.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(deletedSecret.name()); } @@ -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.statusCode()); }).verifyComplete(); pollOnSecretPurge(secretName); }); 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..425b2c8ce1b7 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); } /** @@ -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.name()), ResourceModifiedException.class, HttpURLConnection.HTTP_FORBIDDEN); }); } @@ -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); } /** @@ -138,7 +138,7 @@ public void deleteSecret() { } 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); } /** @@ -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); } @@ -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); } /** @@ -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); } /** @@ -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); } /** 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..3139baaf5ce0 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; @@ -75,7 +76,7 @@ T clientSetup(Function clientBuilder) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { - httpClient = HttpClient.createDefault().wiretap(true); + httpClient = new NettyAsyncHttpClientBuilder().setWiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } 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..bae1f4b75825 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -40,5 +40,7 @@ stages: Artifacts: - 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..0c37ff936e38 100644 --- a/sdk/keyvault/pom.service.xml +++ b/sdk/keyvault/pom.service.xml @@ -1,30 +1,48 @@ + 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-keys + azure-keyvault-secrets + + + 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..e1e5587c6fe7 100644 --- a/sdk/mediaservices/microsoft-azure-media/pom.xml +++ b/sdk/mediaservices/microsoft-azure-media/pom.xml @@ -25,7 +25,7 @@ com.azure azure-data-sdk-parent - 1.0.0 + 1.2.0 ../../../pom.data.xml 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/README.md b/sdk/storage/azure-storage-blob/README.md index d744b797d538..71e905516af8 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -283,3 +283,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..cb8eb97de5d1 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -15,7 +15,8 @@ azure-storage-blob 12.0.0-preview.3 - 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 @@ -79,13 +84,13 @@ com.azure - azure-identity - 1.0.0-preview.3 - test + azure-core-http-netty + 1.0.0-preview.4 - junit - junit + com.azure + azure-identity + 1.0.0-preview.3 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..306f728d44a5 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; @@ -15,13 +16,14 @@ 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.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** @@ -69,34 +71,31 @@ public final class AppendBlobAsyncClient extends BlobAsyncClient { /** * 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. + * @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} * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * - * @return - * A reactive response containing the information of the created appended blob. + * @return A {@link Mono} containing {@link Response} whose {@link Response#value() 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)) + null, 0, null, metadata, null, headers, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); } @@ -105,19 +104,15 @@ 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 + * @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 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 append blob operation. + * @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); } /** @@ -125,86 +120,81 @@ 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 + * @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 + * @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 appendBlobAccessConditions {@link AppendBlobAccessConditions} * - * @return - * A reactive response containing the information of the append blob operation. + * @return A {@link Mono} containing {@link Response} whose {@link Response#value() 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, + null, null, data, length, null, null, null, null, appendBlobAccessConditions.leaseAccessConditions(), - appendBlobAccessConditions.appendPositionAccessConditions(), - appendBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) + appendBlobAccessConditions.appendPositionAccessConditions(), null, + appendBlobAccessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); + } /** * 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 + * @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. + * @param sourceRange The source {@link BlobRange} to copy. * - * @return - * A reactive response containing the information of the append blob operation. + * @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 + * @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 + * @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 destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} * - * @return - * A reactive response containing the information of the append blob operation. + * @return A {@link Mono} containing {@link Response} whose {@link Response#value() 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, + sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, null, null, null, destAccessConditions.leaseAccessConditions(), destAccessConditions.appendPositionAccessConditions(), - destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, Context.NONE)) + destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); } } 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..cd42306dcc82 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 @@ -4,6 +4,8 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; +import com.azure.core.exception.UnexpectedLengthException; +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,18 +13,18 @@ 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 java.util.Objects; 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; - /** * Client to an append blob. It may only be instantiated through a {@link BlobClientBuilder}, via * the method {@link BlobClient#asAppendBlobClient()}, or via the method @@ -39,7 +41,7 @@ * 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. @@ -66,8 +68,7 @@ public final class AppendBlobClient extends BlobClient { * * @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,46 +78,54 @@ 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. + * @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. + * @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, + public AppendBlobItem create(BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = appendBlobAsyncClient.create(headers, metadata, accessConditions); + return createWithResponse(headers, metadata, accessConditions, timeout, Context.NONE).value(); + } + + /** + * 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. + * @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 created appended blob. + */ + public Response createWithResponse(BlobHTTPHeaders headers, Metadata metadata, + BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = appendBlobAsyncClient.createWithResponse(headers, metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -126,17 +135,14 @@ 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 + * @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. + * @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).value(); } /** @@ -145,85 +151,85 @@ 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 + * @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 + * @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 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 - * The information of the append blob operation. + * @return A {@link Response} whose {@link Response#value() 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 + * @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. + * @param sourceRange The source {@link BlobRange} to copy. * - * @return - * The information of the append blob operation. + * @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) { + return appendBlockFromUrl(sourceURL, sourceRange, null, null, null, null); } /** * 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 + * @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 + * @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. + * @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, + public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { - Mono> response = appendBlobAsyncClient.appendBlockFromUrl(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions); + return this.appendBlockFromUrlWithResponse(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, + sourceAccessConditions, timeout, Context.NONE).value(); + } + + /** + * 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. + * @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 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..e4f9c564294b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BaseBlobClientBuilder.java @@ -0,0 +1,28 @@ +// 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.common.BaseClientBuilder; +import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; + +abstract class BaseBlobClientBuilder> extends BaseClientBuilder { + + private static final String BLOB_ENDPOINT_MIDFIX = "blob"; + + @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) { + // for blob service validations + } +} 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..ab0d4d69d0fb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -10,9 +10,11 @@ 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.AccessTierRequired; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobRange; @@ -24,13 +26,13 @@ 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 +44,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,6 +83,8 @@ 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; @@ -173,7 +179,7 @@ public URL getBlobUrl() { } 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)); } } @@ -186,8 +192,25 @@ 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(context -> existsWithResponse(context)); + } + + 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(); @@ -208,8 +231,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).flatMap(FluxUtil::toMono); } /** @@ -217,7 +240,7 @@ 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-ModifiedAccessConditions-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -231,7 +254,11 @@ 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, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + return withContext(context -> startCopyFromURLWithResponse(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, context)); + } + + Mono> startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; @@ -245,8 +272,8 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); return postProcessResponse(this.azureBlobStorage.blobs().startCopyFromURLWithRestResponseAsync( - null, null, sourceURL, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE)) + null, null, sourceURL, null, metadata, null, null, null, sourceConditions, + destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId())); } @@ -264,8 +291,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 +300,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 +311,13 @@ 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 +334,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).flatMap(FluxUtil::toMono); } /** @@ -312,7 +343,7 @@ 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-ModifiedAccessConditions-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -326,7 +357,11 @@ 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, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + return withContext(context -> copyFromURLWithResponse(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, context)); + } + + Mono> copyFromURLWithResponse(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; @@ -340,8 +375,8 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); return postProcessResponse(this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync( - null, null, copySource, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE)) + null, null, copySource, null, metadata, null, null, sourceConditions, + destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId())); } @@ -358,8 +393,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 +403,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 +414,15 @@ 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.body(options).switchIfEmpty(Flux.just(ByteBuffer.wrap(new byte[0]))))); } /** @@ -402,6 +441,10 @@ public Mono>> download(BlobRange range, ReliableDownlo * 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) { + 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; @@ -413,9 +456,8 @@ Mono download(BlobRange range, BlobAccessConditions acces // 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.leaseAccessConditions(), null, accessConditions.modifiedAccessConditions(), 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. @@ -425,17 +467,19 @@ Mono download(BlobRange range, BlobAccessConditions acces newInfo -> this.download(new BlobRange(newInfo.offset(), newInfo.count()), new BlobAccessConditions().modifiedAccessConditions( - new ModifiedAccessConditions().ifMatch(info.eTag())), false)); + new ModifiedAccessConditions().ifMatch(info.eTag())), 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 +492,20 @@ 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

* @@ -478,25 +526,30 @@ public Mono downloadToFile(String filePath) { */ 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"); + 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.offset() - (range == null ? 0 : range.offset())))) .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,12 +557,12 @@ 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.value().blobSize())); } private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { @@ -541,8 +594,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 +603,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 +614,17 @@ 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, null, snapshot, null, deleteBlobSnapshotOptions, null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) + context)) .map(VoidResponse::new); } @@ -583,8 +640,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 +649,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,13 +657,16 @@ 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)) + null, null, snapshot, null, null, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new BlobProperties(rb.deserializedHeaders()))); } @@ -624,8 +684,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 +694,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 +703,16 @@ 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.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -666,8 +730,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 +740,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 +749,17 @@ 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.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -709,8 +776,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 +785,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,14 +795,17 @@ 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)) + null, null, null, metadata, null, null, accessConditions.modifiedAccessConditions(), + accessConditions.leaseAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.deserializedHeaders().snapshot()))); } @@ -755,8 +825,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).flatMap(FluxUtil::toMono); } /** @@ -767,7 +837,7 @@ public Mono setTier(AccessTier tier) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-LeaseAccessConditions} * *

For more information, see the * Azure Docs

@@ -777,11 +847,16 @@ public Mono setTier(AccessTier tier) { * 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, LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> setTierWithResponse(tier, leaseAccessConditions, context)); + } + + Mono setTierWithResponse(AccessTier tier, 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, null, null, leaseAccessConditions, context)) .map(VoidResponse::new); } @@ -797,9 +872,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(context -> undeleteWithResponse(context)); + } + + Mono undeleteWithResponse(Context context) { return postProcessResponse(this.azureBlobStorage.blobs().undeleteWithRestResponseAsync(null, - null, Context.NONE)) + null, context)) .map(VoidResponse::new); } @@ -819,8 +914,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 +924,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,16 +938,20 @@ 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)) + modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -869,8 +968,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 +977,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,9 +988,13 @@ 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)) + null, leaseId, null, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -908,8 +1011,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 +1020,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 +1031,13 @@ 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 +1054,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 +1064,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,9 +1079,13 @@ 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)) + null, null, breakPeriodInSeconds, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseTime())); } @@ -992,8 +1103,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 +1112,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,9 +1124,13 @@ 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)) + null, leaseId, proposedId, null, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -1031,9 +1146,29 @@ 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(context -> getAccountInfoWithResponse(context)); + } + + Mono> getAccountInfoWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, Context.NONE)) + this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); } @@ -1047,7 +1182,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 +1202,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 +1212,16 @@ 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 +1235,25 @@ 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, + 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 +1279,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 +1288,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 +1297,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,10 +1319,10 @@ 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, + BlobServiceSASSignatureValues blobServiceSASSignatureValues = new BlobServiceSASSignatureValues(version, sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, identifier, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); @@ -1182,34 +1331,34 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); - ServiceSASSignatureValues values = configureServiceSASSignatureValues(serviceSASSignatureValues, + BlobServiceSASSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues, sharedKeyCredential.accountName()); - 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.canonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId - serviceSASSignatureValues.snapshotId(getSnapshotId()); + blobServiceSASSignatureValues.snapshotId(getSnapshotId()); // Set resource if (isSnapshot()) { - serviceSASSignatureValues.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT); + blobServiceSASSignatureValues.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT); } else { - serviceSASSignatureValues.resource(Constants.UrlConstants.SAS_BLOB_CONSTANT); + blobServiceSASSignatureValues.resource(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..9fe850c7ebda 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 @@ -6,6 +6,8 @@ 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; @@ -17,6 +19,7 @@ import com.azure.storage.blob.models.ModifiedAccessConditions; 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 +30,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 +54,8 @@ * Docs for more information. */ public class BlobClient { + private final ClientLogger logger = new ClientLogger(BlobClient.class); + private final BlobAsyncClient blobAsyncClient; /** @@ -155,8 +161,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).value(); } /** @@ -164,13 +170,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 +195,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, Context.NONE).value(); } /** @@ -197,7 +204,7 @@ 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-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -210,12 +217,13 @@ public Response startCopyFromURL(URL sourceURL) { * 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, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions); + .startCopyFromURLWithResponse(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -232,10 +240,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 +250,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 +260,11 @@ 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 +282,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, Context.NONE).value(); } /** @@ -284,7 +291,7 @@ 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-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -297,12 +304,13 @@ public Response copyFromURL(URL copySource) { * 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, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .copyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions); + .copyFromURLWithResponse(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -319,11 +327,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 +339,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 +350,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) + .downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, context) .flatMapMany(res -> res.value() .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 +373,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 +392,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 +421,12 @@ 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); } @@ -421,10 +441,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 +451,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 +461,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 +484,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).value(); } /** @@ -473,18 +493,18 @@ 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 +521,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 +532,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 +540,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 +563,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 +574,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 +582,11 @@ 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 +604,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).value(); } + /** * 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,12 +622,13 @@ 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) + .createSnapshotWithResponse(metadata, accessConditions, context) .map(rb -> new SimpleResponse<>(rb, new BlobClient(rb.value()))); return Utility.blockWithOptionalTimeout(response, timeout); @@ -627,10 +648,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, Context.NONE); } /** @@ -641,7 +661,7 @@ 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-LeaseAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -650,11 +670,11 @@ public VoidResponse setTier(AccessTier tier) { * @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, LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { + Mono response = blobAsyncClient.setTierWithResponse(tier, leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -669,10 +689,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 +699,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 +730,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).value(); } /** @@ -721,7 +740,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 +752,12 @@ 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 +775,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).value(); } /** @@ -765,7 +784,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 +794,12 @@ 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 +815,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 +825,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 +835,11 @@ 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 +857,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).value(); } /** @@ -847,7 +867,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 +881,12 @@ 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 +905,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).value(); } /** @@ -893,7 +914,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 +925,11 @@ 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 +946,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).value(); } /** @@ -933,17 +955,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 +975,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 +989,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 +998,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 +1007,16 @@ 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 +1030,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 +1042,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 +1063,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 +1072,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 +1080,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 +1102,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..d56094ad9993 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; /** @@ -62,67 +44,30 @@ *
  • {@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<>(); - } + public BlobClientBuilder() { } - 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(); + 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 AzureBlobStorageBuilder() .url(String.format("%s/%s/%s", endpoint, containerName, blobName)) @@ -151,7 +96,7 @@ public BlobClient buildBlobClient() { * @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); } /** @@ -175,7 +120,7 @@ public AppendBlobClient buildAppendBlobClient() { * @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); } /** @@ -194,7 +139,7 @@ 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 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. * @@ -202,7 +147,7 @@ public BlockBlobClient buildBlockBlobClient() { * @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); } /** @@ -227,7 +172,7 @@ public PageBlobClient buildPageBlobClient() { * @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); } /** @@ -236,6 +181,7 @@ public PageBlobAsyncClient buildPageBlobAsyncClient() { * @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); @@ -246,15 +192,13 @@ public BlobClientBuilder endpoint(String endpoint) { this.blobName = parts.blobName(); this.snapshot = parts.snapshot(); - this.sasTokenCredential = SASTokenCredential.fromSASTokenString(parts.sasQueryParameters().encode()); - if (this.sasTokenCredential != null) { - this.tokenCredential = null; - this.sharedKeyCredential = null; + SASTokenCredential sasTokenCredential = SASTokenCredential.fromSASTokenString(parts.sasQueryParameters().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; } @@ -289,142 +233,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/BlobInputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java index 18ef656c3550..9fe92ddfeea8 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,13 +88,10 @@ 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. + * @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. + * @throws StorageException An exception representing any error which occurred during the operation. */ BlobInputStream(final BlobAsyncClient blobClient, final BlobAccessConditions accessCondition) throws StorageException { this(blobClient, 0, null, accessCondition); @@ -100,17 +102,12 @@ public final class BlobInputStream extends InputStream { * 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. + * @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) @@ -127,7 +124,7 @@ 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); @@ -144,8 +141,7 @@ public final class BlobInputStream extends InputStream { * 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. + * @throws IOException If an I/O error occurs. */ @Override public synchronized int available() throws IOException { @@ -155,8 +151,7 @@ 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 + * @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 { @@ -168,8 +163,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 +176,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. + * @param readLength An int which represents the number of bytes to read. * - * @throws IOException - * If an I/O error occurs. + * @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()) + .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.body(null)).map(ByteBuffer::wrap)) .block(); this.bufferSize = readLength; @@ -207,8 +199,7 @@ 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 + * @param readlimit An int which represents the maximum limit of bytes that can be read before the mark * position becomes invalid. */ @Override @@ -238,8 +229,7 @@ public boolean markSupported() { * @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. + * @throws IOException If an I/O error occurs. */ @Override public int read() throws IOException { @@ -275,14 +265,11 @@ public int read() throws IOException { * * read(b, 0, b.length) * - * @param b - * A byte array which represents the buffer into which the data is read. + * @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 + * @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. + * @throws NullPointerException If the byte array b is null. */ @Override public int read(final byte[] b) throws IOException { @@ -323,30 +310,24 @@ public int read(final byte[] b) throws IOException { * 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 + * @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. + * @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 + * @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 + * @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,19 +336,15 @@ 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 + * @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. + * @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 + * @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 { @@ -406,8 +383,7 @@ 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 +395,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 +413,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 +422,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..a67649d8f187 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,165 @@ 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 +187,174 @@ 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; - /** - * 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 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.appendPositionAccessConditions(); + + if (appendBlobAccessConditions.appendPositionAccessConditions().appendPosition() != null) { + this.initialBlobOffset = appendBlobAccessConditions.appendPositionAccessConditions().appendPosition(); + } else { + this.initialBlobOffset = client.getProperties().block().blobSize(); + } + } else { + this.initialBlobOffset = client.getProperties().block().blobSize(); + this.appendPositionAccessConditions = new AppendPositionAccessConditions(); + } } - 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))); + private Mono appendBlock(Flux blockData, long offset, long writeLength) { + this.appendPositionAccessConditions.appendPosition(offset); + + 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 + if (this.appendPositionAccessConditions != null + && this.appendPositionAccessConditions.maxSize() != null && this.initialBlobOffset > this.appendPositionAccessConditions.maxSize()) { 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; - - 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; - }); - } + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - 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.leaseAccessConditions(); - /** - * 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, 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() + .modifiedAccessConditions(blobAccessConditions.modifiedAccessConditions()) + .leaseAccessConditions(blobAccessConditions.leaseAccessConditions()); + } 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().start(offset).end(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/BlobSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java index 24f4b0d0a96c..caef787c0590 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,13 +3,15 @@ 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 + * {@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,8 +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. 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..035c68b97b73 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,10 +5,15 @@ 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.util.FluxUtil; +import com.azure.core.implementation.http.PagedResponseBase; 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; @@ -21,23 +26,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.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** - * 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,6 +65,8 @@ * 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; /** @@ -86,10 +99,10 @@ public ContainerAsyncClient getContainerAsyncClient(String containerName) { * Azure Docs. * * @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); } /** @@ -101,24 +114,46 @@ public Mono> createContainer(String containerName * @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#value() 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. * * @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. + * + * @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 +166,7 @@ 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)); } } @@ -141,7 +176,7 @@ public URL getAccountUrl() { * * @return A reactive response emitting the list of containers. */ - public Flux listContainers() { + public PagedFlux listContainers() { return this.listContainers(new ListContainersOptions()); } @@ -152,9 +187,34 @@ public Flux listContainers() { * @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); + } + + /* + * Implementation for this paged listing operation, supporting an optional timeout provided by the synchronous + * BlobServiceClient. Applies the given timeout to each Mono backing the + * PagedFlux. + * + * @param options A {@link ListContainersOptions} which specifies what data should be returned by the service. + * @param timeout An optional timeout to be applied to the network asynchronous operations. + * @return A reactive response emitting the list of containers. + */ + PagedFlux listContainersWithOptionalTimeout(ListContainersOptions options, Duration timeout) { + + Function>> func = + marker -> listContainersSegment(marker, options, timeout) + .map(response -> new PagedResponseBase<>( + response.request(), + response.statusCode(), + response.headers(), + response.value().containerItems(), + response.value().nextMarker(), + response.deserializedHeaders())); + + return new PagedFlux<>( + () -> func.apply(null), + marker -> func.apply(marker)); } /* @@ -178,37 +238,39 @@ public Flux listContainers(ListContainersOptions options) { * [!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) { + 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)); + 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. + * + * @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. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the storage + * account properties. */ - public Mono> getProperties() { + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, Context.NONE)) + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.value())); } @@ -219,11 +281,28 @@ public Mono> getProperties() { * sets the version header on each request, overriding the default. * * @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 setPropertiesWithReponse(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. + * + * @param properties Configures the service. + * @return A {@link Mono} containing the storage account properties. */ - public Mono setProperties(StorageServiceProperties properties) { + public Mono setPropertiesWithReponse(StorageServiceProperties properties) { + return withContext(context -> setPropertiesWithReponse(properties, context)); + } + + Mono setPropertiesWithReponse(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); } @@ -233,13 +312,31 @@ public Mono setProperties(StorageServiceProperties properties) { * * @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}. + * + * @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#value() 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( @@ -247,7 +344,7 @@ public Mono> getUserDelegationKey(OffsetDateTime sta 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) + null, null, context) ).map(rb -> new SimpleResponse<>(rb, rb.value())); } @@ -257,11 +354,28 @@ public Mono> getUserDelegationKey(OffsetDateTime sta * the * Azure Docs. * - * @return A reactive response containing the storage account statistics. + * @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. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the storage + * account statistics. + */ + public Mono> getStatisticsWithResponse() { + return withContext(context -> getStatisticsWithResponse(context)); + } + + Mono> getStatisticsWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, Context.NONE)) + this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.value())); } @@ -269,10 +383,25 @@ public Mono> getStatistics() { * 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. + * @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 {@link Mono} containing a {@link Response} whose {@link Response#value() value} the storage account + * info. */ - public Mono> getAccountInfo() { - return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(Context.NONE)) + public Mono> getAccountInfoWithResponse() { + return withContext(context -> getAccountInfoWithResponse(context)); + } + + Mono> getAccountInfoWithResponse(Context context) { + return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(context)) .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); } @@ -286,7 +415,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 +423,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 +441,12 @@ 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); + AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + IPRange ipRange, SASProtocol sasProtocol) { SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); + Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); - SASQueryParameters sasQueryParameters = accountSASSignatureValues.generateSASQueryParameters(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..a829f552342b 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; @@ -68,10 +72,10 @@ public ContainerClient getContainerClient(String containerName) { * Azure Docs. * * @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).value(); } /** @@ -83,12 +87,13 @@ public Response createContainer(String containerName) { * @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#value() 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); } /** @@ -96,10 +101,21 @@ public Response createContainer(String containerName, Metadata * more information see the Azure Docs. * * @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. + * + * @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,18 +128,18 @@ 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. * * @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. * @@ -131,10 +147,8 @@ public Iterable listContainers() { * @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)); } /** @@ -143,8 +157,8 @@ public Iterable listContainers(ListContainersOptions options, Dur * * @return The storage account properties. */ - public Response getProperties() { - return this.getProperties(null); + public StorageServiceProperties getProperties() { + return getPropertiesWithResponse(null, Context.NONE).value(); } /** @@ -152,11 +166,12 @@ public Response getProperties() { * Azure Docs. * * @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#value() 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); } @@ -168,10 +183,9 @@ public Response getProperties(Duration timeout) { * sets the version header on each request, overriding the default. * * @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); } /** @@ -182,10 +196,11 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * * @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.setPropertiesWithReponse(properties, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -198,8 +213,8 @@ public VoidResponse setProperties(StorageServiceProperties properties, Duration * @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).value(); } /** @@ -209,11 +224,12 @@ public Response getUserDelegationKey(OffsetDateTime start, Of * @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#value() 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); } @@ -226,8 +242,8 @@ public Response getUserDelegationKey(OffsetDateTime start, Of * * @return The storage account statistics. */ - public Response getStatistics() { - return this.getStatistics(null); + public StorageServiceStats getStatistics() { + return getStatisticsWithResponse(null, Context.NONE).value(); } /** @@ -237,10 +253,11 @@ public Response getStatistics() { * Azure Docs. * * @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#value() 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); } @@ -251,8 +268,8 @@ public Response getStatistics(Duration timeout) { * * @return The storage account info. */ - public Response getAccountInfo() { - return this.getAccountInfo(null); + public StorageAccountInfo getAccountInfo() { + return getAccountInfoWithResponse(null, Context.NONE).value(); } /** @@ -260,10 +277,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#value() 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 +296,20 @@ public Response getAccountInfo(Duration timeout) { * @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.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 +321,8 @@ 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) { + 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..d90f6a91c538 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,36 +3,14 @@ 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} @@ -50,32 +28,17 @@ * 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<>(); - } + public BlobServiceClientBuilder() { } /** * @return a {@link BlobServiceClient} created from the configurations in this builder. @@ -88,44 +51,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(); - } - 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 BlobServiceAsyncClient(new AzureBlobStorageBuilder() - .url(endpoint) + .url(super.endpoint) .pipeline(pipeline) .build()); } /** - * 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 +72,20 @@ 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).sasQueryParameters().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..524ffc6c2733 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASQueryParameters.java @@ -0,0 +1,258 @@ +// 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.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 signed identifier (only for {@link BlobServiceSASSignatureValues}) or {@code null}. Please see + * here + * for more information. + */ + public String identifier() { + return identifier; + } + + /** + * @return The storage container or blob (only for {@link BlobServiceSASSignatureValues}). + */ + public String resource() { + return resource; + } + + /** + * @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); + } + + /** + * 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..05e0f876b812 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASSignatureValues.java @@ -0,0 +1,520 @@ +// 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 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 permissions 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + * @throws RuntimeException If {@code urlString} is a malformed URL. + */ + public BlobServiceSASSignatureValues canonicalName(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 snapshotId() { + 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 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues 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 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.value(), 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.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/BlobURLParts.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java index 90a9c4892caa..685c369ebbba 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 @@ -34,7 +34,7 @@ final class BlobURLParts { private String snapshot; - private SASQueryParameters sasQueryParameters; + private BlobServiceSASQueryParameters blobServiceSasQueryParameters; private Map unparsedParameters; @@ -123,19 +123,19 @@ public BlobURLParts snapshot(String snapshot) { } /** - * A {@link SASQueryParameters} representing the SAS query parameters or {@code null} if there were no such + * A {@link BlobServiceSASQueryParameters} representing the SAS query parameters or {@code null} if there were no such * parameters. */ - public SASQueryParameters sasQueryParameters() { - return sasQueryParameters; + public BlobServiceSASQueryParameters sasQueryParameters() { + return blobServiceSasQueryParameters; } /** - * A {@link SASQueryParameters} representing the SAS query parameters or {@code null} if there were no such + * 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 sasQueryParameters(BlobServiceSASQueryParameters blobServiceSasQueryParameters) { + this.blobServiceSasQueryParameters = blobServiceSasQueryParameters; return this; } @@ -161,8 +161,7 @@ public BlobURLParts unparsedParameters(Map unparsedParameters) * * @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 + * @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 { @@ -181,8 +180,8 @@ public URL toURL() throws MalformedURLException { 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); } 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..61509c8046d3 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,23 @@ 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.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.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 +28,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,11 +36,15 @@ 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 @@ -66,6 +70,8 @@ * 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; @@ -104,22 +110,20 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { * {@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 + * @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 + * @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. + * @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).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. @@ -130,52 +134,192 @@ public Mono> upload(Flux data, long length) { * {@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 + * @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 + * @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} + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} * - * @return - * A reactive response containing the information of the uploaded block blob. + * @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, BlobAccessConditions accessConditions) { + return withContext(context -> uploadWithResponse(data, length, headers, metadata, accessConditions, context)); + } + + Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blockBlobs().uploadWithRestResponseAsync(null, - null, data, length, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, data, length, null, metadata, null, null, headers, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); } /** - * 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)}. + * 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. * + * @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).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 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. + * + * @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 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, 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.leaseAccessConditions()) + // 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, accessConditions)); + + } + + /** + * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file. * @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); } /** * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file. - * * @param filePath Path to the upload file * @param blockSize Size of the blocks to upload * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} * @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 @@ -183,7 +327,7 @@ public Mono uploadFromFile(String filePath) { public Mono uploadFromFile(String filePath, Integer blockSize, BlobHTTPHeaders headers, Metadata metadata, 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), @@ -193,25 +337,26 @@ public Mono uploadFromFile(String filePath, Integer blockSize, BlobHTTPHea .doOnNext(chunk -> blockIds.put(chunk.offset(), getBlockID())) .flatMap(chunk -> { String blockId = blockIds.get(chunk.offset()); - return stageBlock(blockId, FluxUtil.byteBufStreamFromFile(channel, chunk.offset(), chunk.count()), chunk.count(), null); + return stageBlockWithResponse(blockId, FluxUtil.readFile(channel, chunk.offset(), chunk.count()), chunk.count(), null); }) - .then(Mono.defer(() -> commitBlockList(new ArrayList<>(blockIds.values()), headers, metadata, accessConditions))) + .then(Mono.defer(() -> commitBlockListWithResponse(new ArrayList<>(blockIds.values()), headers, metadata, 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 +364,7 @@ private void uploadFileCleanup(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -252,22 +397,17 @@ private List sliceFile(String path, Integer blockSize) { * 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 + * @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 + * @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 + * @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. + * @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,27 +418,26 @@ 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 + * @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 + * @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 + * @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 + * @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. + * @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, null, context)) .map(VoidResponse::new); } @@ -306,62 +445,55 @@ public Mono stageBlock(String base64BlockID, Flux data, l * 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 + * @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 + * @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 sourceRange {@link BlobRange} * - * @return - * A reactive response signalling completion. + * @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 + * @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 + * @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 + * @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 + * @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 sourceModifiedAccessConditions {@link SourceModifiedAccessConditions} * - * @return - * A reactive response signalling completion. + * @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, null, leaseAccessConditions, sourceModifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -370,44 +502,31 @@ public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. + * @param listType Specifies which type of blocks to return. * - * @return - * A reactive response containing the list of blocks. + * @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.listBlocks(listType, null).map(Response::value); } /** - * * 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 + * @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. + * @return A reactive response containing the list of blocks. */ - public Flux listBlocks(BlockListType listType, + public Mono> 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); - }); + null, null, listType, snapshot, null, null, leaseAccessConditions, Context.NONE)) + .map(response -> new SimpleResponse<>(response, response.value())); } /** @@ -419,14 +538,12 @@ public Flux listBlocks(BlockListType listType, * 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 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. + * @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).flatMap(FluxUtil::toMono); } /** @@ -438,27 +555,25 @@ public Mono> commitBlockList(List base64BlockIDs * 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 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. + * @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, BlobAccessConditions accessConditions) { + return withContext(context -> commitBlockListWithResponse(base64BlockIDs, headers, metadata, accessConditions, context)); + } + + Mono> commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; 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().latest(base64BlockIDs), null, null, null, metadata, null, null, headers, + accessConditions.leaseAccessConditions(), null, accessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); } } 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..18a7b96e0b81 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 @@ -5,18 +5,20 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.exception.UnexpectedLengthException; +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; 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 java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -25,6 +27,7 @@ import java.io.InputStream; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; import java.util.List; @@ -73,11 +76,9 @@ 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. - * * @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); @@ -87,16 +88,14 @@ public BlobOutputStream getBlobOutputStream() { * 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. + * @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); } /** @@ -107,18 +106,15 @@ public BlobOutputStream getBlobOutputStream(BlobAccessConditions accessCondition * 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 + * @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. + * @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, Context.NONE).value(); } /** @@ -129,40 +125,26 @@ public Response upload(InputStream data, long length) throws IOEx * 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 + * @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. + * @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 uploaded block blob. + * @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, 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, accessConditions, context); try { return Utility.blockWithOptionalTimeout(upload, timeout); @@ -173,26 +155,26 @@ public Response upload(InputStream data, long length, BlobHTTPHea /** * Creates a new block blob, or updates the content of an existing block blob. - * * @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); } /** * Creates a new block blob, or updates the content of an existing block blob. - * * @param filePath Path of the file to upload * @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. + * * @throws IOException If an I/O error occurs */ public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout) throws IOException { + BlobAccessConditions accessConditions, Duration timeout) throws IOException { Mono upload = this.blockBlobAsyncClient.uploadFromFile(filePath, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, headers, metadata, accessConditions); try { @@ -207,18 +189,14 @@ 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 + * @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 + * @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 */ - 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,38 +204,27 @@ 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 + * @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 + * @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 + * @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 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); } @@ -265,54 +232,44 @@ public VoidResponse stageBlock(String base64BlockID, InputStream data, long leng * 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 + * @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 + * @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 + * @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 + * @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 + * @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 + * @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 + * @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 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,38 +278,31 @@ public VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. + * @param listType Specifies which type of blocks to return. * - * @return - * The list of blocks. + * @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).value(); } /** - * * 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 + * @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 timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * - * @return - * The list of blocks. + * @return The list of blocks. */ - public Iterable listBlocks(BlockListType listType, + public Response listBlocksWithResponse(BlockListType listType, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Flux response = blockBlobAsyncClient.listBlocks(listType, leaseAccessConditions); + Mono> response = blockBlobAsyncClient.listBlocks(listType, leaseAccessConditions); - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -364,14 +314,12 @@ public Iterable listBlocks(BlockListType listType, * 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 base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. * - * @return - * The information of the block blob. + * @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, Context.NONE).value(); } /** @@ -383,23 +331,20 @@ public Response commitBlockList(List base64BlockIDs) { * 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. + * @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. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The information of the block blob. + * @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, BlobAccessConditions accessConditions, Duration timeout, + Context context) { + Mono> response = blockBlobAsyncClient.commitBlockListWithResponse( + base64BlockIDs, headers, metadata, 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..94489b435714 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 @@ -4,16 +4,18 @@ package com.azure.storage.blob; 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.util.FluxUtil; +import com.azure.core.implementation.http.PagedResponseBase; 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; @@ -25,13 +27,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 +41,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,6 +77,7 @@ public final class ContainerAsyncClient { public static final String LOG_CONTAINER_NAME = "$logs"; + private final ClientLogger logger = new ClientLogger(ContainerAsyncClient.class); private final AzureBlobStorageImpl azureBlobStorage; /** @@ -235,7 +243,7 @@ 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)); } } @@ -244,8 +252,26 @@ public URL getContainerUrl() { * * @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. + * + * @return true if the container exists, false if it doesn't + */ + public Mono> existsWithResponse() { + return withContext(context -> existsWithResponse(context)); + } + + /** + * 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(); @@ -260,8 +286,8 @@ public Mono> exists() { * * @return A reactive response signalling completion. */ - public Mono create() { - return this.create(null, null); + public Mono create() { + return createWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -274,12 +300,15 @@ public Mono create() { * 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); } /** @@ -289,8 +318,8 @@ public Mono create(Metadata metadata, PublicAccessType accessType) * * @return A reactive response signalling completion. */ - public Mono delete() { - return this.delete(null); + public Mono delete() { + return deleteWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -303,18 +332,21 @@ public Mono delete() { * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has either * {@link ModifiedAccessConditions#ifMatch()} or {@link ModifiedAccessConditions#ifNoneMatch()} 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())) { // 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.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -322,10 +354,11 @@ 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. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the + * container properties. */ - public Mono> getProperties() { - return this.getProperties(null); + public Mono getProperties() { + return getPropertiesWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -336,10 +369,13 @@ public Mono> getProperties() { * not match the active lease on the blob. * @return A reactive response containing the container properties. */ - public Mono> getProperties(LeaseAccessConditions leaseAccessConditions) { - return postProcessResponse(this.azureBlobStorage.containers() - .getPropertiesWithRestResponseAsync(null, null, null, - leaseAccessConditions, Context.NONE)) + 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)) .map(rb -> new SimpleResponse<>(rb, new ContainerProperties(rb.deserializedHeaders()))); } @@ -348,10 +384,11 @@ public Mono> getProperties(LeaseAccessConditions l * Azure Docs. * * @param metadata {@link Metadata} - * @return A reactive response signalling completion. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() 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); } /** @@ -364,21 +401,24 @@ public Mono setMetadata(Metadata metadata) { * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has * anything set other than {@link ModifiedAccessConditions#ifModifiedSince()}. */ - 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) { // 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.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), + context)).map(VoidResponse::new); } /** @@ -388,8 +428,8 @@ public Mono setMetadata(Metadata metadata, ContainerAccessConditio * * @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); } /** @@ -401,9 +441,14 @@ public Mono> getAccessPolicy() { * 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.deserializedHeaders().blobPublicAccess(), response.value())))); } /** @@ -420,9 +465,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); } /** @@ -442,13 +487,17 @@ public Mono setAccessPolicy(PublicAccessType accessType, * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has either * {@link ModifiedAccessConditions#ifMatch()} or {@link ModifiedAccessConditions#ifNoneMatch()} 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())) { // 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.")); } /* @@ -470,11 +519,9 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer } } - return postProcessResponse(this.azureBlobStorage.containers() - .setAccessPolicyWithRestResponseAsync(null, identifiers, null, accessType, - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) - .map(VoidResponse::new); + return postProcessResponse(this.azureBlobStorage.containers().setAccessPolicyWithRestResponseAsync(null, identifiers, + null, accessType, null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), + context)).map(VoidResponse::new); } /** @@ -497,7 +544,7 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer * * @return A reactive response emitting the flattened blobs. */ - public Flux listBlobsFlat() { + public PagedFlux listBlobsFlat() { return this.listBlobsFlat(new ListBlobsOptions()); } @@ -522,8 +569,39 @@ public Flux listBlobsFlat() { * @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.value().segment() == null + ? new ArrayList<>(0) + : response.value().segment().blobItems(); + + return new PagedResponseBase<>( + response.request(), + response.statusCode(), + response.headers(), + value, + response.value().nextMarker(), + response.deserializedHeaders()); + }); + + return new PagedFlux<>( + () -> func.apply(null), + marker -> func.apply(marker)); } /* @@ -547,30 +625,13 @@ public Flux listBlobsFlat(ListBlobsOptions options) { * [!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.prefix(), marker, + options.maxResults(), options.details().toList(), null, null, Context.NONE), + timeout)); } /** @@ -600,7 +661,7 @@ private Flux listBlobsFlatHelper(ListBlobsOptions options, ContainersL * @param directory The directory to list blobs underneath * @return A reactive response emitting the prefixes and blobs. */ - public Flux listBlobsHierarchy(String directory) { + public PagedFlux listBlobsHierarchy(String directory) { return this.listBlobsHierarchy("/", new ListBlobsOptions().prefix(directory)); } @@ -632,9 +693,44 @@ public Flux listBlobsHierarchy(String directory) { * @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); + } + + /* + * 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 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. + */ + PagedFlux listBlobsHierarchyWithOptionalTimeout(String delimiter, ListBlobsOptions options, Duration timeout) { + Function>> func = + marker -> listBlobsHierarchySegment(marker, delimiter, options, timeout) + .map(response -> { + List value = response.value().segment() == null + ? new ArrayList<>(0) + : Stream.concat( + response.value().segment().blobItems().stream(), + response.value().segment().blobPrefixes().stream() + .map(blobPrefix -> new BlobItem().name(blobPrefix.name()).isPrefix(true)) + ).collect(Collectors.toList()); + + return new PagedResponseBase<>( + response.request(), + response.statusCode(), + response.headers(), + value, + response.value().nextMarker(), + response.deserializedHeaders()); + }); + + return new PagedFlux<>( + () -> func.apply(null), + marker -> func.apply(marker)); } /* @@ -664,112 +760,19 @@ public Flux listBlobsHierarchy(String delimiter, ListBlobsOptions opti * [!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) */ - private Mono listBlobsHierarchySegment(String marker, String delimiter, ListBlobsOptions options) { + private Mono listBlobsHierarchySegment(String marker, String delimiter, + ListBlobsOptions options, Duration timeout) { options = options == null ? new ListBlobsOptions() : options; if (options.details().snapshots()) { - throw new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported."); + throw logger.logExceptionAsError(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))); - - 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))); - } - - return result; + return postProcessResponse(Utility.applyOptionalTimeout( + this.azureBlobStorage.containers().listBlobHierarchySegmentWithRestResponseAsync(null, delimiter, + options.prefix(), marker, options.maxResults(), options.details().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). @@ -779,8 +782,8 @@ private Flux listBlobsHierarchyHelper(String delimiter, ListBlobsOptio * 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); } /** @@ -797,17 +800,20 @@ public Mono> acquireLease(String proposedId, int duration) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} 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.deserializedHeaders().leaseId())); } /** @@ -816,8 +822,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); } /** @@ -831,17 +837,20 @@ public Mono> renewLease(String leaseID) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} 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.deserializedHeaders().leaseId())); } /** @@ -850,8 +859,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); } /** @@ -865,16 +874,20 @@ public Mono releaseLease(String leaseID) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} 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); } @@ -884,8 +897,8 @@ public Mono releaseLease(String leaseID, ModifiedAccessConditions * * @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); } /** @@ -904,16 +917,20 @@ public Mono> breakLease() { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} 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)) + null, breakPeriodInSeconds, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, Duration.ofSeconds(rb.deserializedHeaders().leaseTime()))); } @@ -924,8 +941,8 @@ public Mono> breakLease(Integer breakPeriodInSeconds, Modifie * @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); } /** @@ -941,16 +958,20 @@ public Mono> changeLease(String leaseId, String proposedID) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} 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)) + leaseId, proposedID, null, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -960,12 +981,27 @@ public Mono> changeLease(String leaseId, String proposedID, Mod * * @return A reactive response containing the account info. */ - public Mono> getAccountInfo() { + 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 account info. + */ + public Mono> getAccountInfoWithResponse() { + return withContext(context -> getAccountInfoWithResponse(context)); + } + + Mono> getAccountInfoWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, Context.NONE)) + this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, context)) .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); } + private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions) { if (modifiedAccessConditions == null) { return true; @@ -983,7 +1019,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 +1038,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 +1048,13 @@ 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 +1071,18 @@ 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, + 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 +1123,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 +1132,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,9 +1154,9 @@ 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, + 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); @@ -1116,26 +1165,26 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); - ServiceSASSignatureValues values = configureServiceSASSignatureValues(serviceSASSignatureValues, + BlobServiceSASSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues, sharedKeyCredential.accountName()); - 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.canonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId to null - serviceSASSignatureValues.snapshotId(null); + blobServiceSASSignatureValues.snapshotId(null); // Set resource - serviceSASSignatureValues.resource(Constants.UrlConstants.SAS_CONTAINER_CONSTANT); - return serviceSASSignatureValues; + blobServiceSASSignatureValues.resource(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..f3cd0aed735c 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,10 @@ package com.azure.storage.blob; +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 +21,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 +43,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; @@ -52,7 +53,6 @@ public final class ContainerClient { /** * Package-private constructor for use by {@link ContainerClientBuilder}. - * * @param containerAsyncClient the async container client */ ContainerClient(ContainerAsyncClient containerAsyncClient) { @@ -65,8 +65,8 @@ public final class ContainerClient { * pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's NewBlockBlobAsyncClient * method. - * * @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. */ public BlockBlobClient getBlockBlobClient(String blobName) { @@ -79,9 +79,9 @@ public BlockBlobClient getBlockBlobClient(String blobName) { * pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's NewBlockBlobAsyncClient * method. - * * @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. */ public BlockBlobClient getBlockBlobClient(String blobName, String snapshot) { @@ -93,8 +93,8 @@ public BlockBlobClient getBlockBlobClient(String blobName, String snapshot) { * The new PageBlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, * 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. - * * @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. */ public PageBlobClient getPageBlobClient(String blobName) { @@ -106,9 +106,9 @@ public PageBlobClient getPageBlobClient(String blobName) { * The new PageBlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, * 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. - * * @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. */ public PageBlobClient getPageBlobClient(String blobName, String snapshot) { @@ -121,8 +121,8 @@ public PageBlobClient getPageBlobClient(String blobName, String snapshot) { * pipeline, create the AppendBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. - * * @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. */ @@ -136,9 +136,9 @@ public AppendBlobClient getAppendBlobClient(String blobName) { * pipeline, create the AppendBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. - * * @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 * container. */ @@ -151,8 +151,8 @@ public AppendBlobClient getAppendBlobClient(String blobName, String snapshot) { * BlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, create the * 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. - * * @param blobName A {@code String} representing the name of the blob. + * * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobClient(String blobName) { @@ -164,9 +164,9 @@ public BlobClient getBlobClient(String blobName) { * BlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, create the * 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. - * * @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. */ public BlobClient getBlobClient(String blobName, String snapshot) { @@ -175,7 +175,6 @@ public BlobClient getBlobClient(String blobName, String snapshot) { /** * Initializes a {@link BlobServiceClient} object pointing to the storage account this container is in. - * * @return A {@link BlobServiceClient} object pointing to the specified storage account */ public BlobServiceClient getBlobServiceClient() { @@ -184,7 +183,6 @@ public BlobServiceClient getBlobServiceClient() { /** * Gets the URL of the container represented by this client. - * * @return the URL. */ public URL getContainerUrl() { @@ -193,21 +191,21 @@ public URL getContainerUrl() { /** * Gets if the container this client represents exists in the cloud. - * * @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).value(); } /** * Gets if the container this client represents exists in the cloud. - * * @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); } @@ -216,26 +214,25 @@ public Response exists(Duration timeout) { * 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. - * - * @return A response containing status code and HTTP headers */ - public VoidResponse create() { - return this.create(null, null, null); + public void create() { + createWithResponse(null, null, null, Context.NONE); } /** * 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. - * * @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. + * 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); } @@ -244,24 +241,23 @@ public VoidResponse create(Metadata metadata, PublicAccessType accessType, Durat * Marks the specified container for deletion. The container and any blobs contained within it are later deleted * during garbage collection. For more information, see the * Azure Docs. - * - * @return A response containing status code and HTTP headers */ - public VoidResponse delete() { - return this.delete(null, null); + public void delete() { + deleteWithResponse(null, null, Context.NONE); } /** * Marks the specified container for deletion. The container and any blobs contained within it are later deleted * during garbage collection. For more information, see the * Azure Docs. - * * @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); } @@ -269,25 +265,25 @@ public VoidResponse delete(ContainerAccessConditions accessConditions, Duration /** * Returns the container's metadata and system properties. For more information, see the * Azure Docs. - * * @return The container properties. */ - public Response getProperties() { - return this.getProperties(null, null); + public ContainerProperties getProperties() { + return getPropertiesWithResponse(null, null, Context.NONE).value(); } /** * Returns the container's metadata and system properties. For more information, see the * Azure Docs. - * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does - * not match the active lease on the blob. + * 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); } @@ -295,26 +291,26 @@ public Response getProperties(LeaseAccessConditions leaseAc /** * Sets the container's metadata. For more information, see the * 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); } /** * Sets the container's metadata. For more information, see the * Azure Docs. - * * @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); } @@ -323,26 +319,26 @@ public VoidResponse setMetadata(Metadata metadata, * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. * For more information, see the * Azure Docs. - * * @return The container access policy. */ - public Response getAccessPolicy() { - return this.getAccessPolicy(null, null); + public ContainerAccessPolicies getAccessPolicy() { + return getAccessPolicyWithResponse(null, null, Context.NONE).value(); } /** * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. * For more information, see the * Azure Docs. - * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does - * not match the active lease on the blob. + * 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); } @@ -352,18 +348,16 @@ public Response getAccessPolicy(LeaseAccessConditions l * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. - * * @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. + * 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 + * Please see + * here + * for more information. Passing null will clear all access policies. */ - 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); } /** @@ -371,28 +365,29 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. - * * @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. + * 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. + * Please see + * here + * 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. @@ -400,16 +395,15 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, *

    * For more information, see the * Azure Docs. - * * @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. @@ -417,15 +411,13 @@ public Iterable listBlobsFlat() { *

    * For more information, see the * Azure Docs. - * * @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)); } /** @@ -451,11 +443,11 @@ public Iterable listBlobsFlat(ListBlobsOptions options, Duration timeo *

  • foo/foo1 (isPrefix = false) *
  • foo/foo2 (isPrefix = false) * - * * @param directory The directory to list blobs underneath + * * @return A reactive response emitting the prefixes and blobs. */ - public Iterable listBlobsHierarchy(String directory) { + public PagedIterable listBlobsHierarchy(String directory) { return this.listBlobsHierarchy("/", new ListBlobsOptions().prefix(directory), null); } @@ -482,104 +474,119 @@ public Iterable listBlobsHierarchy(String directory) { *
  • foo/foo1 (isPrefix = false) *
  • foo/foo2 (isPrefix = false) * - * * @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). - * * @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. + * 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).value(); } /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). - * * @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. + * non-infinite lease can be between 15 and 60 seconds. * @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. + * 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); } /** * Renews the blob's previously-acquired lease. - * * @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. + * @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. * + * @return The renewed lease ID. + */ + public String renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout) { + return renewLeaseWithResponse(leaseID, modifiedAccessConditions, timeout, Context.NONE).value(); + } + + /** + * Renews the blob's previously-acquired lease. * @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. + * 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 = containerAsyncClient - .renewLease(leaseID, modifiedAccessConditions); + .renewLeaseWithResponse(leaseID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Releases the blob's previously-acquired lease. - * * @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. - * * @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. + * 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); } @@ -587,63 +594,64 @@ 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. - * * @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).value(); } /** * 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. - * * @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 - * will not be available before the break period has expired, but the lease may be held for longer than the break - * period. + * 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 + * will not be available before the break period has expired, but the lease may be held for longer than the break + * period. * @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. + * 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); } /** * ChangeLease changes the blob's lease ID. - * * @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).value(); } /** * ChangeLease changes the blob's lease ID. For more information, see the Azure * Docs. - * * @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. + * 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); } @@ -651,12 +659,24 @@ public Response changeLease(String leaseId, String proposedID, /** * Returns the sku name and account kind for the account. For more information, please see the * Azure Docs. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * + * @return The account info. + */ + public StorageAccountInfo getAccountInfo(Duration timeout) { + return getAccountInfoWithResponse(timeout, Context.NONE).value(); + } + + /** + * Returns the sku name and account kind for the account. For more information, please 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 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); } @@ -668,10 +688,11 @@ public Response getAccountInfo(Duration timeout) { * @param accountName The {@code String} account name for the SAS * @param permissions The {@code ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime) { + ContainerSASPermission permissions, OffsetDateTime expiryTime) { return this.containerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime); } @@ -687,11 +708,12 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @param version An optional {@code String} version for the SAS * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS * @param ipRange An optional {@code IPRange} ip address range for the SAS + * * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - 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 +721,13 @@ 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 @@ -712,12 +741,13 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @param contentEncoding An optional {@code String} content-encoding header for the SAS. * @param contentLanguage An optional {@code String} content-language header for the SAS. * @param contentType An optional {@code String} content-type header for the SAS. + * * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - 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); @@ -728,6 +758,7 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * * @param permissions The {@code ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * * @return A string that represents the SAS token */ public String generateSAS(ContainerSASPermission permissions, OffsetDateTime expiryTime) { @@ -738,6 +769,7 @@ public String generateSAS(ContainerSASPermission permissions, OffsetDateTime exp * Generates a SAS token with the specified parameters * * @param identifier The {@code String} name of the access policy on the container this SAS references if any + * * @return A string that represents the SAS token */ public String generateSAS(String identifier) { @@ -754,10 +786,11 @@ public String generateSAS(String identifier) { * @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, 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 +798,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 @@ -777,11 +817,12 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, * @param contentEncoding An optional {@code String} content-encoding header for the SAS. * @param contentLanguage An optional {@code String} content-language header for the SAS. * @param contentType An optional {@code String} content-type header for the SAS. + * * @return A string that represents the SAS token */ public String generateSAS(String identifier, 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..805a7744d4c7 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,35 +3,14 @@ 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; /** @@ -50,33 +29,18 @@ * 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}. */ - public ContainerClientBuilder() { - retryOptions = new RequestRetryOptions(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } + public ContainerClientBuilder() { } /** * @return a {@link ContainerClient} created from the configurations in this builder. @@ -89,36 +53,12 @@ public ContainerClient buildClient() { * @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(); + 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 ContainerAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s/%s", endpoint, containerName)) @@ -132,6 +72,7 @@ public ContainerAsyncClient buildAsyncClient() { * @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); @@ -140,13 +81,12 @@ public ContainerClientBuilder endpoint(String endpoint) { this.endpoint = parts.scheme() + "://" + parts.host(); this.containerName = parts.containerName(); - this.sasTokenCredential = SASTokenCredential.fromSASTokenString(parts.sasQueryParameters().encode()); - if (this.sasTokenCredential != null) { - this.tokenCredential = null; - this.sharedKeyCredential = null; + SASTokenCredential sasTokenCredential = SASTokenCredential.fromSASTokenString(parts.sasQueryParameters().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; @@ -165,141 +105,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/ContainerSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java index c6031c9edd37..eed6f897034a 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,13 +4,15 @@ 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 + * {@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 { @@ -36,8 +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. 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..4743d8bb2d4c 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,17 +9,17 @@ 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 + * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, 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 @@ -34,13 +34,13 @@ 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, + DownloadAsyncResponse(ResponseBase> response, HTTPGetterInfo info, Function> getter) { Utility.assertNotNull("getter", getter); Utility.assertNotNull("info", info); @@ -56,9 +56,9 @@ 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(); @@ -72,7 +72,7 @@ retries as we have not actually retried yet, only made the initial try. Because return this.applyReliableDownload(this.rawResponse.value(), -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); @@ -96,15 +96,15 @@ 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 + this.info.offset(this.info.offset() + buffer.remaining()); if (this.info.count() != null) { - this.info.count(this.info.count() - buffer.readableBytes()); // was `remaining()` in Rx world + this.info.count(this.info.count() - buffer.remaining()); } }).onErrorResume(t2 -> { // Increment the retry count and try again with the new exception. @@ -136,7 +136,7 @@ public Map rawHeaders() { /** * @return the raw response */ - public ResponseBase> rawResponse() { + public ResponseBase> rawResponse() { 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..5ce568053bed 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; @@ -62,7 +63,7 @@ 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}. + * resource and when retrieving {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context) properties}. * Defaults to null. */ public String eTag() { @@ -71,7 +72,7 @@ public String 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}. + * resource and when retrieving {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context) properties}. * Defaults to null. * * @param eTag Resource's eTag 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..adce2d5c3cdc 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,7 +6,9 @@ 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; @@ -21,14 +23,15 @@ 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.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** * Client to a page blob. It may only be instantiated through a {@link BlobClientBuilder}, via @@ -64,6 +67,8 @@ 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 @@ -77,15 +82,13 @@ public final class PageBlobAsyncClient extends BlobAsyncClient { * 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 + * @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. + * @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 create(long size) { + return createWithResponse(size, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -93,43 +96,42 @@ public Mono> create(long size) { * 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 + * @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 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. */ - public Mono> create(long size, Long sequenceNumber, BlobHTTPHeaders headers, + 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)) + null, 0, size, null, metadata, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), + null, accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } @@ -141,19 +143,16 @@ public Mono> create(long size, Long sequenceNumber, BlobH * 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 + * @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. + * @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); } /** @@ -164,36 +163,37 @@ public Mono> uploadPages(PageRange pageRange, Flux> uploadPages(PageRange pageRange, Flux body, + 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.end() - pageRange.start() + 1, null, null, null, pageRangeStr, null, + pageBlobAccessConditions.leaseAccessConditions(), null, pageBlobAccessConditions.sequenceNumberAccessConditions(), + pageBlobAccessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** @@ -203,24 +203,19 @@ public Mono> uploadPages(PageRange pageRange, FluxAzure Docs. *

    * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @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 + * @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. + * @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. + * @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); } /** @@ -230,35 +225,35 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour * Azure Docs. *

    * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset + * @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 + * @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 + * @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 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, + 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); @@ -272,11 +267,11 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync( - null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, - null, null, destAccessConditions.leaseAccessConditions(), + null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, null, + null, null, null, destAccessConditions.leaseAccessConditions(), destAccessConditions.sequenceNumberAccessConditions(), destAccessConditions.modifiedAccessConditions(), - sourceAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + sourceAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** @@ -284,16 +279,14 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour * 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 + * @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. + * @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); } /** @@ -301,116 +294,115 @@ public Mono> clearPages(PageRange pageRange) { * 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 + * @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 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, + 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.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** * 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 blobRange {@link BlobRange} * - * @return - * A reactive response containing the information of the cleared pages. + * @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. * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} + * @param blobRange {@link BlobRange} + * @param accessConditions {@link BlobAccessConditions} * - * @return - * A reactive response emitting all the page ranges. + * @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, null, snapshot, null, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) - .map(response -> new SimpleResponse<>(response, response.value())); + context)).map(response -> new SimpleResponse<>(response, response.value())); } /** * 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 + * @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. + * @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 + * @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 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, + null, null, snapshot, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + accessConditions.modifiedAccessConditions(), context)) .map(response -> new SimpleResponse<>(response, response.value())); } @@ -418,82 +410,78 @@ public Mono> getPageRangesDiff(BlobRange blobRange, String pr * 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 + * @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. + * @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 + * @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 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()))); + accessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } - /** * 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 + * @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. + * @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 + * @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 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,8 +489,8 @@ 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.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** @@ -513,16 +501,13 @@ public Mono> updateSequenceNumber(SequenceNumberActionTyp * the Azure Docs here and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. * - * @return - * A reactive response emitting the copy status. + * @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); } /** @@ -533,19 +518,20 @@ public Mono> copyIncremental(URL source, String snapsho * 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 + * @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,8 +541,8 @@ 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.deserializedHeaders().copyStatus())); } private static String pageRangeToString(PageRange pageRange) { 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..8f930a8c6418 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 @@ -4,6 +4,8 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; +import com.azure.core.exception.UnexpectedLengthException; +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,15 +18,16 @@ 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 java.util.Objects; 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; /** @@ -68,14 +71,12 @@ 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 + * @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); @@ -85,19 +86,16 @@ public BlobOutputStream getBlobOutputStream(long length) { * 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 + * @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. + * @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); } /** @@ -105,43 +103,36 @@ public BlobOutputStream getBlobOutputStream(long length, BlobAccessConditions ac * 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 + * @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. + * @return The information of the created page blob. */ - public Response create(long size) { - return this.create(size, null, null, null, null, null); + public PageBlobItem create(long size) { + return createWithResponse(size, null, null, null, null, null, Context.NONE).value(); } + /** * 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 + * @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 + * @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 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); } @@ -153,18 +144,15 @@ public Response create(long size, Long sequenceNumber, BlobHTTPHea * 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 + * @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 body The data to upload. * - * @return - * The information of the uploaded pages. + * @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).value(); } /** @@ -175,38 +163,27 @@ public Response uploadPages(PageRange pageRange, InputStream body) * 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 + * @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 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.end() - pageRange.start() + 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); } @@ -217,24 +194,19 @@ public Response uploadPages(PageRange pageRange, InputStream body, * Azure Docs. *

    * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @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 + * @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. + * @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. + * @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).value(); } /** @@ -244,35 +216,28 @@ public Response uploadPagesFromURL(PageRange range, URL sourceURL, * Azure Docs. *

    * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset + * @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 + * @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 + * @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 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, + public Response uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { + 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); } @@ -281,16 +246,14 @@ public Response uploadPagesFromURL(PageRange range, URL sourceURL, * 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 + * @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. + * @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).value(); } /** @@ -298,21 +261,18 @@ public Response clearPages(PageRange pageRange) { * 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 + * @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 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. + * @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); } @@ -321,106 +281,89 @@ public Response clearPages(PageRange pageRange, * 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 blobRange {@link BlobRange} * - * @return - * The information of the cleared pages. + * @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).value(); } /** * 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 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. + * @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 + * @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. + * @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).value(); } /** * 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 + * @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 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. + * @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 + * @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. + * @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).value(); } /** * 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 + * @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 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. + * @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); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -428,40 +371,33 @@ public Response resize(long size, BlobAccessConditions accessCondi * 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 + * @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. + * @return The updated page blob. */ - public Response updateSequenceNumber(SequenceNumberActionType action, + public PageBlobItem updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null); + return updateSequenceNumberWithResponse(action, sequenceNumber, null, null, Context.NONE).value(); } /** * 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 + * @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 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. + * @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); } @@ -473,16 +409,13 @@ public Response updateSequenceNumber(SequenceNumberActionType acti * the Azure Docs here and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. * - * @return - * The copy status. + * @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).value(); } /** @@ -493,23 +426,19 @@ public Response copyIncremental(URL source, String snapshot) { * 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 + * @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 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. + * @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..632ebb90fdaa 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; 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..c4c5e9760228 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); 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..fee111ab000a 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,8 +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. */ @@ -62,7 +61,7 @@ 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) @@ -70,15 +69,14 @@ public static BlobURLParts parse(URL url) { .containerName(containerName) .blobName(blobName) .snapshot(snapshot) - .sasQueryParameters(sasQueryParameters) + .sasQueryParameters(blobServiceSasQueryParameters) .unparsedParameters(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. */ 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..5de2069c6941 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UploadBufferPool.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.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 syncrhonized 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..ad2c5b432efc 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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -126,19 +127,17 @@ 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) { @@ -168,6 +167,18 @@ public Mono createWithRestResponseAsync(String contai if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -187,7 +198,7 @@ public Mono createWithRestResponseAsync(String contai 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -229,19 +241,18 @@ 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) { @@ -255,6 +266,18 @@ public Mono appendBlockWithRestResponseAsync(Str if (appendPositionAccessConditions != null) { appendPosition = appendPositionAccessConditions.appendPosition(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -272,9 +295,10 @@ public Mono appendBlockWithRestResponseAsync(Str ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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,8 +361,20 @@ 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 xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -376,10 +420,12 @@ public Mono appendBlockFromUrlWithRestRes sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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..6f17d64bb019 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. @@ -57,6 +58,29 @@ void setVersion(String version) { this.version = version; } + /** + * 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. + */ + void setPathRenameMode(PathRenameMode pathRenameMode) { + this.pathRenameMode = pathRenameMode; + } + /** * The HTTP pipeline to send requests through. */ @@ -99,6 +123,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 +209,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..2da23bc9dff7 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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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); + + @Patch("{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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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,48 +207,58 @@ 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 String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; + final Boolean rangeGetContentCRC64 = null; final String requestId = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -242,7 +277,7 @@ public Mono downloadWithRestResponseAsync(String containe } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -277,24 +311,33 @@ 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(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -313,7 +356,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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,7 +398,7 @@ 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.leaseId(); @@ -380,7 +421,255 @@ public Mono deleteWithRestResponseAsync(String containerNam } 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); + 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.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + 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(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + 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.cacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.contentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.contentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.contentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.contentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime sourceIfModifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + } + OffsetDateTime sourceIfUnmodifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + } + String sourceIfMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + } + String sourceIfNoneMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + } + 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, 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); } /** @@ -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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -545,23 +834,33 @@ 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(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -580,7 +879,7 @@ public Mono setMetadataWithRestResponseAsync(String co } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -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 encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "snapshot"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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,8 +1233,20 @@ 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 xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -960,7 +1269,7 @@ public Mono createSnapshotWithRestResponseAsync(Str } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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,7 +1320,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, 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(); @@ -1048,7 +1361,7 @@ public Mono startCopyFromURLWithRestResponseAsync 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,7 +1411,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, 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) { @@ -1138,7 +1453,7 @@ public Mono copyFromURLWithRestResponseAsync(String co 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); } /** @@ -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(); } - 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..a577c097cead 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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, 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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -142,19 +145,18 @@ 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) { @@ -184,6 +186,18 @@ public Mono uploadWithRestResponseAsync(String contain if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -203,7 +217,7 @@ public Mono uploadWithRestResponseAsync(String contain 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "block"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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,8 +340,20 @@ 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 xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -336,9 +375,10 @@ public Mono stageBlockFromURLWithRestRespon sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -381,20 +424,21 @@ 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) { @@ -424,6 +468,18 @@ public Mono commitBlockListWithRestResponseAs if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -440,10 +496,12 @@ public Mono commitBlockListWithRestResponseAs if (modifiedAccessConditions != null) { ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); } + 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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(); } - 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..dcbc7f4413df 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}) 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..79b09abd022f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java @@ -0,0 +1,504 @@ +// 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.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); + + @Patch("{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.cacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.contentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.contentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.contentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.contentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + 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.cacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.contentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.contentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.contentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.contentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime sourceIfModifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + } + OffsetDateTime sourceIfUnmodifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + } + String sourceIfMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + } + String sourceIfNoneMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + } + 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.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + 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.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + 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.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + 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..9af03a0c7474 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,12 +81,12 @@ 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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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}) @@ -95,17 +96,17 @@ private interface PageBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadPagesFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("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, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @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}) @@ -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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -167,20 +168,18 @@ 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) { @@ -210,6 +209,18 @@ public Mono createWithRestResponseAsync(String containe if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -229,7 +240,7 @@ public Mono createWithRestResponseAsync(String containe 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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 xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, 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,13 +298,25 @@ 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(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } Long ifSequenceNumberLessThanOrEqualTo = null; if (sequenceNumberAccessConditions != null) { ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); @@ -323,9 +346,10 @@ public Mono uploadPagesWithRestResponseAsync(Strin ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -432,6 +456,9 @@ public Mono uploadPagesFromURLWithRestRespo final String requestId = null; final String comp = "page"; final String pageWrite = "update"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String leaseId = null; final Long ifSequenceNumberLessThanOrEqualTo = null; final Long ifSequenceNumberLessThan = null; @@ -441,11 +468,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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -458,8 +486,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,9 +499,21 @@ 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 xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -521,11 +563,12 @@ public Mono uploadPagesFromURLWithRestRespo sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); } 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, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -540,7 +583,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 +592,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 +601,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,7 +611,7 @@ 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) { @@ -594,7 +635,7 @@ public Mono getPageRangesWithRestResponseAsync(S } 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 +650,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 +660,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 +669,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,7 +680,7 @@ 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) { @@ -665,7 +704,7 @@ public Mono getPageRangesDiffWithRestRespons } 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); } /** 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..95cf89ced15d 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); + + @Get("") + @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/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/AppendBlobAppendBlockFromUrlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java index 8dcea49cd76c..fbd83ff10cb3 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. */ @@ -164,6 +180,32 @@ public AppendBlobAppendBlockFromUrlHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(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. @@ -285,6 +327,30 @@ public AppendBlobAppendBlockFromUrlHeaders blobCommittedBlockCount(Integer blobC 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 encryptionKeySha256() { + 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 encryptionKeySha256(String encryptionKeySha256) { + this.encryptionKeySha256 = encryptionKeySha256; + return this; + } + /** * Get the errorCode property: The errorCode property. * 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..8c29bb0c0d8e 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. @@ -180,6 +195,56 @@ public AppendBlobAppendBlockHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(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 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 AppendBlobAppendBlockHeaders object itself. + */ + public AppendBlobAppendBlockHeaders 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. 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..69595e124b35 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 @@ -174,6 +173,30 @@ public AppendBlobCreateHeaders contentMD5(byte[] 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 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 AppendBlobCreateHeaders object itself. + */ + public AppendBlobCreateHeaders 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. @@ -220,30 +243,6 @@ public AppendBlobCreateHeaders version(String 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. 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..0dc5cbb43392 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,6 +51,30 @@ 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 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 BlobAbortCopyFromURLHeaders object itself. + */ + public BlobAbortCopyFromURLHeaders 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. 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..0d986bc95d22 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. @@ -143,6 +150,30 @@ public BlobAcquireLeaseHeaders leaseId(String 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 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 BlobAcquireLeaseHeaders object itself. + */ + public BlobAcquireLeaseHeaders 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. 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..ba1ba989e108 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. @@ -145,6 +152,30 @@ public BlobBreakLeaseHeaders leaseTime(Integer 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 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 BlobBreakLeaseHeaders object itself. + */ + public BlobBreakLeaseHeaders 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. 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..e8ffbec32efd 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. @@ -123,6 +130,30 @@ 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 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 BlobChangeLeaseHeaders object itself. + */ + public BlobChangeLeaseHeaders 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. 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..17707531d500 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. */ @@ -138,6 +145,30 @@ 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 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 BlobCopyFromURLHeaders object itself. + */ + public BlobCopyFromURLHeaders 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. @@ -184,30 +215,6 @@ public BlobCopyFromURLHeaders version(String 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. @@ -279,6 +286,30 @@ public BlobCopyFromURLHeaders copyStatus(SyncCopyStatusType 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 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 errorCode property: The errorCode property. * 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..626cb4e5de5f 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 @@ -173,6 +172,30 @@ 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 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 BlobCreateSnapshotHeaders object itself. + */ + public BlobCreateSnapshotHeaders 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. @@ -219,30 +242,6 @@ public BlobCreateSnapshotHeaders version(String 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. 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..0e4c48ffc536 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,6 +51,30 @@ 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 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 BlobDeleteHeaders object itself. + */ + public BlobDeleteHeaders 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. 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..db3eb31f648e 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. */ @@ -824,6 +841,30 @@ public BlobDownloadHeaders leaseStatus(LeaseStatusType 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 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 BlobDownloadHeaders object itself. + */ + public BlobDownloadHeaders 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. @@ -1023,6 +1064,36 @@ public BlobDownloadHeaders blobContentMD5(byte[] 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[] contentCrc64() { + 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 contentCrc64(byte[] contentCrc64) { + this.contentCrc64 = ImplUtils.clone(contentCrc64); + return this; + } + /** * Get the errorCode property: The errorCode property. * 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..1ac3c605414e --- /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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 xMsOwner() { + 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 xMsOwner(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 xMsGroup() { + 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 xMsGroup(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 xMsPermissions() { + 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 xMsPermissions(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 xMsAcl() { + 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 xMsAcl(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 requestId() { + 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 requestId(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 version() { + 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 version(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 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 BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders clientRequestId(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..61acd7944cc9 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,6 +66,30 @@ 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 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 BlobGetAccountInfoHeaders object itself. + */ + public BlobGetAccountInfoHeaders 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. 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..b53a00fd5dda 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. @@ -914,6 +921,30 @@ public BlobGetPropertiesHeaders blobSequenceNumber(Long 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 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 BlobGetPropertiesHeaders object itself. + */ + public BlobGetPropertiesHeaders 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. 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..62de1e897127 --- /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.dateTime(); + } + + /** + * 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/BlobHierarchyListSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java index c1885f617481..d9eb4ef87da8 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. 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..5c6c8eb58472 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. */ @@ -117,26 +117,6 @@ public BlobItem snapshot(String 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. * @@ -177,6 +157,26 @@ public BlobItem metadata(Map metadata) { 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 isPrefix property: The isPrefix property. * 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..2bd5a467109f 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; @@ -770,7 +770,8 @@ public BlobProperties remainingRetentionDays(Integer remainingRetentionDays) { /** * 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. */ @@ -780,7 +781,8 @@ public AccessTier 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. 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..d90443f43ec1 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. @@ -117,6 +124,30 @@ 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 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 BlobReleaseLeaseHeaders object itself. + */ + public BlobReleaseLeaseHeaders 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. 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..7c293db887cd --- /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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 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 BlobRenameHeaders object itself. + */ + public BlobRenameHeaders clientRequestId(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 requestId() { + 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 requestId(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 version() { + 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 version(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long contentLength() { + 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 contentLength(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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..f7115f510628 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. @@ -143,6 +150,30 @@ public BlobRenewLeaseHeaders leaseId(String 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 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 BlobRenewLeaseHeaders object itself. + */ + public BlobRenewLeaseHeaders 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. 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..672499292f00 --- /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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 requestId() { + 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 requestId(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 version() { + 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 version(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 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 BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders clientRequestId(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..b926fb245980 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. @@ -146,6 +153,30 @@ public BlobSetHTTPHeadersHeaders blobSequenceNumber(Long 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 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 BlobSetHTTPHeadersHeaders object itself. + */ + public BlobSetHTTPHeadersHeaders 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. 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..8ea439e47fce 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. @@ -133,6 +140,30 @@ 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 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 BlobSetMetadataHeaders object itself. + */ + public BlobSetMetadataHeaders 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. 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..58da7c6edbfb --- /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.dateTime(); + } + + /** + * 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..0ec7d69471c5 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,6 +42,30 @@ 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 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 BlobSetTierHeaders object itself. + */ + public BlobSetTierHeaders 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. 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..be551c15c68f 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. */ @@ -140,6 +147,30 @@ 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 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 BlobStartCopyFromURLHeaders object itself. + */ + public BlobStartCopyFromURLHeaders 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. @@ -186,30 +217,6 @@ public BlobStartCopyFromURLHeaders version(String 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. @@ -287,6 +294,30 @@ public BlobStartCopyFromURLHeaders copyStatus(CopyStatusType 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 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 errorCode property: The errorCode property. * 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..3b11e7dd6632 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,6 +51,30 @@ 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 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 BlobUndeleteHeaders object itself. + */ + public BlobUndeleteHeaders 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. 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..9ed09112e596 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,7 +32,7 @@ public BlobsDownloadResponse(HttpRequest request, int statusCode, HttpHeaders ra * @return the response content stream. */ @Override - public Flux value() { + public Flux value() { return super.value(); } 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..e97f1ca848f5 --- /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 value() { + return super.value(); + } +} 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/BlockBlobCommitBlockListHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java index 6bec949d7180..80cc2bf9b8cc 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 @@ -151,9 +158,10 @@ 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. */ @@ -162,9 +170,10 @@ public byte[] 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. @@ -174,6 +183,56 @@ public BlockBlobCommitBlockListHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(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 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 BlockBlobCommitBlockListHeaders object itself. + */ + public BlockBlobCommitBlockListHeaders 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. @@ -220,30 +279,6 @@ public BlockBlobCommitBlockListHeaders version(String 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. 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..102d7229c0f1 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. @@ -172,6 +179,30 @@ public BlockBlobGetBlockListHeaders blobContentLength(Long 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 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 BlockBlobGetBlockListHeaders object itself. + */ + public BlockBlobGetBlockListHeaders 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. 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..52b9584e0e18 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,9 +85,10 @@ 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. */ @@ -81,9 +97,10 @@ public byte[] 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. @@ -93,6 +110,56 @@ public BlockBlobStageBlockFromURLHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(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 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 BlockBlobStageBlockFromURLHeaders object itself. + */ + public BlockBlobStageBlockFromURLHeaders 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. 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..479bfa430565 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,9 +85,10 @@ 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. */ @@ -81,9 +97,10 @@ public byte[] 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. @@ -93,6 +110,30 @@ public BlockBlobStageBlockHeaders contentMD5(byte[] 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 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 BlockBlobStageBlockHeaders object itself. + */ + public BlockBlobStageBlockHeaders 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. @@ -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[] xMsContentCrc64() { + 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 xMsContentCrc64(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 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..2a4f06825cfa 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 @@ -174,6 +173,30 @@ public BlockBlobUploadHeaders contentMD5(byte[] 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 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 BlockBlobUploadHeaders object itself. + */ + public BlockBlobUploadHeaders 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. @@ -220,30 +243,6 @@ public BlockBlobUploadHeaders version(String 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. 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..15f4938ad8ee 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. @@ -143,6 +150,30 @@ public ContainerAcquireLeaseHeaders leaseId(String 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 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 ContainerAcquireLeaseHeaders object itself. + */ + public ContainerAcquireLeaseHeaders 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. 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..bea7906493fb 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. @@ -145,6 +152,30 @@ public ContainerBreakLeaseHeaders leaseTime(Integer 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 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 ContainerBreakLeaseHeaders object itself. + */ + public ContainerBreakLeaseHeaders 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. 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..dd16b934a42a 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. @@ -143,6 +150,30 @@ public ContainerChangeLeaseHeaders leaseId(String 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 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 ContainerChangeLeaseHeaders object itself. + */ + public ContainerChangeLeaseHeaders 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. 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..c52bf1b9a1e5 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. @@ -117,6 +124,30 @@ 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 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 ContainerCreateHeaders object itself. + */ + public ContainerCreateHeaders 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. 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..4308de71d186 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,6 +51,30 @@ 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 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 ContainerDeleteHeaders object itself. + */ + public ContainerDeleteHeaders 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. 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..779ffb797e73 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. @@ -148,6 +155,30 @@ 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 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 ContainerGetAccessPolicyHeaders object itself. + */ + public ContainerGetAccessPolicyHeaders 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. 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..368acb2e4cc4 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,6 +66,30 @@ 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 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 ContainerGetAccountInfoHeaders object itself. + */ + public ContainerGetAccountInfoHeaders 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. 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..28209621cc29 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. @@ -253,6 +260,30 @@ public ContainerGetPropertiesHeaders leaseStatus(LeaseStatusType 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 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 ContainerGetPropertiesHeaders object itself. + */ + public ContainerGetPropertiesHeaders 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. 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..a17ee04d84c1 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. @@ -73,6 +80,30 @@ public ContainerListBlobFlatSegmentHeaders contentType(String 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 ContainerListBlobFlatSegmentHeaders object itself. + */ + public ContainerListBlobFlatSegmentHeaders 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. 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..44bf89808b3a 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. @@ -73,6 +80,30 @@ public ContainerListBlobHierarchySegmentHeaders contentType(String 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 ContainerListBlobHierarchySegmentHeaders object itself. + */ + public ContainerListBlobHierarchySegmentHeaders 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. 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..0a33b2b26cbc 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. @@ -117,6 +124,30 @@ 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 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 ContainerReleaseLeaseHeaders object itself. + */ + public ContainerReleaseLeaseHeaders 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. 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..5fbbfb2a286b 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. @@ -143,6 +150,30 @@ public ContainerRenewLeaseHeaders leaseId(String 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 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 ContainerRenewLeaseHeaders object itself. + */ + public ContainerRenewLeaseHeaders 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. 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..a38fbf929c42 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. @@ -117,6 +124,30 @@ 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 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 ContainerSetAccessPolicyHeaders object itself. + */ + public ContainerSetAccessPolicyHeaders 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. 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..ee483bfdde40 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. @@ -117,6 +124,30 @@ 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 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 ContainerSetMetadataHeaders object itself. + */ + public ContainerSetMetadataHeaders 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. 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..676d20cc6ca7 --- /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 = "xMsEncryptionKey") + private String xMsEncryptionKey; + + /* + * The SHA-256 hash of the provided encryption key. Must be provided if the + * x-ms-encryption-key header is provided. + */ + @JsonProperty(value = "xMsEncryptionKeySha256") + private String xMsEncryptionKeySha256; + + /* + * 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 = "xMsEncryptionAlgorithm") + private EncryptionAlgorithmType xMsEncryptionAlgorithm; + + /** + * Get the xMsEncryptionKey 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 xMsEncryptionKey value. + */ + public String xMsEncryptionKey() { + return this.xMsEncryptionKey; + } + + /** + * Set the xMsEncryptionKey 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 xMsEncryptionKey the xMsEncryptionKey value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo xMsEncryptionKey(String xMsEncryptionKey) { + this.xMsEncryptionKey = xMsEncryptionKey; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The SHA-256 hash of the + * provided encryption key. Must be provided if the x-ms-encryption-key + * header is provided. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String xMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The SHA-256 hash of the + * provided encryption key. Must be provided if the x-ms-encryption-key + * header is provided. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo xMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsEncryptionAlgorithm 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 xMsEncryptionAlgorithm value. + */ + public EncryptionAlgorithmType xMsEncryptionAlgorithm() { + return this.xMsEncryptionAlgorithm; + } + + /** + * Set the xMsEncryptionAlgorithm 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 xMsEncryptionAlgorithm the xMsEncryptionAlgorithm value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo xMsEncryptionAlgorithm(EncryptionAlgorithmType xMsEncryptionAlgorithm) { + this.xMsEncryptionAlgorithm = xMsEncryptionAlgorithm; + return this; + } +} 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..d481a91fead8 --- /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 error() { + 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 error(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..8f6d191f3e37 --- /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 code() { + 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 code(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The service error message. + * + * @return the message value. + */ + public String message() { + 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 message(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..da3d592a3e0d --- /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 value() { + return (DataLakeStorageError) super.value(); + } +} 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..fc9f5eeaf9d2 --- /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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 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 DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders clientRequestId(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 requestId() { + 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 requestId(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 version() { + 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 version(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long contentLength() { + 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 contentLength(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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..921df9072945 --- /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 marker() { + 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 marker(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 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 DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders clientRequestId(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 requestId() { + 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 requestId(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 version() { + 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 version(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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..140df9c04696 --- /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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 xMsOwner() { + 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 xMsOwner(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 xMsGroup() { + 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 xMsGroup(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 xMsPermissions() { + 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 xMsPermissions(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 xMsAcl() { + 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 xMsAcl(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 requestId() { + 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 requestId(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 version() { + 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 version(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 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 DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders clientRequestId(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..ae0dd3997576 --- /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 cacheControl() { + 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 cacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the contentType property: Content type for given resource. + * + * @return the contentType value. + */ + public String contentType() { + 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 contentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the contentEncoding property: Content encoding for given resource. + * + * @return the contentEncoding value. + */ + public String contentEncoding() { + 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 contentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the contentLanguage property: Content language for given resource. + * + * @return the contentLanguage value. + */ + public String contentLanguage() { + 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 contentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the contentDisposition property: Content disposition for given + * resource. + * + * @return the contentDisposition value. + */ + public String contentDisposition() { + 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 contentDisposition(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..365780542a9c --- /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 marker() { + 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 marker(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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 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 DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders clientRequestId(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 requestId() { + 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 requestId(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 version() { + 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 version(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long contentLength() { + 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 contentLength(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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..0441781e4bba --- /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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 dateProperty(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 eTag() { + 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 eTag(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 lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * 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 lastModified(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 requestId() { + 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 requestId(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 version() { + 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 version(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 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 DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders clientRequestId(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..df691b96b781 --- /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 segment() { + 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 nextMarker() { + 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..c4daa8b128f6 --- /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 blobItems() { + 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/PageBlobClearPagesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java index 543c829bf271..c5c125eda749 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. @@ -156,6 +171,32 @@ public PageBlobClearPagesHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. @@ -178,6 +219,30 @@ public PageBlobClearPagesHeaders blobSequenceNumber(Long 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 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 PageBlobClearPagesHeaders object itself. + */ + public PageBlobClearPagesHeaders 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. 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..2447b0c346b0 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. @@ -132,6 +139,30 @@ 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 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 PageBlobCopyIncrementalHeaders object itself. + */ + public PageBlobCopyIncrementalHeaders 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. 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..e328ff04f5d8 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 @@ -174,6 +173,30 @@ public PageBlobCreateHeaders contentMD5(byte[] 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 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 PageBlobCreateHeaders object itself. + */ + public PageBlobCreateHeaders 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. @@ -220,30 +243,6 @@ public PageBlobCreateHeaders version(String 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. 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..da04c9aff1b9 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. @@ -143,6 +150,30 @@ public PageBlobGetPageRangesDiffHeaders blobContentLength(Long 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 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 PageBlobGetPageRangesDiffHeaders object itself. + */ + public PageBlobGetPageRangesDiffHeaders 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. 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..90a9a9add17d 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. @@ -143,6 +150,30 @@ public PageBlobGetPageRangesHeaders blobContentLength(Long 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 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 PageBlobGetPageRangesHeaders object itself. + */ + public PageBlobGetPageRangesHeaders 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. 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..43470469598d 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. @@ -146,6 +153,30 @@ public PageBlobResizeHeaders blobSequenceNumber(Long 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 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 PageBlobResizeHeaders object itself. + */ + public PageBlobResizeHeaders 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. 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..52a2b49532c9 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. @@ -146,6 +153,30 @@ public PageBlobUpdateSequenceNumberHeaders blobSequenceNumber(Long blobSequenceN 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 PageBlobUpdateSequenceNumberHeaders object itself. + */ + public PageBlobUpdateSequenceNumberHeaders 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. 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..d80a0eb276cd 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. */ @@ -164,6 +172,32 @@ public PageBlobUploadPagesFromURLHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. 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..ba8fd9bb8a86 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. @@ -172,6 +187,32 @@ public PageBlobUploadPagesHeaders contentMD5(byte[] 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[] xMsContentCrc64() { + 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 xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. @@ -194,6 +235,30 @@ public PageBlobUploadPagesHeaders blobSequenceNumber(Long 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 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 PageBlobUploadPagesHeaders object itself. + */ + public PageBlobUploadPagesHeaders 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. 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/ServiceFilterBlobsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java new file mode 100644 index 000000000000..ca07c5d37ffb --- /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.dateTime(); + } + + /** + * 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..aab5284aa123 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,6 +66,30 @@ 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 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 ServiceGetAccountInfoHeaders object itself. + */ + public ServiceGetAccountInfoHeaders 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. 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..4fec9f3c872d 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,6 +42,30 @@ 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 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 ServiceGetPropertiesHeaders object itself. + */ + public ServiceGetPropertiesHeaders 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. 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..a10d852f62cd 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,6 +51,30 @@ 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 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 ServiceGetStatisticsHeaders object itself. + */ + public ServiceGetStatisticsHeaders 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. 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..f10866c90c55 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,6 +51,30 @@ 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 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 ServiceGetUserDelegationKeyHeaders object itself. + */ + public ServiceGetUserDelegationKeyHeaders 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. 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..93e1c98ec97a 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,6 +42,30 @@ 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 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 ServiceListContainersSegmentHeaders object itself. + */ + public ServiceListContainersSegmentHeaders 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. 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..b7ea86bc9fdb 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,6 +42,30 @@ 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 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 ServiceSetPropertiesHeaders object itself. + */ + public ServiceSetPropertiesHeaders 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. 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..3272610cb688 --- /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_' + */ + @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 contentType() { + 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 contentType(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 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 ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders 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 ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders version(String version) { + this.version = version; + 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 ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders errorCode(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..1ab8de38f430 --- /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 value() { + return super.value(); + } +} 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..0174e9e0a467 --- /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 value() { + return super.value(); + } + + /** + * Disposes of the connection associated with this stream response. + */ + @Override + public void close() { + value().subscribe(bb -> { }, t -> { }).dispose(); + } +} 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..34b97f155d7d 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,38 +14,12 @@ @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. * 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..bb98e3e0bcde --- /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.response(), e); + this.errorCode = StorageErrorCode.fromString(e.response().headers().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode errorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String serviceMessage() { + 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/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/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..032fb01a62b6 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().defaultServiceVersion()); } } 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..b8292104ffa5 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().blobSize(); + 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."); } 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..5e029bb7d590 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java @@ -12,6 +12,10 @@ import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.ModifiedAccessConditions; 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 +40,47 @@ 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,7 +94,7 @@ 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 -> { try { @@ -141,7 +111,7 @@ public void download() { * 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 +126,455 @@ 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.blobType(), response.blobSize())); // 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())); + .blobContentType("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 + } + + /** + * Code snippets for {@link BlobAsyncClient#renewLease(String)} + */ + 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)); + // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String + } + + /** + * Code snippets for {@link BlobAsyncClient#releaseLease(String)} + */ + public void releaseLeaseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String + client.releaseLease(leaseId).doOnSuccess(response -> System.out.println("Completed release lease")); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String + } + + /** + * Code snippets for {@link BlobAsyncClient#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)); + // 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.accountKind(), response.skuName())); + // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + } - // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + /** + * 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.value())); + // END: com.azure.storage.blob.BlobAsyncClient.existsWithResponse + } + + /** + * Code snippets for {@link BlobAsyncClient#startCopyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void startCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#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.startCopyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-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().leaseId(leaseId); + client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions) + .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#copyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void copyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#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.copyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-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); + + client.downloadWithResponse(range, options, null, false).subscribe(response -> { + ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); + response.value().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.statusCode())); + // 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() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.getPropertiesWithResponse(accessConditions).subscribe( + response -> System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), + response.value().blobSize())); + // 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() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.setHTTPHeadersWithResponse(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.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() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.setMetadataWithResponse(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.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().leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.createSnapshotWithResponse(snapshotMetadata, accessConditions) + .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setTierWithResponse(AccessTier, LeaseAccessConditions)} + */ + public void setTierWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); + + client.setTierWithResponse(AccessTier.HOT, accessConditions) + .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", + response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-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.statusCode())); + // 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() .ifModifiedSince(OffsetDateTime.now().minusDays(3)); - client.acquireLease("proposedId", 60, modifiedAccessConditions) + client.acquireLeaseWithResponse("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 + // END: com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#renewLease(String)} and - * {@link BlobAsyncClient#renewLease(String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#renewLeaseWithResponse(String, ModifiedAccessConditions)} */ - public void renewLease() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String - client.renewLease(leaseId) - .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String + public void renewLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.renewLease(leaseId, modifiedAccessConditions) + client.renewLeaseWithResponse(leaseId, modifiedAccessConditions) .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#releaseLease(String)} and - * {@link BlobAsyncClient#releaseLease(String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#releaseLeaseWithResponse(String, ModifiedAccessConditions)} */ - public void releaseLease() { - // 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())); - // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions + public void releaseLeaseWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#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 + client.releaseLeaseWithResponse(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Release lease completed with status %d%n", + response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#breakLease()} and - * {@link BlobAsyncClient#breakLease(Integer, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions)} */ - public void breakLease() { - // 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())); - // END: com.azure.storage.blob.BlobAsyncClient.breakLease + public void breakLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions Integer retainLeaseInSeconds = 5; ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(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.value())); + // 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)); - client.changeLease(leaseId, "proposedId", modifiedAccessConditions) + client.changeLeaseWithResponse(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 + // 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", + public void getAccountInfoWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse + client.getAccountInfoWithResponse().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", response.value().accountKind(), response.value().skuName())); - // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + // 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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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/BlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java index 90a64765f384..7b11289ea3a3 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; @@ -13,9 +14,14 @@ import com.azure.storage.blob.models.ModifiedAccessConditions; 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 +38,61 @@ 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 +100,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() { // 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,226 +124,444 @@ public void delete() { */ public void getProperties() { // BEGIN: com.azure.storage.blob.BlobClient.getProperties - BlobProperties properties = client.getProperties().value(); + BlobProperties properties = client.getProperties(); System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); // END: com.azure.storage.blob.BlobClient.getProperties } /** - * Code snippet for {@link BlobClient#getProperties(BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} + */ + public void setHTTPHeaders() { + // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary")); + System.out.println("Set HTTP headers completed"); + // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + } + + /** + * Code snippets for {@link BlobClient#setMetadata(Metadata)} + */ + public void setMetadata() { + // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))); + System.out.println("Set metadata completed"); + // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata + } + + /** + * 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().getSnapshotId()); + // END: com.azure.storage.blob.BlobClient.createSnapshot + } + + /** + * Code snippets for {@link BlobClient#setTier(AccessTier)} and + * {@link BlobClient#setTierWithResponse(AccessTier, 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.setTierWithResponse(AccessTier.HOT, null, null, null).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTier#AccessTier + + + } + + /** + * Code snippets for {@link BlobClient#undelete()} + */ + public void undelete() { + // BEGIN: com.azure.storage.blob.BlobClient.undelete + client.undelete(); + System.out.printf("Undelete completed"); + // END: com.azure.storage.blob.BlobClient.undelete + } + + /** + * 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)); + // END: com.azure.storage.blob.BlobClient.acquireLease#String-int + } + + /** + * 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)); + // END: com.azure.storage.blob.BlobClient.renewLease#String + } + + /** + * Code snippets for {@link BlobClient#releaseLease(String)} + */ + public void releaseLease() { + // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String + client.releaseLease(leaseId); + System.out.printf("Release lease completed"); + // END: com.azure.storage.blob.BlobClient.releaseLease#String + + + } + + /** + * Code snippets for {@link BlobClient#breakLease()} */ - public void getPropertiesWithTimeout() { - // BEGIN: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + 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()); + // END: com.azure.storage.blob.BlobClient.breakLease + + + } + + /** + * 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")); + // END: com.azure.storage.blob.BlobClient.changeLease#String-String + + } + + /** + * Code snippet for {@link BlobClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo + StorageAccountInfo accountInfo = client.getAccountInfo(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); + // END: com.azure.storage.blob.BlobClient.getAccountInfo + } + + /** + * 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)).value()); + // END: com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context + } + + /** + * Code snippets for {@link BlobClient#startCopyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} + */ + public void startCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + 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.startCopyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout, + new Context(key2, value2))); + // END: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-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().leaseId(leaseId); + System.out.printf("Aborted copy completed with status %d%n", + client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, timeout, + new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#copyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} + */ + public void copyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + 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.copyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-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)).statusCode()); + // 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)).statusCode()); + // 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() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - BlobProperties properties = client.getProperties(accessConditions, timeout).value(); + BlobProperties properties = client.getPropertiesWithResponse(accessConditions, timeout, + new Context(key2, value2)).value(); System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); - // END: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + // END: com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} and - * {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions, Duration, Context)} */ - 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()); - // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders - - // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + public void setHTTPHeadersWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context BlobAccessConditions accessConditions = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeaders(new BlobHTTPHeaders() + client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() .blobContentLanguage("en-US") - .blobContentType("binary"), accessConditions, timeout) + .blobContentType("binary"), accessConditions, timeout, new Context(key1, value1)) .statusCode()); - // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + // END: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#setMetadata(Metadata)} and - * {@link BlobClient#setMetadata(Metadata, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setMetadataWithResponse(Metadata, BlobAccessConditions, Duration, Context)} */ - 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()); - // 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)); + public void setMetadataWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context + 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 + client.setMetadataWithResponse( + new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout, + new Context(key1, value1)).statusCode()); + // END: com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#createSnapshot()} and - * {@link BlobClient#createSnapshot(Metadata, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#createSnapshotWithResponse(Metadata, BlobAccessConditions, Duration, Context)} */ - public void createSnapshot() { - // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot - System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().value().getSnapshotId()); - // END: com.azure.storage.blob.BlobClient.createSnapshot + public void createSnapshotWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + 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 + client.createSnapshotWithResponse(snapshotMetadata, accessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#setTier(AccessTier)} and - * {@link BlobClient#setTier(AccessTier, LeaseAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setTierWithResponse(AccessTier, 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()); - // END: com.azure.storage.blob.BlobClient.setTier#AccessTier - - // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration + public void setTierWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-LeaseAccessConditions-Duration-Context 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 + client.setTierWithResponse(AccessTier.HOT, accessConditions, timeout, new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-LeaseAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#undelete()} and {@link BlobClient#undelete(Duration)} + * Code snippet for {@link BlobClient#undeleteWithResponse(Duration, Context)} */ - public void undelete() { - // BEGIN: com.azure.storage.blob.BlobClient.undelete - System.out.printf("Undelete completed with status %d%n", client.undelete().statusCode()); - // 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 + 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)).statusCode()); + // END: com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context } /** - * Code snippets for {@link BlobClient#acquireLease(String, int)} and - * {@link BlobClient#acquireLease(String, int, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions, Duration, Context)} */ - 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()); - // END: com.azure.storage.blob.BlobClient.acquireLease#String-int + public void acquireLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context 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 + client.acquireLeaseWithResponse("proposedId", 60, modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#renewLease(String)} and - * {@link BlobClient#renewLease(String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#renewLeaseWithResponse(String, ModifiedAccessConditions, Duration, Context)} */ - public void renewLease() { - // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String - System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId).value()); - // END: com.azure.storage.blob.BlobClient.renewLease#String + public void renewLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context 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 + client.renewLeaseWithResponse(leaseId, modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#releaseLease(String)} and - * {@link BlobClient#releaseLease(String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#releaseLeaseWithResponse(String, ModifiedAccessConditions, Duration, Context)} */ - 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()); - // END: com.azure.storage.blob.BlobClient.releaseLease#String - - // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration + public void releaseLeaseWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context 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 + client.releaseLeaseWithResponse(leaseId, modifiedAccessConditions, timeout, + new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#breakLease()} and - * {@link BlobClient#breakLease(Integer, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions, Duration, Context)} */ - 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()); - // END: com.azure.storage.blob.BlobClient.breakLease + public void breakLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context 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 + client.breakLeaseWithResponse(retainLeaseInSeconds, modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#changeLease(String, String)} and - * {@link BlobClient#changeLease(String, String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions, Duration, Context)} */ - 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()); - // END: com.azure.storage.blob.BlobClient.changeLease#String-String + public void changeLeaseWithResponseCodeSnippets() { + - // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context 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 + client.changeLeaseWithResponse(leaseId, "proposedId", modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context } /** - * Code snippet for {@link BlobClient#getAccountInfo()} + * Code snippet for {@link BlobClient#getAccountInfoWithResponse(Duration, Context)} */ - public void getAccountInfo() { - // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo - StorageAccountInfo accountInfo = client.getAccountInfo().value(); + public void getAccountInfoWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context + StorageAccountInfo accountInfo = client.getAccountInfoWithResponse(timeout, new Context(key1, value1)).value(); System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); - // END: com.azure.storage.blob.BlobClient.getAccountInfo + // END: com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context } /** - * Code snippet for {@link BlobClient#getAccountInfo(Duration)} + * Code snippet for {@link BlobClient#generateUserDelegationSAS(UserDelegationKey, 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 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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String cacheControl = "cache"; + String contentDisposition = "disposition"; + String contentEncoding = "encoding"; + String contentLanguage = "language"; + String contentType = "type"; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + UserDelegationKey userDelegationKey = new UserDelegationKey(); + String accountName = "accountName"; + + String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, + startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, + contentLanguage, contentType); + // END: com.azure.storage.blob.BlobClient.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** + * Code snippet for {@link BlobClient#generateSAS(String, BlobSASPermission, OffsetDateTime, OffsetDateTime, String, + * SASProtocol, IPRange, String, String, String, String, String)} + */ + public void generateSASCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + BlobSASPermission permissions = new BlobSASPermission() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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..13ddb70ba97a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.common.AccountSASPermission; +import com.azure.storage.common.AccountSASResourceType; +import com.azure.storage.common.AccountSASService; +import com.azure.storage.common.Constants; +import com.azure.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; + +import java.time.OffsetDateTime; + +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() + .blob(true) + .file(true) + .queue(true) + .table(true); + AccountSASResourceType resourceType = new AccountSASResourceType() + .container(true) + .object(true) + .service(true); + AccountSASPermission permission = new AccountSASPermission() + .read(true) + .add(true) + .create(true) + .write(true) + .delete(true) + .list(true) + .processMessages(true) + .update(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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 + } + +} 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..f381c5fd5e98 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.common.AccountSASPermission; +import com.azure.storage.common.AccountSASResourceType; +import com.azure.storage.common.AccountSASService; +import com.azure.storage.common.Constants; +import com.azure.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; + +import java.time.OffsetDateTime; + +public class BlobServiceClientJavaDocCodeSnippets { + + private BlobServiceClient client = JavaDocCodeSnippetsHelpers.getBlobServiceClient(); + + /** + * 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() + .blob(true) + .file(true) + .queue(true) + .table(true); + AccountSASResourceType resourceType = new AccountSASResourceType() + .container(true) + .object(true) + .service(true); + AccountSASPermission permission = new AccountSASPermission() + .read(true) + .add(true) + .create(true) + .write(true) + .delete(true) + .list(true) + .processMessages(true) + .update(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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 + } + +} 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..81141529bc5d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,84 @@ +// 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 java.time.OffsetDateTime; + +public class ContainerAsyncClientJavaDocCodeSnippets { + + private ContainerAsyncClient client = JavaDocCodeSnippetsHelpers.getContainerAsyncClient(); + + /** + * 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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true) + .list(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true) + .list(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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 + } +} 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..c1ad31db583c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientJavaDocCodeSnippets.java @@ -0,0 +1,84 @@ +// 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 java.time.OffsetDateTime; + +public class ContainerClientJavaDocCodeSnippets { + + private ContainerClient client = JavaDocCodeSnippetsHelpers.getContainerClient(); + + /** + * 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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true) + .list(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true) + .list(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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 + } +} 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/SetMetadataAndHTTPHeadersExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java index 591e78141f70..46629d4a717c 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. @@ -75,8 +78,8 @@ public static void main(String[] args) throws IOException { * 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); /* * 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..d462c47034a1 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 @@ -39,7 +40,7 @@ public static void main(String[] args) { /* * Log more detailed information. */ - System.out.println("Extended details: " + e.getMessage()); + System.out.println("Extended details: " + e.serviceMessage()); /* * Examine the raw response. @@ -51,7 +52,7 @@ public static void main(String[] args) { /* * Log more detailed information. */ - System.out.println("Extended details: " + e.getMessage()); + System.out.println("Extended details: " + e.serviceMessage()); } else if (e.errorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS) { 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..975caf1a4fe0 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.ListContainersOptions import com.azure.storage.blob.models.Metadata import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.models.StorageServiceProperties 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,350 @@ 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().prefix(containerPrefix + testName) + for (ContainerItem container : primaryBlobServiceClient.listContainers(options, Duration.ofSeconds(120))) { + ContainerClient containerClient = primaryBlobServiceClient.getContainerClient(container.name()) + + if (container.properties().leaseState() == 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 ex) { + return TestMode.PLAYBACK + } + } + + return TestMode.PLAYBACK + } + + static boolean liveMode() { + return setupTestMode() == TestMode.RECORD } - static int updateIterationNo(ISpecificationContext specificationContext, int iterationNo) { - if (specificationContext.currentIteration.estimatedNumIterations > 1) { - return iterationNo + 1 + 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 ex) { + 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.accountName())) + .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.accountName()), 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() + } + + BlobServiceClient getServiceClient(SASTokenCredential credential, String endpoint) { + return getServiceClientBuilder(null, endpoint, null).credential(credential).buildClient() } - static BlobServiceClient getGenericServiceURL(SharedKeyCredential creds) { - // TODO: logging? + BlobServiceAsyncClient getServiceAsyncClient(SharedKeyCredential credential) { + return getServiceClientBuilder(credential, String.format(defaultEndpointTemplate, credential.accountName())) + .buildAsyncClient() + } - return new BlobServiceClientBuilder() - .endpoint("https://" + creds.accountName() + ".blob.core.windows.net") + 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) + } + + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } + + 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 + 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() } - /* - 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)) + 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() } - /* - 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 + BlobClient getBlobClient(SASTokenCredential credential, String endpoint, String blobName) { + return getBlobClient(credential, endpoint, blobName, null) } - static long getRandomSeed() { - return System.currentTimeMillis() + 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() } - 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(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.setWiretap(true) + + if (Boolean.parseBoolean(ConfigurationManager.getConfiguration().get("AZURE_TEST_DEBUGGING"))) { + builder.setProxy(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 +453,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.getPropertiesWithResponse(null, null, null).headers().value("ETag") + } else { + return match + } + } + + def setupBlobMatchCondition(BlobAsyncClient bac, String match) { if (match == receivedEtag) { - return bu.getProperties().headers().value("ETag") + return bac.getPropertiesWithResponse(null, null).block().headers().value("ETag") } else { return match } @@ -336,7 +475,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 +483,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 = 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 = bu.acquireLease(null, -1, null, null).value() + responseLeaseId = bac.acquireLease(null, -1).block() } if (leaseID == receivedLeaseID) { return responseLeaseId @@ -358,7 +509,7 @@ class APISpec extends Specification { def setupContainerMatchCondition(ContainerClient cu, String match) { if (match == receivedEtag) { - return cu.getProperties().headers().value("ETag") + return cu.getPropertiesWithResponse(null, null, null).headers().value("ETag") } else { return match } @@ -366,7 +517,7 @@ class APISpec extends Specification { def setupContainerLeaseCondition(ContainerClient cu, String leaseID) { if (leaseID == receivedLeaseID) { - return cu.acquireLease(null, -1).value() + return cu.acquireLeaseWithResponse(null, -1, null, null, null).value() } else { return leaseID } @@ -380,15 +531,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 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("") + } + }.request(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).headers().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,7 +607,7 @@ class APISpec extends Specification { } def validateBlobProperties(Response response, String cacheControl, String contentDisposition, String contentEncoding, - String contentLanguage, byte[] contentMD5, String contentType) { + String contentLanguage, byte[] contentMD5, String contentType) { return response.value().cacheControl() == cacheControl && response.value().contentDisposition() == contentDisposition && response.value().contentEncoding() == contentEncoding && @@ -420,7 +616,7 @@ class APISpec extends Specification { response.headers().value("Content-Type") == contentType } - static Metadata getMetadataFromHeaders(HttpHeaders headers) { + Metadata getMetadataFromHeaders(HttpHeaders headers) { Metadata metadata = new Metadata() for (Map.Entry header : headers.toMap()) { @@ -434,75 +630,38 @@ class APISpec extends Specification { } def enableSoftDelete() { - primaryServiceURL.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new StorageServiceProperties() .deleteRetentionPolicy(new RetentionPolicy().enabled(true).days(2))) - sleep(30000) // Wait for the policy to take effect. + + sleepIfRecord(30000) } def disableSoftDelete() { - primaryServiceURL.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new StorageServiceProperties() .deleteRetentionPolicy(new RetentionPolicy().enabled(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.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(response, 206, Flux.error(new IOException()))) + } } - }.request(request) + } } /* @@ -510,12 +669,12 @@ 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) { + MockDownloadHttpResponse(HttpResponse response, int statusCode, Flux body) { this.request(response.request()) this.statusCode = statusCode this.headers = response.headers() @@ -538,7 +697,7 @@ class APISpec extends Specification { } @Override - Flux body() { + Flux body() { return body } @@ -557,33 +716,4 @@ class APISpec extends Specification { 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..92cba6b54e96 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,22 +4,34 @@ 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 @@ -30,12 +42,12 @@ class AppendBlobAPITest extends APISpec { def "Create min"() { expect: - bu.create().statusCode() == 201 + bc.createWithResponse(null, null, null, null, null).statusCode() == 201 } def "Create error"() { when: - bu.create(null, null, + bc.create(null, null, new BlobAccessConditions().modifiedAccessConditions(new ModifiedAccessConditions().ifMatch("garbage")), null) @@ -47,15 +59,15 @@ class AppendBlobAPITest extends APISpec { def "Create headers"() { setup: BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) + .blobContentDisposition(contentDisposition) + .blobContentEncoding(contentEncoding) + .blobContentLanguage(contentLanguage) + .blobContentMD5(contentMD5) + .blobContentType(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.metadata() == metadata where: key1 | value1 | key2 | value2 @@ -96,8 +108,8 @@ 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) @@ -106,9 +118,8 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) - expect: - bu.create(null, null, bac, null).statusCode() == 201 + bc.createWithResponse(null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -123,8 +134,8 @@ 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) @@ -133,7 +144,7 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(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.headers().value("x-ms-content-crc64") != null appendResponse.value().blobAppendOffset() != null appendResponse.value().blobCommittedBlockCount() != null - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-committed-block-count")) == 1 + + expect: + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-blob-committed-block-count")) == 1 } def "Append block min"() { - expect: - bu.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() == 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,8 +215,8 @@ 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() @@ -218,9 +229,8 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) - expect: - bu.appendBlock(defaultInputStream.get(), defaultDataSize, bac, null).statusCode() == 201 + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE @@ -237,8 +247,8 @@ 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)) @@ -252,11 +262,14 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(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,17 +295,17 @@ 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 @@ -300,15 +314,15 @@ class AppendBlobAPITest extends APISpec { 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,9 +367,9 @@ 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() @@ -367,12 +381,12 @@ class AppendBlobAPITest extends APISpec { .ifMatch(match) .ifNoneMatch(noneMatch)) - 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).statusCode() expect: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null).statusCode() == 201 + bc.appendBlockFromUrlWithResponse(sourceURL.getBlobUrl(), null, null, bac, null, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE @@ -389,9 +403,9 @@ 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)) @@ -404,12 +418,12 @@ class AppendBlobAPITest extends APISpec { .ifMatch(match) .ifNoneMatch(noneMatch)) - 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).statusCode() 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).statusCode() def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(setupBlobMatchCondition(sourceURL, sourceIfMatch)) - .sourceIfNoneMatch(sourceIfNoneMatch) + .sourceIfModifiedSince(sourceIfModifiedSince) + .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .sourceIfMatch(setupBlobMatchCondition(sourceURL, sourceIfMatch)) + .sourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.appendBlockFromUrlWithResponse(sourceURL.getBlobUrl(), null, null, null, smac, null, null).statusCode() == 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).statusCode() def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) + .sourceIfModifiedSince(sourceIfModifiedSince) + .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .sourceIfMatch(sourceIfMatch) + .sourceIfNoneMatch(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..af5df0dcf789 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,33 +4,48 @@ 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.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) + VoidResponse response = bc.downloadWithResponse(stream, null, null, null, false, null, null) ByteBuffer body = ByteBuffer.wrap(stream.toByteArray()) HttpHeaders headers = response.headers() @@ -64,12 +79,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 +106,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 +125,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 +139,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,15 +148,15 @@ 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) @@ -169,7 +165,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(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 @@ -187,17 +183,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))) + .ifNoneMatch(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).statusCode() then: thrown(StorageException) @@ -213,7 +209,7 @@ class BlobAPITest extends APISpec { def "Download md5"() { when: - VoidResponse response = bu.download(new ByteArrayOutputStream(), new BlobRange(0 ,3), null, null, true, null) + VoidResponse response = bc.downloadWithResponse(new ByteArrayOutputStream(), new BlobRange(0, 3), null, null, true, null, null) byte[] contentMD5 = response.headers().value("content-md5").getBytes() then: @@ -222,10 +218,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,22 +230,56 @@ 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 headers = bc.getPropertiesWithResponse(null, null, null).headers() then: validateBasicHeaders(headers) @@ -285,22 +315,22 @@ class BlobAPITest extends APISpec { def "Get properties min"() { expect: - bu.getProperties().statusCode() == 200 + bc.getPropertiesWithResponse(null, null, null).statusCode() == 200 } @Unroll def "Get properties AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.getProperties(bac, null).statusCode() == 200 + bc.getPropertiesWithResponse(bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -316,15 +346,15 @@ class BlobAPITest extends APISpec { def "Get properties AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getProperties(bac, null) + bc.getPropertiesWithResponse(bac, null, null) then: thrown(StorageException) @@ -340,10 +370,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,7 +381,7 @@ 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 @@ -359,8 +389,8 @@ class BlobAPITest extends APISpec { } 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()) @@ -369,10 +399,10 @@ class BlobAPITest extends APISpec { .blobContentLanguage(properties.contentLanguage()) .blobContentMD5(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.getPropertiesWithResponse(null, null, null).headers().value("Content-Type") == "type" } @Unroll @@ -385,12 +415,12 @@ class BlobAPITest extends APISpec { .blobContentMD5(contentMD5) .blobContentType(contentType) - bu.setHTTPHeaders(putHeaders) - - 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,8 +432,8 @@ 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() @@ -413,7 +443,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.setHTTPHeaders(null, bac, null).statusCode() == 200 + bc.setHTTPHeadersWithResponse(null, bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -428,8 +458,8 @@ 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() @@ -439,7 +469,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.setHTTPHeaders(null, bac, null) + bc.setHTTPHeadersWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -455,21 +485,21 @@ 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 + then: + bc.getProperties().metadata().size() == 0 response.statusCode() == 200 validateBasicHeaders(response.headers()) Boolean.parseBoolean(response.headers().value("x-ms-request-server-encrypted")) @@ -477,14 +507,14 @@ class BlobAPITest extends APISpec { 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().metadata() == metadata } @Unroll @@ -499,8 +529,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).statusCode() == statusCode + bc.getPropertiesWithResponse(null, null, null).value().metadata() == metadata where: key1 | value1 | key2 | value2 || statusCode @@ -511,8 +541,8 @@ 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() @@ -522,7 +552,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.setMetadata(null, bac, null).statusCode() == 200 + bc.setMetadataWithResponse(null, bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -537,8 +567,8 @@ 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)) @@ -549,7 +579,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.setMetadata(null, bac, null) + bc.setMetadataWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -565,10 +595,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 +606,18 @@ class BlobAPITest extends APISpec { @Unroll def "Acquire lease"() { - setup: - String leaseId = bu.acquireLease(proposedID, leaseTime, null, null).value() + when: + def leaseId = bc.acquireLease(proposedID, leaseTime) + + then: + leaseId != null when: - HttpHeaders headers = bu.getProperties(null, null).headers() + def headers = bc.getPropertiesWithResponse(null, null, null).headers() then: headers.value("x-ms-lease-state") == leaseState.toString() headers.value("x-ms-lease-duration") == leaseDuration.toString() - leaseId != null validateBasicHeaders(headers) where: @@ -596,14 +628,14 @@ class BlobAPITest extends APISpec { } def "Acquire lease min"() { - setup: - bu.acquireLease(null, -1).statusCode() == 201 + expect: + bc.acquireLeaseWithResponse(null, -1, null, null, null).statusCode() == 201 } @Unroll def "Acquire lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -611,7 +643,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.acquireLease(null, -1, mac, null).statusCode() == 201 + bc.acquireLeaseWithResponse(null, -1, mac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch @@ -625,7 +657,7 @@ 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) @@ -633,7 +665,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.acquireLease(null, -1, mac, null) + bc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(StorageException) @@ -648,10 +680,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,30 +691,31 @@ 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() + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() validateBasicHeaders(renewLeaseResponse.headers()) renewLeaseResponse.value() != 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).statusCode() == 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) @@ -690,7 +723,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.renewLease(leaseID, mac, null).statusCode() == 200 + bc.renewLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch @@ -703,8 +736,8 @@ 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) @@ -712,7 +745,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.renewLease(leaseID, mac, null) + bc.renewLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -727,10 +760,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,28 +771,27 @@ 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).headers() expect: - bu.getProperties(null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() 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).statusCode() == 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) @@ -767,7 +799,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.releaseLease(leaseID, mac, null).statusCode() == 200 + bc.releaseLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch @@ -781,8 +813,8 @@ 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) @@ -790,7 +822,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.releaseLease(leaseID, mac, null) + bc.releaseLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -805,10 +837,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,10 +849,10 @@ 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) + String leaseState = bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") expect: leaseState == LeaseStateType.BROKEN.toString() || leaseState == LeaseStateType.BREAKING.toString() @@ -829,24 +861,24 @@ class BlobAPITest extends APISpec { 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).statusCode() == 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) @@ -854,7 +886,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.breakLease(null, mac, null).statusCode() == 202 + bc.breakLeaseWithResponse(null, mac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -868,8 +900,8 @@ 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) @@ -877,7 +909,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.breakLease(null, mac, null) + bc.breakLeaseWithResponse(null, mac, null, null) then: thrown(StorageException) @@ -892,10 +924,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,27 +935,27 @@ 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 + bc.releaseLeaseWithResponse(changeLeaseResponse.value(), null, null, null).statusCode() == 200 validateBasicHeaders(changeLeaseResponse.headers()) } 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).statusCode() == 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) @@ -931,7 +963,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null).statusCode() == 200 + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch @@ -945,8 +977,8 @@ 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) @@ -954,7 +986,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null) + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null) then: thrown(StorageException) @@ -969,10 +1001,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 +1012,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.value().exists() + validateBasicHeaders(response.headers()) } def "Snapshot min"() { - expect: - bu.createSnapshot().statusCode() == 201 + bc.createSnapshotWithResponse(null, null, null, null).statusCode() == 201 } @Unroll @@ -1004,12 +1034,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.value() expect: response.statusCode() == 201 - bu2.getProperties().value().metadata() == metadata + bcSnap.getProperties().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -1020,8 +1050,8 @@ 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() @@ -1031,7 +1061,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.createSnapshot(null, bac, null).statusCode() == 201 + bc.createSnapshotWithResponse(null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -1046,8 +1076,8 @@ 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() @@ -1058,7 +1088,7 @@ class BlobAPITest extends APISpec { when: - bu.createSnapshot(null, bac, null) + bc.createSnapshotWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -1074,10 +1104,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,15 +1115,15 @@ 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).headers() when: - while (bu2.getProperties(null, null).headers().value("x-ms-copy-status") == CopyStatusType.PENDING.toString()) { - sleep(1000) + while (copyDestBlob.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") == CopyStatusType.PENDING.toString()) { + sleepIfRecord(1000) } - HttpHeaders headers2 = bu2.getProperties(null, null).headers() + def headers2 = copyDestBlob.getPropertiesWithResponse(null, null, null).headers() then: headers2.value("x-ms-copy-status") == CopyStatusType.SUCCESS.toString() @@ -1106,13 +1136,13 @@ class BlobAPITest extends APISpec { def "Copy min"() { expect: - bu.startCopyFromURL(bu.getBlobUrl()).statusCode() == 202 + bc.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).statusCode() == 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 +1151,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) + .headers().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).headers().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 +1165,7 @@ class BlobAPITest extends APISpec { } expect: - getMetadataFromHeaders(bu2.getProperties().headers()) == metadata + bu2.getProperties().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -1147,8 +1176,8 @@ 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) @@ -1156,7 +1185,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu2.startCopyFromURL(bu.getBlobUrl(), null, mac, null, null).statusCode() == 202 + copyDestBlob.startCopyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1170,8 +1199,8 @@ 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) @@ -1179,7 +1208,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu2.startCopyFromURL(bu.getBlobUrl(), null, mac, null, null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null) then: thrown(StorageException) @@ -1195,7 +1224,7 @@ 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) @@ -1209,7 +1238,7 @@ class BlobAPITest extends APISpec { expect: - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, bac, null).statusCode() == 202 + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1224,7 +1253,7 @@ 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) @@ -1237,7 +1266,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, bac, null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null) then: thrown(StorageException) @@ -1252,13 +1281,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,30 +1296,32 @@ 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, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null, null).value() + bu2.abortCopyFromURLWithResponse(copyID, new LeaseAccessConditions().leaseId(garbageLeaseID), null, null) then: def e = thrown(StorageException) e.statusCode() == 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) + String copyID = bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).value() + VoidResponse response = bu2.abortCopyFromURLWithResponse(copyID, null, null, null) HttpHeaders headers = response.headers() then: @@ -1298,36 +1330,35 @@ class BlobAPITest extends APISpec { 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).statusCode() == 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).statusCode() == 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 +1366,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, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null, null).value() then: - bu2.abortCopyFromURL(copyID, new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 204 + bu2.abortCopyFromURLWithResponse(copyID, new LeaseAccessConditions().leaseId(leaseID), null, null).statusCode() == 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 +1388,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 +1400,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).headers() + + then: headers.value("x-ms-copy-status") == SyncCopyStatusType.SUCCESS.toString() headers.value("x-ms-copy-id") != null validateBasicHeaders(headers) @@ -1381,18 +1414,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).statusCode() == 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 +1435,10 @@ class BlobAPITest extends APISpec { } when: - bu2.copyFromURL(bu.getBlobUrl(), metadata, null, null, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), metadata, null, null, null, null) then: - getMetadataFromHeaders(bu2.getProperties().headers()) == metadata + bu2.getProperties().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -1416,9 +1449,9 @@ 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) @@ -1426,7 +1459,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu2.copyFromURL(bu.getBlobUrl(), null, mac, null, null).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1440,9 +1473,9 @@ 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) @@ -1450,7 +1483,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu2.copyFromURL(bu.getBlobUrl(), null, mac, null, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null) then: thrown(StorageException) @@ -1466,8 +1499,8 @@ 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) @@ -1480,7 +1513,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu2.copyFromURL(bu.getBlobUrl(), null, null, bac, null).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1495,8 +1528,8 @@ 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) @@ -1509,7 +1542,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu2.copyFromURL(bu.getBlobUrl(), null, null, bac, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null) then: thrown(StorageException) @@ -1525,10 +1558,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,7 +1569,7 @@ class BlobAPITest extends APISpec { def "Delete"() { when: - VoidResponse response = bu.delete() + VoidResponse response = bc.deleteWithResponse(null, null, null, null) HttpHeaders headers = response.headers() then: @@ -1548,28 +1581,22 @@ class BlobAPITest extends APISpec { def "Delete min"() { expect: - bu.delete().statusCode() == 202 + bc.deleteWithResponse(null, null, null, null).statusCode() == 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,8 +1607,8 @@ 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() @@ -1591,7 +1618,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.delete(DeleteSnapshotsOptionType.INCLUDE, bac, null).statusCode() == 202 + bc.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, bac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1606,8 +1633,8 @@ 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() @@ -1617,7 +1644,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.delete(DeleteSnapshotsOptionType.INCLUDE, bac, null) + bc.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, bac, null, null) then: thrown(StorageException) @@ -1633,10 +1660,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 +1672,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) + VoidResponse initialResponse = bc.setTierWithResponse(tier, null, null, null) HttpHeaders headers = initialResponse.headers() then: initialResponse.statusCode() == 200 || initialResponse.statusCode() == 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.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier") == tier.toString() + cc.listBlobsFlat().iterator().next().properties().accessTier() == tier + + cleanup: + cc.delete() where: tier | _ @@ -1671,19 +1700,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.create(512) when: - bu.setTier(tier, null, null) + bc.setTierWithResponse(tier, null, null, null) then: - bu.getProperties().headers().value("x-ms-access-tier") == tier.toString() - cu.listBlobsFlat().iterator().next().properties().accessTier() == tier - cu.delete() + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier") == tier.toString() + cc.listBlobsFlat().iterator().next().properties().accessTier() == tier + + cleanup: + cc.delete() where: tier | _ @@ -1698,33 +1728,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).statusCode() 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 = Boolean.parseBoolean(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier-inferred")) + Boolean inferredList1 = cc.listBlobsFlat().iterator().next().properties().accessTierInferred() - 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 = Boolean.parseBoolean(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier-inferred")) + Boolean inferredList2 = cc.listBlobsFlat().iterator().next().properties().accessTierInferred() then: inferred1 @@ -1736,18 +1767,17 @@ 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.getPropertiesWithResponse(null, null, null).headers().value("x-ms-archive-status") == status.toString() + cc.listBlobsFlat().iterator().next().properties().archiveStatus() == status where: sourceTier | destTier | status @@ -1757,22 +1787,24 @@ class BlobAPITest extends APISpec { 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 + + cleanup: + cc.delete() } def "Set tier illegal argument"() { when: - bu.setTier(null) + bc.setTier(null) then: thrown(IllegalArgumentException) @@ -1780,28 +1812,30 @@ 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, new LeaseAccessConditions().leaseId(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, new LeaseAccessConditions().leaseId("garbage"), null, null) then: thrown(StorageException) @@ -1810,17 +1844,17 @@ class BlobAPITest extends APISpec { def "Undelete"() { setup: enableSoftDelete() - bu.delete() + bc.delete() when: - HttpHeaders headers = bu.undelete().headers() - bu.getProperties() + def undeleteHeaders = bc.undeleteWithResponse(null, null).headers() + 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 +1862,17 @@ class BlobAPITest extends APISpec { def "Undelete min"() { setup: enableSoftDelete() - bu.delete() + bc.delete() expect: - bu.undelete().statusCode() == 200 + bc.undeleteWithResponse(null, null).statusCode() == 200 } def "Undelete error"() { - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.undelete() + bc.undelete() then: thrown(StorageException) @@ -1846,7 +1880,7 @@ 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 @@ -1858,16 +1892,14 @@ class BlobAPITest extends APISpec { def "Get account info min"() { expect: - bu.getAccountInfo().statusCode() == 200 + bc.getAccountInfoWithResponse(null, null).statusCode() == 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..7d4ab2b816b7 --- /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.write(data) + outputStream.close() + + then: + blockBlobClient.getProperties().blobSize() == 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.create(data.length) + + + when: + BlobOutputStream outputStream = pageBlobClient.getBlobOutputStream(data.length) + outputStream.write(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.create() + + when: + BlobOutputStream outputStream = appendBlobClient.getBlobOutputStream() + for (int i = 0; i != 64; i++) { + outputStream.write(Arrays.copyOfRange(data, i * FOUR_MB, ((i + 1) * FOUR_MB) - 1)) + } + outputStream.close() + + then: + appendBlobClient.getProperties().blobSize() == data.length + convertInputStreamToByteArray(appendBlobClient.openInputStream()) == data + } + + private static 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/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..b3b0621e0126 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,32 @@ package com.azure.storage.blob +import com.azure.core.http.HttpMethod +import com.azure.core.http.policy.HttpLogDetailLevel +import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.http.HttpHeaders +import com.azure.core.http.HttpPipelineCallContext +import com.azure.core.http.HttpPipelineNextPolicy +import com.azure.core.http.HttpRequest import com.azure.core.http.rest.Response -import com.azure.core.http.rest.VoidResponse -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.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 +36,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) + def response = bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, null, null, null) HttpHeaders headers = response.headers() expect: response.statusCode() == 201 - headers.value("Content-MD5") != null + 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 +61,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).uncommittedBlocks().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,28 +95,28 @@ 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().leaseId(leaseID), + null, null).statusCode() == 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() + .leaseId(garbageLeaseID), null, null) then: def e = thrown(StorageException) @@ -102,10 +125,10 @@ class BlockBlobAPITest extends APISpec { 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 +136,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).headers() 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.uncommittedBlocks().size() == 1 + response.committedBlocks().size() == 0 + response.uncommittedBlocks().first().name() == 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).statusCode() == 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 +205,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 +218,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 +231,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().leaseId(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 +243,11 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL lease fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) def lease = new LeaseAccessConditions().leaseId("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 +255,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,10 +267,10 @@ 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) @@ -257,7 +281,7 @@ class BlockBlobAPITest extends APISpec { .sourceIfNoneMatch(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).statusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -271,10 +295,10 @@ 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() @@ -284,7 +308,7 @@ class BlockBlobAPITest extends APISpec { .sourceIfNoneMatch(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).statusCode() == 201 then: thrown(StorageException) @@ -300,42 +324,42 @@ 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) + def headers = response.headers() then: response.statusCode() == 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).statusCode() == 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) @@ -346,8 +370,8 @@ class BlockBlobAPITest extends APISpec { .blobContentType(contentType) when: - bu.commitBlockList(ids, headers, null, null, null) - Response response = bu.getProperties() + bc.commitBlockListWithResponse(ids, headers, 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 +397,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) + def response = bc.getPropertiesWithResponse(null, null, null) then: response.statusCode() == 200 - getMetadataFromHeaders(response.headers()) == metadata + response.value().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -389,19 +413,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)) + .ifModifiedSince(modified) + .ifUnmodifiedSince(unmodified) + .ifMatch(match) + .ifNoneMatch(noneMatch)) expect: - bu.commitBlockList(null, null, null, bac, null).statusCode() == 201 + bc.commitBlockListWithResponse(null, null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -416,19 +440,18 @@ 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)) + .ifModifiedSince(modified) + .ifUnmodifiedSince(unmodified) + .ifMatch(match) + .ifNoneMatch(noneMatch)) when: - bu.commitBlockList(null, null, null, bac, null) - + bc.commitBlockListWithResponse(null, null, null, bac, null, null) then: def e = thrown(StorageException) e.errorCode() == StorageErrorCode.CONDITION_NOT_MET || @@ -445,11 +468,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, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("garbage")), null, null) then: thrown(StorageException) @@ -457,38 +480,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.committedBlocks().collect { it.name() } as Set == committedBlocks as Set + blockList.uncommittedBlocks().collect { it.name() } as Set == uncommittedBlocks as Set + + (blockList.committedBlocks() + blockList.uncommittedBlocks()) + .each { assert it.size() == defaultDataSize } } def "Get block list min"() { when: - bu.listBlocks(BlockListType.ALL) + bc.listBlocks(BlockListType.ALL) then: notThrown(StorageErrorException) @@ -497,29 +512,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.committedBlocks().size() == committedCount + response.uncommittedBlocks().size() == uncommittedCount where: type | committedCount | uncommittedCount @@ -530,7 +533,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 +541,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().leaseId(leaseID), null) then: notThrown(StorageException) @@ -549,10 +552,10 @@ 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().leaseId(garbageLeaseID), null) then: def e = thrown(StorageException) @@ -561,10 +564,10 @@ class BlockBlobAPITest extends APISpec { 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,49 +575,54 @@ 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) then: response.statusCode() == 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.headers()) + response.headers().value("Content-MD5") != null + Boolean.parseBoolean(response.headers().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).statusCode() == 201 } def "Upload null body"() { - expect: - bu.upload(null, 0).statusCode() == 201 + when: + bc.uploadWithResponse(null, 0, null, null, null, null, null).statusCode() == 201 + + then: + thrown(NullPointerException) } @Unroll @@ -628,8 +636,8 @@ class BlockBlobAPITest extends APISpec { .blobContentType(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) + 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 +647,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,8 +664,8 @@ 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) + def response = bc.getPropertiesWithResponse(null, null, null) then: response.statusCode() == 200 @@ -672,19 +680,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)) + .ifModifiedSince(modified) + .ifUnmodifiedSince(unmodified) + .ifMatch(match) + .ifNoneMatch(noneMatch)) expect: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, bac, null).statusCode() == 201 + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -699,18 +707,18 @@ 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)) + .ifModifiedSince(modified) + .ifUnmodifiedSince(unmodified) + .ifMatch(match) + .ifNoneMatch(noneMatch)) when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, bac, null) + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, bac, null, null) then: def e = thrown(StorageException) @@ -728,14 +736,293 @@ class BlockBlobAPITest extends APISpec { def "Upload error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), - null) + null, null) then: thrown(StorageException) } + + // 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().committedBlocks().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().committedBlocks().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().blobCacheControl(cacheControl) + .blobContentDisposition(contentDisposition).blobContentEncoding(contentEncoding) + .blobContentLanguage(contentLanguage).blobContentMD5(contentMD5).blobContentType(contentType), + 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).block() + Response response = bac.getPropertiesWithResponse(null).block() + + then: + response.statusCode() == 200 + response.value().metadata() == 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().modifiedAccessConditions( + new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + .ifMatch(match).ifNoneMatch(noneMatch)) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) + + expect: + bac.uploadWithResponse(Flux.just(getRandomData(10)), 10, 2, null, null, accessConditions).block().statusCode() == 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().modifiedAccessConditions( + new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + .ifMatch(match).ifNoneMatch(noneMatch)) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) + + when: + bac.uploadWithResponse(Flux.just(getRandomData(10)), 10, 2, null, null, accessConditions).block() + + then: + def e = thrown(StorageException) + e.errorCode() == StorageErrorCode.CONDITION_NOT_MET || + e.errorCode() == 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.httpRequest().body()) + .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.accountName())) + .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.statusCode() == 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/ContainerAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy index d0027bffbb83..34dd6bc18dce 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,25 +3,44 @@ 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 @@ -29,14 +48,17 @@ class ContainerAPITest extends APISpec { } 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()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) Metadata metadata = new Metadata() if (key1 != null) { metadata.put(key1, value1) @@ -46,8 +68,8 @@ class ContainerAPITest extends APISpec { } when: - cu.create(metadata, null, null) - Response response = cu.getProperties() + cc.createWithResponse(metadata, null, null, null) + Response response = cc.getPropertiesWithResponse(null, null, null) then: getMetadataFromHeaders(response.headers()) == metadata @@ -61,11 +83,11 @@ 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().blobPublicAccess() then: access.toString() == publicAccess.toString() @@ -79,18 +101,18 @@ 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.serviceMessage().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()) @@ -105,20 +127,20 @@ class ContainerAPITest extends APISpec { 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().leaseId(leaseID), null, null).statusCode() == 200 } def "Get properties lease fail"() { when: - cu.getProperties(new LeaseAccessConditions().leaseId("garbage"), null) + cc.getPropertiesWithResponse(new LeaseAccessConditions().leaseId("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,16 +159,18 @@ 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: + when: + def response = cc.setMetadataWithResponse(null, null, null, null) + + then: response.statusCode() == 200 validateBasicHeaders(response.headers()) - getMetadataFromHeaders(cu.getProperties().headers()).size() == 0 + getMetadataFromHeaders(cc.getPropertiesWithResponse(null, null, null).headers()).size() == 0 } def "Set metadata min"() { @@ -155,10 +179,10 @@ class ContainerAPITest extends APISpec { metadata.put("foo", "bar") when: - cu.setMetadata(metadata) + cc.setMetadata(metadata) then: - getMetadataFromHeaders(cu.getProperties().headers()) == metadata + getMetadataFromHeaders(cc.getPropertiesWithResponse(null, null, null).headers()) == metadata } @Unroll @@ -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).statusCode() == 200 + getMetadataFromHeaders(cc.getPropertiesWithResponse(null, null, null).headers()) == 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)) expect: - cu.setMetadata(null, cac, null).statusCode() == 200 + cc.setMetadataWithResponse(null, cac, null, null).statusCode() == 200 where: modified | leaseID @@ -210,7 +234,7 @@ class ContainerAPITest extends APISpec { .ifModifiedSince(modified)) when: - cu.setMetadata(null, cac, null) + cc.setMetadataWithResponse(null, cac, null, null) then: thrown(StorageException) @@ -230,7 +254,7 @@ class ContainerAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - cu.setMetadata(null, new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.setMetadataWithResponse(null, new ContainerAccessConditions().modifiedAccessConditions(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 + cc.getProperties().blobPublicAccess() == access where: access | _ @@ -271,55 +295,53 @@ 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().blobPublicAccess() == 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")) + .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<>() + 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).id() == "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)) + .id("0000") + .accessPolicy(new AccessPolicy() + .start(getUTCNow()) + .expiry(getUTCNow().plusDays(1)) .permission("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)) + .id("0001") + .accessPolicy(new AccessPolicy() + .start(getUTCNow()) + .expiry(getUTCNow().plusDays(2)) .permission("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).value().getIdentifiers() then: response.statusCode() == 200 @@ -335,7 +357,7 @@ class ContainerAPITest extends APISpec { @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() @@ -343,7 +365,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) expect: - cu.setAccessPolicy(null, null, cac, null).statusCode() == 200 + cc.setAccessPolicyWithResponse(null, null, cac, null, null).statusCode() == 200 where: modified | unmodified | leaseID @@ -363,7 +385,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) when: - cu.setAccessPolicy(null, null, cac, null) + cc.setAccessPolicyWithResponse(null, null, cac, null, null) then: thrown(StorageException) @@ -381,7 +403,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.setAccessPolicy(null, null, new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.setAccessPolicyWithResponse(null, null, new ContainerAccessConditions().modifiedAccessConditions(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,16 +428,15 @@ 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)) + .id("0000") + .accessPolicy(new AccessPolicy() + .start(getUTCNow()) + .expiry(getUTCNow().plusDays(1)) .permission("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 @@ -428,15 +449,15 @@ class ContainerAPITest extends APISpec { 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().leaseId(leaseID), null, null).statusCode() == 200 } def "Get access policy lease fail"() { when: - cu.getAccessPolicy(new LeaseAccessConditions().leaseId(garbageLeaseID), null) + cc.getAccessPolicyWithResponse(new LeaseAccessConditions().leaseId(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,7 +476,7 @@ class ContainerAPITest extends APISpec { def "Delete"() { when: - VoidResponse response = cu.delete() + VoidResponse response = cc.deleteWithResponse(null, null, null) then: response.statusCode() == 202 @@ -465,14 +486,17 @@ class ContainerAPITest extends APISpec { } 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() @@ -480,7 +504,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) expect: - cu.delete(cac, null).statusCode() == 202 + cc.deleteWithResponse(cac, null, null).statusCode() == 202 where: modified | unmodified | leaseID @@ -500,7 +524,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) when: - cu.delete(cac, null) + cc.deleteWithResponse(cac, null, null) then: thrown(StorageException) @@ -518,7 +542,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.delete(new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.deleteWithResponse(new ContainerAccessConditions().modifiedAccessConditions(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,11 +567,11 @@ class ContainerAPITest extends APISpec { def "List blobs flat"() { setup: String name = generateBlobName() - PageBlobClient bu = cu.getPageBlobClient(name) + PageBlobClient bu = cc.getPageBlobClient(name) bu.create(512) when: - Iterator blobs = cu.listBlobsFlat().iterator() + Iterator blobs = cc.listBlobsFlat().iterator() //ContainerListBlobFlatSegmentHeaders headers = response.headers() //List blobs = responseiterator()() @@ -590,37 +614,37 @@ class ContainerAPITest extends APISpec { 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) + PageBlobClient normal = cc.getPageBlobClient(normalName) normal.create(512) - PageBlobClient copyBlob = cu.getPageBlobClient(copyName) + PageBlobClient copyBlob = cc.getPageBlobClient(copyName) - String status = copyBlob.startCopyFromURL(normal.getBlobUrl()).value() + String status = copyBlob.startCopyFromURL(normal.getBlobUrl()) OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = copyBlob.getProperties().headers().value("x-ms-copy-status") + status = copyBlob.getPropertiesWithResponse(null, null, null).headers().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) } - PageBlobClient metadataBlob = cu.getPageBlobClient(metadataName) + PageBlobClient metadataBlob = cc.getPageBlobClient(metadataName) Metadata 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() + String snapshotTime = normal.createSnapshot().getSnapshotId() - BlockBlobClient uncommittedBlob = cu.getBlockBlobClient(uncommittedName) + BlockBlobClient uncommittedBlob = cc.getBlockBlobClient(uncommittedName) uncommittedBlob.stageBlock("0000", defaultInputStream.get(), defaultData.remaining()) @@ -646,7 +670,7 @@ 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 @@ -670,7 +694,7 @@ 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 @@ -691,7 +715,7 @@ 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 @@ -710,7 +734,7 @@ 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 @@ -722,13 +746,13 @@ 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() + Iterator blobs = cc.listBlobsFlat(options, null).iterator() then: blobs.next().name() == name @@ -747,30 +771,28 @@ 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.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().details(new BlobListDetails().copy(true) + .snapshots(true).uncommittedBlobs(true)).maxResults(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().value().size() == PAGE_SIZE + ccAsync.listBlobsFlat(options).byPage().blockFirst().value().size() == PAGE_SIZE + } def "List blobs flat options fail"() { when: @@ -780,45 +802,94 @@ class ContainerAPITest extends APISpec { 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.create(512) } - Iterator response = cu.listBlobsFlat(new ListBlobsOptions().maxResults(6), null) + when: "list blobs with sync client" + def pagedIterable = cc.listBlobsFlat(new ListBlobsOptions().maxResults(PAGE_SIZE), null) + def pagedSyncResponse1 = pagedIterable.iterableByPage().iterator().next() + def pagedSyncResponse2 = pagedIterable.iterableByPage(pagedSyncResponse1.nextLink()).iterator().next() - String marker = response.body().nextMarker() - int firstSegmentSize = response.iterator().size() - response = cu.listBlobsFlat(marker, null, null) + then: + pagedSyncResponse1.value().size() == PAGE_SIZE + pagedSyncResponse2.value().size() == NUM_BLOBS - PAGE_SIZE + pagedSyncResponse2.nextLink() == null - expect: - firstSegmentSize == 6 - response.body().nextMarker() == null - responseiterator()().size() == 4 - }*/ + + when: "list blobs with async client" + def pagedFlux = ccAsync.listBlobsFlat(new ListBlobsOptions().maxResults(PAGE_SIZE)) + def pagedResponse1 = pagedFlux.byPage().blockFirst() + def pagedResponse2 = pagedFlux.byPage(pagedResponse1.nextLink()).blockFirst() + + then: + pagedResponse1.value().size() == PAGE_SIZE + pagedResponse2.value().size() == NUM_BLOBS - PAGE_SIZE + pagedResponse2.nextLink() == 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().maxResults(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().maxResults(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) + PageBlobClient bu = cc.getPageBlobClient(name) bu.create(512) when: - Iterator blobs = cu.listBlobsHierarchy(null).iterator() + Iterator blobs = cc.listBlobsHierarchy(null).iterator() then: // response.statusCode() == 200 @@ -832,7 +903,7 @@ class ContainerAPITest extends APISpec { def "List blobs hierarchy min"() { when: - cu.listBlobsHierarchy("/").iterator().hasNext() + cc.listBlobsHierarchy("/").iterator().hasNext() then: notThrown(StorageException) @@ -848,7 +919,7 @@ 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 @@ -872,7 +943,7 @@ 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 @@ -893,7 +964,7 @@ 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 @@ -904,14 +975,14 @@ class ContainerAPITest extends APISpec { 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().details(new BlobListDetails().deletedBlobs(true)) + def blobs = cc.listBlobsHierarchy("", options, null).iterator() then: blobs.next().name() == name @@ -930,41 +1001,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.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) + def 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 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.value().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() + cc.listBlobsHierarchy(null, options, null).iterator().hasNext() then: - def e = thrown(Exception) - exceptionType.isInstance(e) + thrown(exceptionType) where: snapshots | maxResults | exceptionType @@ -974,86 +1045,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.name() + } + else { + foundBlobs << blobItem.name() + } + } 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.create(512) } - ContainerListBlobHierarchySegmentResponse response = cu.listBlobsHierarchySegment(null, "/", - new ListBlobsOptions().maxResults(6), null) + def blobs = cc.listBlobsHierarchy("/", new ListBlobsOptions().maxResults(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.value().size() == PAGE_SIZE + firstPage.nextLink() != null - expect: - firstSegmentSize == 6 - response.body().nextMarker() == null - response.iterator().size() == 4 - }*/ + when: + def secondPage = blobs.iterableByPage(firstPage.nextLink()).iterator().next() + + then: + secondPage.value().size() == NUM_BLOBS - PAGE_SIZE + secondPage.nextLink() == 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.create(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().maxResults(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,10 +1126,10 @@ 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 propertiesResponse = cc.getPropertiesWithResponse(null, null, null) then: leaseResponse.value() != null @@ -1082,7 +1146,7 @@ class ContainerAPITest extends APISpec { def "Acquire lease min"() { expect: - cu.acquireLease(null, -1).statusCode() == 201 + cc.acquireLeaseWithResponse(null, -1, null, null, null).statusCode() == 201 } @Unroll @@ -1091,7 +1155,7 @@ class ContainerAPITest extends APISpec { def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.acquireLease(null, -1, mac, null).statusCode() == 201 + cc.acquireLeaseWithResponse(null, -1, mac, null, null).statusCode() == 201 where: modified | unmodified @@ -1106,7 +1170,7 @@ class ContainerAPITest extends APISpec { def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.acquireLease(null, -1, mac, null) + cc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(StorageException) @@ -1120,10 +1184,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Acquire lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + def mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.acquireLease(null, -1, mac, null) + cc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1136,10 +1200,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 +1211,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() + cc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() validateBasicHeaders(renewLeaseResponse.headers()) } 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).statusCode() == 200 } @Unroll def "Renew lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.renewLease(leaseID, mac, null).statusCode() == 200 + cc.renewLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified @@ -1185,11 +1249,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Renew lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.renewLease(leaseID, mac, null) + cc.renewLease(leaseID, mac, null) then: thrown(StorageException) @@ -1206,7 +1270,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.renewLease(receivedLeaseID, mac, null) + cc.renewLease(receivedLeaseID, mac, null) then: thrown(UnsupportedOperationException) @@ -1219,10 +1283,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 +1294,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() + cc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() validateBasicHeaders(releaseLeaseResponse.headers()) } 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).statusCode() == 200 } @Unroll def "Release lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.releaseLease(leaseID, mac, null).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified @@ -1266,11 +1330,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Release lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.releaseLease(leaseID, mac, null) + cc.releaseLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -1287,7 +1351,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.releaseLease(receivedLeaseID, mac, null) + cc.releaseLeaseWithResponse(receivedLeaseID, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1300,10 +1364,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 +1376,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 = LeaseStateType.fromString(cc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state")) expect: state == LeaseStateType.BROKEN || state == LeaseStateType.BREAKING breakLeaseResponse.value().getSeconds() <= remainingTime validateBasicHeaders(breakLeaseResponse.headers()) 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 +1400,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).statusCode() == 202 } @Unroll def "Break lease AC"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) + setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.breakLease(null, mac, null).statusCode() == 202 + cc.breakLeaseWithResponse(null, mac, null, null).statusCode() == 202 where: modified | unmodified @@ -1360,11 +1425,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Break lease AC fail"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) + setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.breakLease(null, mac, null) + cc.breakLeaseWithResponse(null, mac, null, null) then: thrown(StorageException) @@ -1381,7 +1446,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.breakLease(null, mac, null) + cc.breakLeaseWithResponse(null, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1394,10 +1459,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 +1470,31 @@ class ContainerAPITest extends APISpec { def "Change lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - Response changeLeaseResponse = cu.changeLease(leaseID, UUID.randomUUID().toString()) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + Response changeLeaseResponse = cc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null) leaseID = changeLeaseResponse.value() expect: - cu.releaseLease(leaseID).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, null, null, null).statusCode() == 200 validateBasicHeaders(changeLeaseResponse.headers()) } 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).statusCode() == 200 } @Unroll def "Change lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null).statusCode() == 200 + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null).statusCode() == 200 where: modified | unmodified @@ -1441,11 +1506,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Change lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null) + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null) then: thrown(StorageException) @@ -1462,7 +1527,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.changeLease(receivedLeaseID, garbageLeaseID, mac, null) + cc.changeLeaseWithResponse(receivedLeaseID, garbageLeaseID, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1475,10 +1540,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,19 +1553,19 @@ 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).statusCode() == 201 + bu5.getPropertiesWithResponse(null, null, null).statusCode() == 200 + bu3.createWithResponse(512, null, null, null, null, null, null).statusCode() == 201 + bu4.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, null, null).statusCode() == 201 when: - Iterator blobs = cu.listBlobsFlat().iterator() + Iterator blobs = cc.listBlobsFlat().iterator() then: blobs.next().name() == name @@ -1508,47 +1573,45 @@ class ContainerAPITest extends APISpec { blobs.next().name() == 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).statusCode() == 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 = getBlobClient(primaryCredential, + String.format("http://%s.blob.core.windows.net/%s/rootblob", primaryCredential.accountName(), ContainerClient.ROOT_CONTAINER_NAME)) + .asAppendBlobClient() 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 @@ -1559,22 +1622,22 @@ class ContainerAPITest extends APISpec { /* 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.create() } - 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.create() - Response propsResponse = bu.getProperties() + Response propsResponse = bc.getProperties() then: createResponse.statusCode() == 201 @@ -1585,17 +1648,17 @@ class ContainerAPITest extends APISpec { 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) { 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,7 +1670,7 @@ 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 @@ -1619,14 +1682,12 @@ class ContainerAPITest extends APISpec { def "Get account info min"() { expect: - primaryServiceURL.getAccountInfo().statusCode() == 200 + primaryBlobServiceClient.getAccountInfoWithResponse(null, null).statusCode() == 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..9134d3a840da 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; @@ -90,7 +89,7 @@ public void subscribe(CoreSubscriber subscriber) { 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; } @@ -102,7 +101,7 @@ public void subscribe(CoreSubscriber subscriber) { 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; @@ -179,7 +178,7 @@ public HttpHeaders headers() { } @Override - public Flux body() { + public Flux body() { return null; } 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..778d3334104a 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,7 +32,7 @@ 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) @@ -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,7 +59,7 @@ 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") @@ -89,7 +89,7 @@ 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) }) @@ -113,7 +113,7 @@ 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() @@ -126,7 +126,7 @@ 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) 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..6ebab08f2aaa 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 @@ -4,9 +4,12 @@ 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.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.AccountSASSignatureValues import com.azure.storage.common.Constants import com.azure.storage.common.IPRange import com.azure.storage.common.SASProtocol @@ -24,14 +27,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.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,7 +84,7 @@ 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()) } else { @@ -170,7 +98,7 @@ class HelperTest extends APISpec { } v.startTime(startTime) - .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) + .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCredential.accountName())) .snapshotId(snapId) if (expiryTime == null) { @@ -191,21 +119,21 @@ class HelperTest extends APISpec { .contentLanguage(language) .contentType(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.accountName()) } else { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.accountName()) } then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) /* We don't test the blob or containerName properties because canonicalized resource is always added as at least @@ -232,7 +160,7 @@ 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()) } else { @@ -240,7 +168,7 @@ class HelperTest extends APISpec { } v.startTime(startTime) - .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) + .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCredential.accountName())) .snapshotId(snapId) if (expiryTime == null) { @@ -275,9 +203,9 @@ class HelperTest extends APISpec { .signedVersion(keyVersion) .value(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.expiryTime()), primaryCredential.accountName()) then: token.signature() == Utility.computeHMac256(key.value(), expectedStringToSign) @@ -309,11 +237,11 @@ class HelperTest extends APISpec { @Unroll def "serviceSASSignatureValues canonicalizedResource"() { setup: - ServiceSASSignatureValues v = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() .expiryTime(expiryTime) .permissions(new BlobSASPermission().toString()) .resource(expectedResource) - .canonicalName(String.format("/blob/%s/%s", primaryCreds.accountName(), containerName)) + .canonicalName(String.format("/blob/%s/%s", primaryCredential.accountName(), containerName)) .snapshotId(snapId) if (blobName != null) { @@ -322,13 +250,13 @@ class HelperTest extends APISpec { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.accountName()) when: - SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + BlobServiceSASQueryParameters token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) token.resource() == expectedResource where: @@ -342,7 +270,7 @@ class HelperTest extends APISpec { @Unroll def "serviceSasSignatureValues IA"() { setup: - ServiceSASSignatureValues v = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() .permissions(new AccountSASPermission().toString()) .expiryTime(OffsetDateTime.now()) .resource(containerName) @@ -358,10 +286,10 @@ 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 @@ -541,12 +469,12 @@ class HelperTest extends APISpec { v.ipRange(new IPRange().ipMin("ip")) } - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) - expectedStringToSign = String.format(expectedStringToSign, primaryCreds.accountName()) + expectedStringToSign = String.format(expectedStringToSign, primaryCredential.accountName()) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) where: startTime | ipRange | protocol || expectedStringToSign @@ -573,13 +501,13 @@ 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 @@ -703,13 +631,13 @@ class HelperTest extends APISpec { .blobName("blob") .snapshot("snapshot") - ServiceSASSignatureValues sasValues = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues sasValues = new BlobServiceSASSignatureValues() .expiryTime(OffsetDateTime.now(ZoneOffset.UTC).plusDays(1)) .permissions("r") - .canonicalName(String.format("/blob/%s/container/blob", primaryCreds.accountName())) + .canonicalName(String.format("/blob/%s/container/blob", primaryCredential.accountName())) .resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) - parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential)) when: String[] splitParts = parts.toURL().toString().split("\\?") 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..81113211c65f 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,26 +4,44 @@ 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.create(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 @@ -34,16 +52,15 @@ class PageBlobAPITest extends APISpec { def "Create min"() { expect: - bu.create(PageBlobClient.PAGE_BYTES).statusCode() == 201 + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, null, null, null).statusCode() == 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 + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-blob-sequence-number")) == 2 } @Unroll @@ -57,9 +74,9 @@ class PageBlobAPITest extends APISpec { .blobContentType(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,9 +102,9 @@ 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 @@ -103,16 +120,16 @@ class PageBlobAPITest extends APISpec { def "Create AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(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).statusCode() == 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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(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().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), null, null) then: thrown(StorageException) @@ -161,48 +178,48 @@ 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().start(0).end(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.headers().value("x-ms-content-crc64") != null response.value().blobSequenceNumber() == 0 response.value().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().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null).statusCode() == 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().start(0).end(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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() .ifSequenceNumberLessThan(sequenceNumberLT) @@ -210,8 +227,8 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(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().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -229,8 +246,8 @@ 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() @@ -244,8 +261,8 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(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().start(0).end(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().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), new PageBlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), - null) + null, null) then: thrown(StorageException) @@ -278,15 +295,15 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(PageBlobClient.PAGE_BYTES) destURL.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) def pageRange = new PageRange().start(0).end(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 @@ -295,16 +312,16 @@ class PageBlobAPITest extends APISpec { 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()) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES * 4) sourceURL.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 4 - 1), new ByteArrayInputStream(data)) - def destURL = cu.getPageBlobClient(generateBlobName()) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(PageBlobClient.PAGE_BYTES * 2) when: @@ -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()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(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)) + 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()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.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))) + 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,18 +378,18 @@ 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()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) def pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() .ifSequenceNumberLessThan(sequenceNumberLT) @@ -385,7 +397,7 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(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).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -403,14 +415,14 @@ 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()) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(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() @@ -424,7 +436,7 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(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,8 +456,8 @@ 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()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) @@ -458,7 +470,7 @@ class PageBlobAPITest extends APISpec { .sourceIfNoneMatch(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).statusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -472,8 +484,8 @@ 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()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) @@ -485,8 +497,7 @@ class PageBlobAPITest extends APISpec { .sourceIfNoneMatch(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,14 +511,14 @@ 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().start(0).end(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().start(0).end(PageBlobClient.PAGE_BYTES - 1), null, null, null) then: - bu.getPageRanges(new BlobRange(0)).value().pageRange().size() == 0 + bc.getPageRanges(new BlobRange(0)).pageRange().size() == 0 validateBasicHeaders(response.headers()) response.value().contentMD5() == null response.value().blobSequenceNumber() == 0 @@ -515,16 +526,16 @@ class PageBlobAPITest extends APISpec { def "Clear page min"() { expect: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + bc.clearPages(new PageRange().start(0).end(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().start(0).end(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() @@ -538,7 +549,7 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) + bc.clearPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null, null) .statusCode() == 201 where: @@ -557,10 +568,10 @@ 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().start(0).end(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() @@ -575,7 +586,7 @@ class PageBlobAPITest extends APISpec { when: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) + bc.clearPagesWithResponse(new PageRange().start(0).end(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().start(0).end(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().start(0).end(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 + Long.parseLong(response.headers().get("x-ms-blob-content-length").value()) == (long) PageBlobClient.PAGE_BYTES } def "Get page ranges min"() { when: - bu.getPageRanges(null) + bc.getPageRanges(null) then: notThrown(StorageException) @@ -629,8 +640,8 @@ 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() @@ -641,7 +652,7 @@ class PageBlobAPITest extends APISpec { 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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(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,20 +706,20 @@ class PageBlobAPITest extends APISpec { def "Get page ranges diff"() { setup: - bu.create(PageBlobClient.PAGE_BYTES * 2) + bc.create(PageBlobClient.PAGE_BYTES * 2) - bu.uploadPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1), + bc.uploadPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(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().start(0).end(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().start(PageBlobClient.PAGE_BYTES).end(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 @@ -723,10 +734,10 @@ class PageBlobAPITest extends APISpec { 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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(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) @@ -805,7 +816,7 @@ class PageBlobAPITest extends APISpec { def range = new PageRange().start(start).end(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 + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("Content-Length")) == PageBlobClient.PAGE_BYTES * 2 validateBasicHeaders(response.headers()) response.value().blobSequenceNumber() != null } def "Resize min"() { expect: - bu.resize(PageBlobClient.PAGE_BYTES).statusCode() == 200 + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES, null, null, null).statusCode() == 200 } @Unroll def "Resize AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.resize(PageBlobClient.PAGE_BYTES * 2, bac, null).statusCode() == 200 + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, bac, null, null).statusCode() == 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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(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,10 +910,10 @@ 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 + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-blob-sequence-number")) == result validateBasicHeaders(response.headers()) response.value().blobSequenceNumber() == result @@ -915,22 +926,22 @@ class PageBlobAPITest extends APISpec { def "Sequence number min"() { expect: - bu.updateSequenceNumber(SequenceNumberActionType.INCREMENT, null).statusCode() == 200 + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.INCREMENT, null, null, null, null).statusCode() == 200 } @Unroll def "Sequence number AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 1, bac, null) + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.UPDATE, 1, bac, null, null) .statusCode() == 200 where: @@ -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))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(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,25 +993,25 @@ 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) + def status = copyResponse.value().toString() OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = bu2.getProperties().headers().value("x-ms-copy-status") + status = bc2.getPropertiesWithResponse(null, null, null).headers().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) } expect: - Response propertiesResponse = bu2.getProperties() + Response propertiesResponse = bc2.getPropertiesWithResponse(null, null, null) Boolean.parseBoolean(propertiesResponse.headers().value("x-ms-incremental-copy")) propertiesResponse.headers().value("x-ms-copy-destination-snapshot") != null validateBasicHeaders(copyResponse.headers()) @@ -1010,35 +1021,35 @@ class PageBlobAPITest extends APISpec { 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).statusCode() == 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) + def status = copyResponse.value().toString() OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = bu2.getProperties().headers().value("x-ms-copy-status") + status = bu2.getPropertiesWithResponse(null, null, null).headers().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) } - snapshot = bu.createSnapshot().value().getSnapshotId() + snapshot = bc.createSnapshot().getSnapshotId() match = setupBlobMatchCondition(bu2, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) @@ -1047,7 +1058,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu2.copyIncremental(bu.getBlobUrl(), snapshot, mac, null).statusCode() == 202 + bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, mac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1061,11 +1072,11 @@ 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) @@ -1074,7 +1085,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(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..1badd84e0c8a 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)); @@ -126,7 +126,7 @@ public HttpHeaders headers() { } @Override - public Flux body() { + public Flux body() { return null; } @@ -192,12 +192,18 @@ public Mono send(HttpRequest request) { } // 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.body().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.")); } @@ -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..693b670648e4 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) 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..f46029ede366 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,24 @@ 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.StorageException +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 +28,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 +64,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 +80,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,7 +97,7 @@ 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() @@ -110,8 +106,8 @@ class SASTest extends APISpec { .create(true) .delete(true) .add(true) - def startTime = OffsetDateTime.now().minusDays(1) - def expiryTime = OffsetDateTime.now().plusDays(1) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) def ipRange = new IPRange() .ipMin("0.0.0.0") .ipMax("255.255.255.255") @@ -125,16 +121,11 @@ 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) @@ -150,11 +141,11 @@ 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) @@ -162,8 +153,8 @@ class SASTest extends APISpec { .create(true) .delete(true) .add(true) - def startTime = OffsetDateTime.now().minusDays(1) - def expiryTime = OffsetDateTime.now().plusDays(1) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) def ipRange = new IPRange() .ipMin("0.0.0.0") .ipMax("255.255.255.255") @@ -177,17 +168,11 @@ 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) @@ -199,40 +184,34 @@ class SASTest extends APISpec { def "serviceSASSignatureValues network test container"() { setup: - SignedIdentifier identifier = new SignedIdentifier() + def identifier = new SignedIdentifier() .id("0000") .accessPolicy(new AccessPolicy().permission("racwdl") - .expiry(OffsetDateTime.now().plusDays(1))) - cu.setAccessPolicy(null, Arrays.asList(identifier), null, null) + .expiry(getUTCNow().plusDays(1))) + cc.setAccessPolicy(null, Arrays.asList(identifier)) // Check containerSASPermissions ContainerSASPermission permissions = new ContainerSASPermission() .read(true) .write(true) + .list(true) .create(true) .delete(true) .add(true) + .list(true) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) when: - String sasWithId = cu.generateSAS(identifier.id()) + String sasWithId = cc.generateSAS(identifier.id()) - 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,12 +219,13 @@ 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() @@ -255,8 +235,8 @@ class SASTest extends APISpec { .delete(true) .add(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") @@ -269,21 +249,20 @@ 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.accountName(), permissions, expiryTime, startTime, key.signedVersion(), sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + + then: + sas != null - BlockBlobClient client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + 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) @@ -294,13 +273,74 @@ class SASTest extends APISpec { 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() + .read(true) + .write(true) + .create(true) + .delete(true) + .add(true) + OffsetDateTime startTime = getUTCNow().minusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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.cacheControl() == "cache" + properties.contentDisposition() == "disposition" + properties.contentEncoding() == "encoding" + properties.contentLanguage() == "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() @@ -310,8 +350,8 @@ class SASTest extends APISpec { .delete(true) .add(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") @@ -324,20 +364,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.accountName(), permissions, expiryTime, startTime, key.signedVersion(), 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 +379,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,7 +388,7 @@ class SASTest extends APISpec { os.toString() == new String(data) and: - def properties = client2.getProperties().value() + def properties = client2.getProperties() then: properties.cacheControl() == "cache" @@ -372,6 +397,7 @@ class SASTest extends APISpec { properties.contentLanguage() == "language" } + @Ignore def "serviceSASSignatureValues network test container user delegation"() { setup: ContainerSASPermission permissions = new ContainerSASPermission() @@ -380,21 +406,16 @@ class SASTest extends APISpec { .create(true) .delete(true) .add(true) + .list(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.accountName(), 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,7 +426,7 @@ 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() @@ -416,18 +437,12 @@ class SASTest extends APISpec { .object(true) def permissions = new AccountSASPermission() .read(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + 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,7 +454,7 @@ 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() @@ -450,17 +465,12 @@ class SASTest extends APISpec { .object(true) def permissions = new AccountSASPermission() .read(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + 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: @@ -478,17 +488,13 @@ class SASTest extends APISpec { def permissions = new AccountSASPermission() .read(true) .create(false) - def expiryTime = OffsetDateTime.now().plusDays(1) + 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) @@ -505,17 +511,13 @@ class SASTest extends APISpec { def permissions = new AccountSASPermission() .read(true) .create(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + 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,7 +532,7 @@ 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()) @@ -553,10 +555,11 @@ class SASTest extends APISpec { .contentEncoding(encoding) .contentLanguage(language) .contentType(type) + v.resource("bs") - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) /* We don't test the blob or containerName properties because canonicalized resource is always added as at least @@ -566,22 +569,22 @@ 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) @@ -604,6 +607,7 @@ class SASTest extends APISpec { .contentEncoding(encoding) .contentLanguage(language) .contentType(type) + v.resource("bs") def key = new UserDelegationKey() .signedOid(keyOid) .signedTid(keyTid) @@ -622,41 +626,40 @@ class SASTest extends APISpec { */ 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.canonicalName() == "/blob/" + accountName + cc.containerUrl.path + "/" + blobName } @Unroll def "serviceSasSignatureValues IA"() { setup: - def v = new ServiceSASSignatureValues() + def v = new BlobServiceSASSignatureValues() .snapshotId("2018-01-01T00:00:00.0000000Z") .version(version) @@ -668,9 +671,9 @@ 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 @@ -832,7 +835,7 @@ class SASTest extends APISpec { @Unroll def "ServiceSASSignatureValues assertGenerateOk"() { when: - def serviceSASSignatureValues = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues serviceSASSignatureValues = new BlobServiceSASSignatureValues() serviceSASSignatureValues.version(version) serviceSASSignatureValues.canonicalName(canonicalName) serviceSASSignatureValues.expiryTime(expiryTime) @@ -853,14 +856,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 | 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" } + // 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 @@ -885,10 +889,10 @@ class SASTest extends APISpec { } v.protocol(protocol) - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(String.format(expectedStringToSign, primaryCreds.accountName())) + token.signature() == primaryCredential.computeHmac256(String.format(expectedStringToSign, primaryCredential.accountName())) where: startTime | ipRange | protocol || expectedStringToSign @@ -915,13 +919,13 @@ 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 @@ -1044,11 +1048,12 @@ class SASTest extends APISpec { .containerName("container") .blobName("blob") .snapshot("snapshot") - def sasValues = new ServiceSASSignatureValues() + def sasValues = new BlobServiceSASSignatureValues() .permissions("r") .canonicalName("/containerName/blobName") .expiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) - parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + .resource("bs") + parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential)) when: def splitParts = parts.toURL().toString().split("\\?") @@ -1059,7 +1064,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"() { 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..b533c70aaa1f 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 @@ -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 @@ -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(() -> { @@ -138,7 +136,7 @@ public void asyncSample() throws IOException { .flatMap(listItem -> finalContainerClient.getBlobAsyncClient(listItem.name()) .download() - .flatMapMany(Response::value) + .flatMapMany(flux -> flux) .map(buffer -> new String(buffer.array())) .doOnNext(string -> System.out.println(listItem.name() + ": " + string))) // cleanup @@ -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..3a76e120a35b 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,19 +3,33 @@ 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() + primaryBlobServiceClient.setProperties(new StorageServiceProperties() .staticWebsite(new StaticWebsite().enabled(false)) .deleteRetentionPolicy(disabled) .cors(null) @@ -25,29 +39,28 @@ class ServiceAPITest extends APISpec { .retentionPolicy(disabled)) .logging(new Logging().version("1.0") .retentionPolicy(disabled)) - .defaultServiceVersion("2018-03-28"), null) + .defaultServiceVersion("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) + primaryBlobServiceClient.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) + .minuteMetrics(new Metrics().version("1.0").enabled(false) .retentionPolicy(disabled)) - .logging(new Logging().version("1.0") + .logging(new Logging().version("1.0") .retentionPolicy(disabled)) - .defaultServiceVersion("2018-03-28"), null) + .defaultServiceVersion("2018-03-28")) } def "List containers"() { when: - Iterable response = - primaryServiceURL.listContainers(new ListContainersOptions().prefix(containerPrefix), null) + def response = + primaryBlobServiceClient.listContainers(new ListContainersOptions().prefix(containerPrefix + testName), null) then: for (ContainerItem c : response) { @@ -65,7 +78,7 @@ class ServiceAPITest extends APISpec { def "List containers min"() { when: - primaryServiceURL.listContainers().iterator().hasNext() + primaryBlobServiceClient.listContainers().iterator().hasNext() then: notThrown(StorageException) @@ -74,10 +87,10 @@ 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() + Iterator listResponse = primaryBlobServiceClient.listContainers().iterator() String firstContainerName = listResponse.next().name() expect: @@ -89,110 +102,133 @@ class ServiceAPITest extends APISpec { 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).value() expect: - primaryServiceURL.listContainers(new ListContainersOptions() - .details(new ContainerListDetails().metadata(true)) - .prefix("aaa" + containerPrefix), null) + primaryBlobServiceClient.listContainers(new ListContainersOptions() + .details(new ContainerListDetails().metadata(true)) + .prefix("aaa" + containerPrefix), null) .iterator().next().metadata() == metadata // Container with prefix "aaa" will not be cleaned up by normal test cleanup. - cu.delete().statusCode() == 202 + cc.deleteWithResponse(null, null, null).statusCode() == 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().maxResults(PAGE_RESULTS), null) + .iterableByPage().iterator().next().value().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().maxResults(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() + 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() } 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) 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)) + .allowedOrigins("*") + .allowedHeaders("x-ms-version") + .exposedHeaders("x-ms-client-request-id") + .maxAgeInSeconds(10)) String defaultServiceVersion = "2016-05-31" Metrics hourMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) Metrics minuteMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) StaticWebsite website = new StaticWebsite().enabled(true) - .indexDocument("myIndex.html") - .errorDocument404Path("custom/error/path.html") + .indexDocument("myIndex.html") + .errorDocument404Path("custom/error/path.html") StorageServiceProperties sentProperties = new StorageServiceProperties() - .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) - .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) - .deleteRetentionPolicy(retentionPolicy) - .staticWebsite(website) + .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) + .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) + .deleteRetentionPolicy(retentionPolicy) + .staticWebsite(website) - HttpHeaders headers = primaryServiceURL.setProperties(sentProperties).headers() + HttpHeaders headers = primaryBlobServiceClient.setPropertiesWithResponse(sentProperties, null, null).headers() // 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 @@ -206,38 +242,35 @@ class ServiceAPITest extends APISpec { setup: RetentionPolicy retentionPolicy = new RetentionPolicy().days(5).enabled(true) Logging logging = new Logging().read(true).version("1.0") - .retentionPolicy(retentionPolicy) + .retentionPolicy(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)) + .allowedOrigins("*") + .allowedHeaders("x-ms-version") + .exposedHeaders("x-ms-client-request-id") + .maxAgeInSeconds(10)) String defaultServiceVersion = "2016-05-31" Metrics hourMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) Metrics minuteMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) StaticWebsite website = new StaticWebsite().enabled(true) - .indexDocument("myIndex.html") - .errorDocument404Path("custom/error/path.html") + .indexDocument("myIndex.html") + .errorDocument404Path("custom/error/path.html") StorageServiceProperties sentProperties = new StorageServiceProperties() - .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) - .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) - .deleteRetentionPolicy(retentionPolicy) - .staticWebsite(website) + .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) + .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) + .deleteRetentionPolicy(retentionPolicy) + .staticWebsite(website) expect: - primaryServiceURL.setProperties(sentProperties).statusCode() == 202 + primaryBlobServiceClient.setPropertiesWithResponse(sentProperties, null, null).statusCode() == 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).statusCode() == 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,7 +296,7 @@ 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 @@ -284,7 +314,7 @@ class ServiceAPITest extends APISpec { 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 @@ -292,7 +322,7 @@ class ServiceAPITest extends APISpec { def "Get UserDelegationKey error"() { when: - getOAuthServiceURL().getUserDelegationKey(start, expiry) + getOAuthServiceClient().getUserDelegationKey(start, expiry) then: thrown(exception) @@ -305,10 +335,9 @@ 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.accountName()) + BlobServiceClient serviceClient = getServiceClient(primaryCredential, secondaryEndpoint) + Response response = serviceClient.getStatisticsWithResponse(null, null) expect: response.headers().value("x-ms-version") != null @@ -320,16 +349,16 @@ class ServiceAPITest extends APISpec { 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.accountName()) + BlobServiceClient serviceClient = getServiceClient(primaryCredential, secondaryEndpoint) + expect: - serviceClient.getStatistics().statusCode() == 200 + serviceClient.getStatisticsWithResponse(null, null).statusCode() == 200 } def "Get stats error"() { when: - primaryServiceURL.getStatistics() + primaryBlobServiceClient.getStatistics() then: thrown(StorageException) @@ -337,7 +366,7 @@ 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 @@ -349,14 +378,12 @@ class ServiceAPITest extends APISpec { def "Get account info min"() { expect: - primaryServiceURL.getAccountInfo().statusCode() == 200 + primaryBlobServiceClient.getAccountInfoWithResponse(null, null).statusCode() == 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..8c6c8cf7780f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacdf170980daa1?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" : "dd08750f-e3b0-4eae-88fe-6ad27cef6133" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64444D6C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a82c8-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "dd08750f-e3b0-4eae-88fe-6ad27cef6133" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacdf170980daa1/javablobappendblockac1appendblobapitestappendblockacdf154215c", + "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" : "599bcc23-c2e7-4bb6-bbe3-3a88891dbc9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC644B62AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a82ef-d01e-009e-53e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "599bcc23-c2e7-4bb6-bbe3-3a88891dbc9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacdf170980daa1/javablobappendblockac1appendblobapitestappendblockacdf154215c?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", + "x-ms-client-request-id" : "8ebcf1e9-4636-4b8b-921c-5b1ba3da8171", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "ETag" : "\"0x8D732FC64546586\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a8329-d01e-009e-04e5-644931000000", + "x-ms-client-request-id" : "8ebcf1e9-4636-4b8b-921c-5b1ba3da8171", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f1683bb3-70ac-4675-8733-9cea3b436bae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8349-d01e-009e-23e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacdf170980daa1Fri, 06 Sep 2019 18:59:49 GMT\"0x8D732FC64444D6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "f1683bb3-70ac-4675-8733-9cea3b436bae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacdf170980daa1?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" : "9166fe0a-0ddd-4248-9770-6313d9d8240e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8377-d01e-009e-4ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "9166fe0a-0ddd-4248-9770-6313d9d8240e" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacdf170980daa1", "javablobappendblockac1appendblobapitestappendblockacdf154215c" ] +} \ 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..d969dd15650c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7d5044198daa?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" : "6e479eb7-74f8-4b5c-a133-de9a3f5dcf5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6466F89C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a83b7-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "6e479eb7-74f8-4b5c-a133-de9a3f5dcf5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7d5044198daa/javablobappendblockac1appendblobapitestappendblockac7d5340883", + "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" : "c0525916-1a14-41d5-b983-48820624430b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64798283\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8461-d01e-009e-27e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "c0525916-1a14-41d5-b983-48820624430b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7d5044198daa/javablobappendblockac1appendblobapitestappendblockac7d5340883?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", + "x-ms-client-request-id" : "e7792818-04ba-41cf-8ebe-4ed10a61a9f2", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "ETag" : "\"0x8D732FC648013C1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a849b-d01e-009e-58e5-644931000000", + "x-ms-client-request-id" : "e7792818-04ba-41cf-8ebe-4ed10a61a9f2", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9917831b-da10-4e83-839e-07becf0ea137" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a84c8-d01e-009e-04e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac7d5044198daaFri, 06 Sep 2019 18:59:49 GMT\"0x8D732FC6466F89C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "9917831b-da10-4e83-839e-07becf0ea137", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7d5044198daa?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" : "989e5b45-8519-4b65-a509-85fefa9175d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a84e9-d01e-009e-21e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "989e5b45-8519-4b65-a509-85fefa9175d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac7d5044198daa", "javablobappendblockac1appendblobapitestappendblockac7d5340883" ] +} \ 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..1b2c18cee943 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac67b29372a4f2?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" : "24035bde-665e-4bd4-8ca6-1a225d0b69b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC649AE5BF\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a855f-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "24035bde-665e-4bd4-8ca6-1a225d0b69b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac67b29372a4f2/javablobappendblockac1appendblobapitestappendblockac67b52247e", + "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" : "56639bc9-636a-4ac7-8c5c-018e876f8dc8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64A95079\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a858f-d01e-009e-3ae5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "56639bc9-636a-4ac7-8c5c-018e876f8dc8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac67b29372a4f2/javablobappendblockac1appendblobapitestappendblockac67b52247e?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", + "x-ms-client-request-id" : "87ecfcf4-a8f4-4883-8b42-767746b0923f", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "ETag" : "\"0x8D732FC64AF4549\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a85d0-d01e-009e-77e5-644931000000", + "x-ms-client-request-id" : "87ecfcf4-a8f4-4883-8b42-767746b0923f", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4096390d-2826-4f00-8392-0c163c6f0734" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a85fa-d01e-009e-1ee5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac67b29372a4f2Fri, 06 Sep 2019 18:59:49 GMT\"0x8D732FC649AE5BF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "4096390d-2826-4f00-8392-0c163c6f0734", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac67b29372a4f2?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" : "6d7a025d-2a65-4e2d-9f89-d8d159a421d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8618-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "6d7a025d-2a65-4e2d-9f89-d8d159a421d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac67b29372a4f2", "javablobappendblockac1appendblobapitestappendblockac67b52247e" ] +} \ 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..46b13295787d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac659357179db5?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" : "929d0f0d-5a62-48ad-9295-d3966f556451" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64C3D3E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a863c-d01e-009e-57e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "929d0f0d-5a62-48ad-9295-d3966f556451" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac659357179db5/javablobappendblockac1appendblobapitestappendblockac65970636e", + "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" : "ccdf19e0-db48-4137-aec3-450d0ffa3193" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64CB1142\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8675-d01e-009e-09e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "ccdf19e0-db48-4137-aec3-450d0ffa3193" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac659357179db5/javablobappendblockac1appendblobapitestappendblockac65970636e", + "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" : "6c46ecb9-a621-446f-8840-418ed8cc8c4d" + }, + "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" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:49 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" : "\"0x8D732FC64CB1142\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:50 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "b92a86a0-d01e-009e-31e5-644931000000", + "x-ms-client-request-id" : "6c46ecb9-a621-446f-8840-418ed8cc8c4d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac659357179db5/javablobappendblockac1appendblobapitestappendblockac65970636e?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", + "x-ms-client-request-id" : "7d67f565-aaf6-4b2c-bf2a-47628edae246", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "ETag" : "\"0x8D732FC64D7BE78\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a86db-d01e-009e-63e5-644931000000", + "x-ms-client-request-id" : "7d67f565-aaf6-4b2c-bf2a-47628edae246", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b7bb8bad-012c-4dcc-8909-d99934ae371e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8700-d01e-009e-03e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac659357179db5Fri, 06 Sep 2019 18:59:49 GMT\"0x8D732FC64C3D3E6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:49 GMT", + "x-ms-client-request-id" : "b7bb8bad-012c-4dcc-8909-d99934ae371e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac659357179db5?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" : "9f81cbd7-3856-41df-9fbf-12898a9cd40e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8720-d01e-009e-1fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "9f81cbd7-3856-41df-9fbf-12898a9cd40e" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac659357179db5", "javablobappendblockac1appendblobapitestappendblockac65970636e" ] +} \ 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..4c1f85d95814 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac811571545d5d?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" : "e834f730-8d65-4dd9-bf33-e5d45c555c0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64EA0242\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8750-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "e834f730-8d65-4dd9-bf33-e5d45c555c0a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac811571545d5d/javablobappendblockac1appendblobapitestappendblockac811466531", + "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" : "c277944e-d398-4ee0-befd-2a2caaa8eb25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC64F38A71\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8786-d01e-009e-7ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "c277944e-d398-4ee0-befd-2a2caaa8eb25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac811571545d5d/javablobappendblockac1appendblobapitestappendblockac811466531?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", + "x-ms-client-request-id" : "f17f20f9-487d-4b82-83f9-11aee44627cc", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "ETag" : "\"0x8D732FC64F9CD8F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a87ad-d01e-009e-21e5-644931000000", + "x-ms-client-request-id" : "f17f20f9-487d-4b82-83f9-11aee44627cc", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a245969a-ea82-4d59-811e-fdbe116b0d28" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a87c5-d01e-009e-37e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac811571545d5dFri, 06 Sep 2019 18:59:50 GMT\"0x8D732FC64EA0242\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "a245969a-ea82-4d59-811e-fdbe116b0d28", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac811571545d5d?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" : "aef14211-e632-461d-ae6e-08f16873293a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8805-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "aef14211-e632-461d-ae6e-08f16873293a" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac811571545d5d", "javablobappendblockac1appendblobapitestappendblockac811466531" ] +} \ 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..590a57c8f962 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd1f630529b60?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" : "1c0535cd-fd81-4d2b-8f81-d81124e219a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6522F9A0\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a883c-d01e-009e-20e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "1c0535cd-fd81-4d2b-8f81-d81124e219a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd1f630529b60/javablobappendblockac1appendblobapitestappendblockacd1f76257d", + "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" : "7449cbf8-5865-4424-8774-3bc0456f176b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC652A10B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a885d-d01e-009e-40e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "7449cbf8-5865-4424-8774-3bc0456f176b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd1f630529b60/javablobappendblockac1appendblobapitestappendblockacd1f76257d?comp=lease", + "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" : "306c0113-0f1c-4b0f-a4c0-5c97df63377d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC652A10B1\"", + "x-ms-lease-id" : "2ade63e0-2269-4798-bcad-b08ef28485d0", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a888c-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "306c0113-0f1c-4b0f-a4c0-5c97df63377d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd1f630529b60/javablobappendblockac1appendblobapitestappendblockacd1f76257d?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", + "x-ms-client-request-id" : "2c1e7aaa-c55e-4716-8d5d-8654ff6b6310", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "ETag" : "\"0x8D732FC6543E06B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a88a5-d01e-009e-05e5-644931000000", + "x-ms-client-request-id" : "2c1e7aaa-c55e-4716-8d5d-8654ff6b6310", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6fe3a5c9-f83f-45b1-a5bc-b0c6812ff172" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a88eb-d01e-009e-44e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacd1f630529b60Fri, 06 Sep 2019 18:59:50 GMT\"0x8D732FC6522F9A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "6fe3a5c9-f83f-45b1-a5bc-b0c6812ff172", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd1f630529b60?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" : "4f355d2c-36ea-44e4-9de1-2ff4915c6f33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8905-d01e-009e-5ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "4f355d2c-36ea-44e4-9de1-2ff4915c6f33" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacd1f630529b60", "javablobappendblockac1appendblobapitestappendblockacd1f76257d" ] +} \ 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..09ac1aabbb8b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac384500524fb3?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" : "ae9fcf63-d16b-423e-9f57-41ed27be5511" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6559CDB7\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a892f-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "ae9fcf63-d16b-423e-9f57-41ed27be5511" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac384500524fb3/javablobappendblockac1appendblobapitestappendblockac38487173e", + "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" : "25f3c0eb-7850-475c-9321-b38e6d06b61e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC656048BF\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8963-d01e-009e-32e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "25f3c0eb-7850-475c-9321-b38e6d06b61e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac384500524fb3/javablobappendblockac1appendblobapitestappendblockac38487173e?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", + "x-ms-client-request-id" : "c5c5f092-9abf-4c16-b7de-4b29296c4ce6", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "ETag" : "\"0x8D732FC656812CC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a898e-d01e-009e-5ae5-644931000000", + "x-ms-client-request-id" : "c5c5f092-9abf-4c16-b7de-4b29296c4ce6", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2bd8a8f0-6584-46de-b3a8-b007d304045e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a89c0-d01e-009e-07e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac384500524fb3Fri, 06 Sep 2019 18:59:50 GMT\"0x8D732FC6559CDB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "2bd8a8f0-6584-46de-b3a8-b007d304045e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac384500524fb3?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" : "92c17a8e-c66f-4b51-8eac-24a6664cdee6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a89df-d01e-009e-24e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:50 GMT", + "x-ms-client-request-id" : "92c17a8e-c66f-4b51-8eac-24a6664cdee6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac384500524fb3", "javablobappendblockac1appendblobapitestappendblockac38487173e" ] +} \ 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..cb450c6cc711 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1b1704595a03?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" : "4d6b349c-1dde-41fb-a087-7be4c8393955" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC657B6718\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8a22-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "4d6b349c-1dde-41fb-a087-7be4c8393955" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1b1704595a03/javablobappendblockac1appendblobapitestappendblockac1b1737301", + "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" : "532121b2-63d4-47b8-aa3f-c37da55f2027" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65853EAB\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8a54-d01e-009e-11e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "532121b2-63d4-47b8-aa3f-c37da55f2027" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1b1704595a03/javablobappendblockac1appendblobapitestappendblockac1b1737301?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", + "x-ms-client-request-id" : "f49d374e-321a-4489-82da-fbf64d9ca9c0", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "ETag" : "\"0x8D732FC658A9724\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a8a77-d01e-009e-33e5-644931000000", + "x-ms-client-request-id" : "f49d374e-321a-4489-82da-fbf64d9ca9c0", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7bdafda8-b234-4f56-b6d9-37510ff964cc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8a9b-d01e-009e-53e5-644931000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac1b1704595a03Fri, 06 Sep 2019 18:59:51 GMT\"0x8D732FC657B6718\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "7bdafda8-b234-4f56-b6d9-37510ff964cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1b1704595a03?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" : "ba46e4ce-1d18-4b91-addb-3f778e4c7208" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8abd-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "ba46e4ce-1d18-4b91-addb-3f778e4c7208" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac1b1704595a03", "javablobappendblockac1appendblobapitestappendblockac1b1737301" ] +} \ 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..1dfa7dd47875 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail026925c368b4f3700d458185?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" : "67ed949c-fc6c-47b1-ab19-a53ef95eebb5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65AC9495\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8b1c-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "67ed949c-fc6c-47b1-ab19-a53ef95eebb5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail026925c368b4f3700d458185/javablobappendblockacfail1991027a901e205f7441b3", + "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" : "60286846-892b-48e2-b2f9-5af1328b5835" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65B3ACAD\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8b4c-d01e-009e-76e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "60286846-892b-48e2-b2f9-5af1328b5835" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail026925c368b4f3700d458185/javablobappendblockacfail1991027a901e205f7441b3?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", + "x-ms-client-request-id" : "c992db05-2993-4de8-b04c-007005d37f13", + "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" : "b92a8b64-d01e-009e-0ce5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92a8b64-d01e-009e-0ce5-644931000000\nTime:2019-09-06T18:59:51.6021730Z", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "c992db05-2993-4de8-b04c-007005d37f13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "77a8080c-9386-429b-9261-25ca36dd0042" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8b83-d01e-009e-29e5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail026925c368b4f3700d458185Fri, 06 Sep 2019 18:59:51 GMT\"0x8D732FC65AC9495\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "77a8080c-9386-429b-9261-25ca36dd0042", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail026925c368b4f3700d458185?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" : "3780877b-e94b-4ea2-b87f-2de68cc7fb25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8ba4-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "3780877b-e94b-4ea2-b87f-2de68cc7fb25" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail026925c368b4f3700d458185", "javablobappendblockacfail1991027a901e205f7441b3" ] +} \ 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..e0ecaaae97bb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail042618e47bfeccd5934df884?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" : "9927ec89-c9bb-49c3-b8e7-c5ffd80f0bf6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65CB6E55\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8bd5-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "9927ec89-c9bb-49c3-b8e7-c5ffd80f0bf6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail042618e47bfeccd5934df884/javablobappendblockacfail153937979394c17c5e49d8", + "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" : "5673da49-3cf9-4def-ad78-be3773b62460" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65D19C0E\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8c01-d01e-009e-17e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "5673da49-3cf9-4def-ad78-be3773b62460" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail042618e47bfeccd5934df884/javablobappendblockacfail153937979394c17c5e49d8?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", + "x-ms-client-request-id" : "43c72827-db04-4e51-8045-ac542ee52c63", + "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" : "b92a8c26-d01e-009e-39e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92a8c26-d01e-009e-39e5-644931000000\nTime:2019-09-06T18:59:51.8013529Z", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "43c72827-db04-4e51-8045-ac542ee52c63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2185a0e3-31e0-4c84-8833-7db32c1dfe2c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8c4b-d01e-009e-5be5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail042618e47bfeccd5934df884Fri, 06 Sep 2019 18:59:51 GMT\"0x8D732FC65CB6E55\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "2185a0e3-31e0-4c84-8833-7db32c1dfe2c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail042618e47bfeccd5934df884?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" : "a66d65f6-56f5-45d8-a24c-af8e6954dcfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8c6b-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "a66d65f6-56f5-45d8-a24c-af8e6954dcfa" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail042618e47bfeccd5934df884", "javablobappendblockacfail153937979394c17c5e49d8" ] +} \ 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..f6bd6638da99 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail046471df3a2e3feb6445eebf?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" : "6dc5a5be-e4b6-4fe8-94ff-1a873c5c71ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65EDCB56\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8cab-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "6dc5a5be-e4b6-4fe8-94ff-1a873c5c71ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail046471df3a2e3feb6445eebf/javablobappendblockacfail121406f6d465400c594f69", + "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" : "a8e73869-16fd-4858-887a-f86d050e8569" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC65F42061\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8cd2-d01e-009e-55e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "a8e73869-16fd-4858-887a-f86d050e8569" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail046471df3a2e3feb6445eebf/javablobappendblockacfail121406f6d465400c594f69?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", + "x-ms-client-request-id" : "c2644e77-c01e-48cc-965c-45362bcee5eb", + "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" : "b92a8cec-d01e-009e-6ee5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92a8cec-d01e-009e-6ee5-644931000000\nTime:2019-09-06T18:59:52.0385667Z", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "c2644e77-c01e-48cc-965c-45362bcee5eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "26770761-edf9-4875-aa18-0f62e1d40ee3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8d1c-d01e-009e-19e5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail046471df3a2e3feb6445eebfFri, 06 Sep 2019 18:59:51 GMT\"0x8D732FC65EDCB56\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "26770761-edf9-4875-aa18-0f62e1d40ee3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail046471df3a2e3feb6445eebf?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" : "9888041f-0b44-44b5-b2ed-a87b9d72841b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8d44-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "9888041f-0b44-44b5-b2ed-a87b9d72841b" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail046471df3a2e3feb6445eebf", "javablobappendblockacfail121406f6d465400c594f69" ] +} \ 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..5d5d00f8f3ed --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02173613277ae1eb2c4435b4?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" : "c210c2e7-b4ac-472c-9e35-56f3ce10ca97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6611D669\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8d85-d01e-009e-79e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:51 GMT", + "x-ms-client-request-id" : "c210c2e7-b4ac-472c-9e35-56f3ce10ca97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02173613277ae1eb2c4435b4/javablobappendblockacfail191888a38207a1eadd46bf", + "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" : "96af9280-7c18-40cb-a912-19d889018756" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6618EF2C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8db4-d01e-009e-1be5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "96af9280-7c18-40cb-a912-19d889018756" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02173613277ae1eb2c4435b4/javablobappendblockacfail191888a38207a1eadd46bf", + "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" : "19f37159-1cc3-482c-af3d-461bee4db02b" + }, + "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" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59: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" : "\"0x8D732FC6618EF2C\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:52 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "b92a8dea-d01e-009e-40e5-644931000000", + "x-ms-client-request-id" : "19f37159-1cc3-482c-af3d-461bee4db02b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02173613277ae1eb2c4435b4/javablobappendblockacfail191888a38207a1eadd46bf?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", + "x-ms-client-request-id" : "d701bd53-80b1-45b7-addb-65b223096bbe", + "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" : "b92a8e1e-d01e-009e-69e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92a8e1e-d01e-009e-69e5-644931000000\nTime:2019-09-06T18:59:52.3108123Z", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "d701bd53-80b1-45b7-addb-65b223096bbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2bcad9f3-27da-4ca6-9353-94ddeba8f21e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8e33-d01e-009e-79e5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail02173613277ae1eb2c4435b4Fri, 06 Sep 2019 18:59:52 GMT\"0x8D732FC6611D669\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "2bcad9f3-27da-4ca6-9353-94ddeba8f21e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02173613277ae1eb2c4435b4?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" : "7bba7ddb-c538-49b1-80f6-b89bdee52552" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8e4d-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "7bba7ddb-c538-49b1-80f6-b89bdee52552" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail02173613277ae1eb2c4435b4", "javablobappendblockacfail191888a38207a1eadd46bf" ] +} \ 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..9a1281ae4794 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0633550252abff0a4c4c959e?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" : "bd17e00a-ccac-4436-ab32-924e2c3ab197" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC663F5979\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8e93-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "bd17e00a-ccac-4436-ab32-924e2c3ab197" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0633550252abff0a4c4c959e/javablobappendblockacfail133757c0d4d11bcc684017", + "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" : "17e085cb-ca9d-4a3c-93cc-94bff30c53f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6645D631\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8eee-d01e-009e-0de5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "17e085cb-ca9d-4a3c-93cc-94bff30c53f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0633550252abff0a4c4c959e/javablobappendblockacfail133757c0d4d11bcc684017?comp=lease", + "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" : "75d0ecc1-54f2-4252-837c-38025d7e60ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6645D631\"", + "x-ms-lease-id" : "d07f392d-fb3b-4c28-862e-d4c3a90399e7", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8f10-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "75d0ecc1-54f2-4252-837c-38025d7e60ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0633550252abff0a4c4c959e/javablobappendblockacfail133757c0d4d11bcc684017?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", + "x-ms-client-request-id" : "d074c614-73a7-49d4-81e5-5686ba7a42b1", + "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" : "b92a8f2f-d01e-009e-42e5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92a8f2f-d01e-009e-42e5-644931000000\nTime:2019-09-06T18:59:52.5960671Z", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "d074c614-73a7-49d4-81e5-5686ba7a42b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "780c590c-a06d-4827-a39a-5bb323afac9d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8f56-d01e-009e-5fe5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail0633550252abff0a4c4c959eFri, 06 Sep 2019 18:59:52 GMT\"0x8D732FC663F5979\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "780c590c-a06d-4827-a39a-5bb323afac9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0633550252abff0a4c4c959e?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" : "3419a514-45d7-4e35-a580-d19b999f1ba6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8f7c-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "3419a514-45d7-4e35-a580-d19b999f1ba6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail0633550252abff0a4c4c959e", "javablobappendblockacfail133757c0d4d11bcc684017" ] +} \ 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..13e573803086 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail01364424e1d7a33f424e7d9d?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" : "9450573a-27cd-4608-bb13-eda7859ce943" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC666400E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8fa1-d01e-009e-22e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "9450573a-27cd-4608-bb13-eda7859ce943" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail01364424e1d7a33f424e7d9d/javablobappendblockacfail141310838f65790ffd454a", + "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" : "59668e36-263a-4cd7-85bf-325c618c9d17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC666A089C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8fd2-d01e-009e-48e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "59668e36-263a-4cd7-85bf-325c618c9d17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail01364424e1d7a33f424e7d9d/javablobappendblockacfail141310838f65790ffd454a?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", + "x-ms-client-request-id" : "101a9687-e9bf-48c3-bbcf-82f59638c632", + "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" : "b92a901b-d01e-009e-80e5-644931000000", + "Body" : "AppendPositionConditionNotMetThe append position condition specified was not met.\nRequestId:b92a901b-d01e-009e-80e5-644931000000\nTime:2019-09-06T18:59:52.8422876Z", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "101a9687-e9bf-48c3-bbcf-82f59638c632", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4e68accc-fbb8-460e-8693-f1cb64bccab5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a9035-d01e-009e-17e5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail01364424e1d7a33f424e7d9dFri, 06 Sep 2019 18:59:52 GMT\"0x8D732FC666400E5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "4e68accc-fbb8-460e-8693-f1cb64bccab5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail01364424e1d7a33f424e7d9d?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" : "69dc000b-a0af-422a-9952-aa253f4dda43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a9066-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "69dc000b-a0af-422a-9952-aa253f4dda43" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail01364424e1d7a33f424e7d9d", "javablobappendblockacfail141310838f65790ffd454a" ] +} \ 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..db4e648220f6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0688223849348084bc4b9ca2?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" : "b59d5dae-04ab-475f-8ac9-85c3171afe4f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC668CEF02\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a9096-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "b59d5dae-04ab-475f-8ac9-85c3171afe4f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0688223849348084bc4b9ca2/javablobappendblockacfail15046811c300c0e82741f4", + "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" : "8b31fad0-e70a-43d9-8f1d-ce205a670a60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6692F715\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a90b6-d01e-009e-7ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "8b31fad0-e70a-43d9-8f1d-ce205a670a60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0688223849348084bc4b9ca2/javablobappendblockacfail15046811c300c0e82741f4?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", + "x-ms-client-request-id" : "2ee5f4f0-858d-452e-aecd-78a9dc53756a", + "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" : "b92a90ec-d01e-009e-25e5-644931000000", + "Body" : "MaxBlobSizeConditionNotMetThe max blob size condition specified was not met.\nRequestId:b92a90ec-d01e-009e-25e5-644931000000\nTime:2019-09-06T18:59:53.0815016Z", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "2ee5f4f0-858d-452e-aecd-78a9dc53756a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d49c8d15-d498-4c6f-a462-be9a06616d93" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a9156-d01e-009e-7ce5-644931000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail0688223849348084bc4b9ca2Fri, 06 Sep 2019 18:59:52 GMT\"0x8D732FC668CEF02\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "d49c8d15-d498-4c6f-a462-be9a06616d93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0688223849348084bc4b9ca2?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" : "3d4f9e81-d690-44f2-b338-bee4ca13a7a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a9175-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:52 GMT", + "x-ms-client-request-id" : "3d4f9e81-d690-44f2-b338-bee4ca13a7a6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail0688223849348084bc4b9ca2", "javablobappendblockacfail15046811c300c0e82741f4" ] +} \ 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..777d34a28a5f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults086268c2696b12e8f040f68?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" : "624a4e2d-af93-4255-b373-88b7cf56f8d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6348ED4B\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d139bb-201e-012e-18e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "624a4e2d-af93-4255-b373-88b7cf56f8d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults086268c2696b12e8f040f68/javablobappendblockdefaults1074091f7b33374804486", + "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" : "52b879d7-c64b-46a6-b44a-adaf46081d4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC634FD704\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d139c4-201e-012e-1fe5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "52b879d7-c64b-46a6-b44a-adaf46081d4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults086268c2696b12e8f040f68/javablobappendblockdefaults1074091f7b33374804486?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", + "x-ms-client-request-id" : "dc84176b-a9a6-48da-9e86-c1997f915671", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "ETag" : "\"0x8D732FC63597637\"", + "Content-Length" : "0", + "x-ms-request-id" : "94d139d7-201e-012e-30e5-64f6e4000000", + "x-ms-client-request-id" : "dc84176b-a9a6-48da-9e86-c1997f915671", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults086268c2696b12e8f040f68/javablobappendblockdefaults1074091f7b33374804486", + "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" : "41cfcf41-8d6e-4bc7-9700-4352079e0577" + }, + "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" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC63597637\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "94d139e6-201e-012e-3de5-64f6e4000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "41cfcf41-8d6e-4bc7-9700-4352079e0577", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults086268c2696b12e8f040f68/javablobappendblockdefaults1074091f7b33374804486", + "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" : "fa54ce70-40cf-4a20-a2f9-752b1f084b02" + }, + "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" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:46 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" : "\"0x8D732FC63597637\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "94d139ee-201e-012e-45e5-64f6e4000000", + "x-ms-client-request-id" : "fa54ce70-40cf-4a20-a2f9-752b1f084b02", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c5218bf-3c7e-48d7-8997-6d80ea54bba4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d139f6-201e-012e-4de5-64f6e4000000", + "Body" : "jtcappendblockdefaultsjtcappendblockdefaults086268c2696b12e8f040f68Fri, 06 Sep 2019 18:59:47 GMT\"0x8D732FC6348ED4B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "4c5218bf-3c7e-48d7-8997-6d80ea54bba4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults086268c2696b12e8f040f68?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" : "6e6ebea4-ad28-45b4-9aba-a2c63a6aecd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d139fe-201e-012e-54e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "6e6ebea4-ad28-45b4-9aba-a2c63a6aecd5" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockdefaults086268c2696b12e8f040f68", "javablobappendblockdefaults1074091f7b33374804486" ] +} \ 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..d447617c46ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody056546838e66bf5ef349f1b?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" : "2440014a-fbd8-41c1-808f-bfad2b36bde4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC640699EC\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a816b-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "2440014a-fbd8-41c1-808f-bfad2b36bde4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody056546838e66bf5ef349f1b/javablobappendblockemptybody188372f2436d9a40ac45", + "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" : "396f00c8-77ab-4491-8bfa-f3ac48a8a359" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC640D6095\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a818d-d01e-009e-13e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "396f00c8-77ab-4491-8bfa-f3ac48a8a359" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody056546838e66bf5ef349f1b/javablobappendblockemptybody188372f2436d9a40ac45?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", + "x-ms-client-request-id" : "e07c5c64-69d7-493f-a78f-b2f7b5866191", + "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" : "b92a81af-d01e-009e-33e5-644931000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b92a81af-d01e-009e-33e5-644931000000\nTime:2019-09-06T18:59:48.8346897ZContent-Length0", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "e07c5c64-69d7-493f-a78f-b2f7b5866191", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f1f2ba55-9fcb-4b2e-9397-608375e1f4e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a81c4-d01e-009e-48e5-644931000000", + "Body" : "jtcappendblockemptybodyjtcappendblockemptybody056546838e66bf5ef349f1bFri, 06 Sep 2019 18:59:48 GMT\"0x8D732FC640699EC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "f1f2ba55-9fcb-4b2e-9397-608375e1f4e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody056546838e66bf5ef349f1b?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" : "11b3dd9d-8864-4a11-90b1-8c247d0bd2b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a81e0-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "11b3dd9d-8864-4a11-90b1-8c247d0bd2b2" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockemptybody056546838e66bf5ef349f1b", "javablobappendblockemptybody188372f2436d9a40ac45" ] +} \ 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..b6a4adb9df03 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerror6a9071988?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" : "2d430edf-874c-4d34-8589-64b24378f84e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC66B1211C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a91af-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "2d430edf-874c-4d34-8589-64b24378f84e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerror6a9071988/javablobappendblockerror108085bdc66b0780e041f5", + "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" : "33ccd381-7f48-4b3a-9ab4-7076c28ecc62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC66BF41BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a9203-d01e-009e-0fe5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "33ccd381-7f48-4b3a-9ab4-7076c28ecc62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerror6a9071988/javablobappendblockerror256987122fd258fcfd4145?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", + "x-ms-client-request-id" : "d19a6a82-391a-4a15-9d93-34e1e42fb5b8", + "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" : "b92a922f-d01e-009e-34e5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92a922f-d01e-009e-34e5-644931000000\nTime:2019-09-06T18:59:53.3617531Z", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "d19a6a82-391a-4a15-9d93-34e1e42fb5b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96a3b3ef-366e-4ac1-862b-ba21df41f357" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a9250-d01e-009e-52e5-644931000000", + "Body" : "jtcappendblockerrorjtcappendblockerror0appendblobapitestappendblockerror6a9071988Fri, 06 Sep 2019 18:59:53 GMT\"0x8D732FC66B1211C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "96a3b3ef-366e-4ac1-862b-ba21df41f357", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerror6a9071988?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" : "519823a7-abf1-47b8-847d-ba211fd0ab53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a9272-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "519823a7-abf1-47b8-847d-ba211fd0ab53" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockerror0appendblobapitestappendblockerror6a9071988", "javablobappendblockerror108085bdc66b0780e041f5", "javablobappendblockerror256987122fd258fcfd4145" ] +} \ 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..5ef88d93a303 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c?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" : "9c36b59e-f036-426b-9cba-bdc4bf269f16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6E7882A6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abf1d-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "9c36b59e-f036-426b-9cba-bdc4bf269f16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c/javablobappendblockfromurlacdestinationfail17759600e00be", + "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" : "b32a0c0e-1e7a-44d8-be9d-976b6a15780f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6E97F50B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac016-d01e-009e-1ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "b32a0c0e-1e7a-44d8-be9d-976b6a15780f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f352d258-109e-407f-820e-1abc1745e1dc", + "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" : "\"0x8D732FC6E9F8C14\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac03a-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "f352d258-109e-407f-820e-1abc1745e1dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c/javablobappendblockfromurlacdestinationfail286955e3554fe", + "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" : "54b9baed-f06e-4a95-a3d2-858a77319012" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6EA5B3E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac06b-d01e-009e-6be5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "54b9baed-f06e-4a95-a3d2-858a77319012" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c/javablobappendblockfromurlacdestinationfail286955e3554fe?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", + "x-ms-client-request-id" : "ccf9a83f-ee10-49f6-8e78-3963a208e586", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "ETag" : "\"0x8D732FC6EABCFDA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac099-d01e-009e-12e5-644931000000", + "x-ms-client-request-id" : "ccf9a83f-ee10-49f6-8e78-3963a208e586", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c/javablobappendblockfromurlacdestinationfail17759600e00be?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", + "x-ms-client-request-id" : "2bbe81e6-0a22-47bb-99c6-9717f2df8b03" + }, + "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" : "b92ac0c3-d01e-009e-39e5-644931000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ac0c3-d01e-009e-39e5-644931000000\nTime:2019-09-06T19:00:06.6626918Z", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "2bbe81e6-0a22-47bb-99c6-9717f2df8b03", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "17019a7b-ea21-4b8d-a2ab-b0eab143317b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac0ec-d01e-009e-5de5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail08734675d71623cFri, 06 Sep 2019 19:00:06 GMT\"0x8D732FC6E9F8C14\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "17019a7b-ea21-4b8d-a2ab-b0eab143317b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08734675d71623c?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" : "07233de6-6cec-40fd-9526-82bb0bcb5cd8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ac115-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "07233de6-6cec-40fd-9526-82bb0bcb5cd8" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail08734675d71623c", "javablobappendblockfromurlacdestinationfail17759600e00be", "javablobappendblockfromurlacdestinationfail286955e3554fe" ] +} \ 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..326422662017 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66?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" : "f030945f-c077-411a-8847-66ef6624c997" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6ECC8249\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac14b-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "f030945f-c077-411a-8847-66ef6624c997" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66/javablobappendblockfromurlacdestinationfail1166713260fa1", + "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" : "990135ef-dabb-40a3-9445-6da97046238e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6ED6454E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac1b1-d01e-009e-11e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "990135ef-dabb-40a3-9445-6da97046238e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3829a775-319c-4dae-8078-c5204c05f5fa", + "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" : "\"0x8D732FC6EDD8E71\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac1e8-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "3829a775-319c-4dae-8078-c5204c05f5fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66/javablobappendblockfromurlacdestinationfail2263306b6b799", + "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" : "a2229fb6-4353-4d80-b983-02c9639315d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6EE47980\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac213-d01e-009e-6be5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "a2229fb6-4353-4d80-b983-02c9639315d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66/javablobappendblockfromurlacdestinationfail2263306b6b799?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", + "x-ms-client-request-id" : "daf0999d-84f8-4716-b26d-0416b3bd222b", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "ETag" : "\"0x8D732FC6EF14DCD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac26d-d01e-009e-3de5-644931000000", + "x-ms-client-request-id" : "daf0999d-84f8-4716-b26d-0416b3bd222b", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66/javablobappendblockfromurlacdestinationfail1166713260fa1?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", + "x-ms-client-request-id" : "c667ff0c-f436-42d4-83df-ec9079039e1e" + }, + "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" : "b92ac2a2-d01e-009e-6fe5-644931000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ac2a2-d01e-009e-6fe5-644931000000\nTime:2019-09-06T19:00:07.1180999Z", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "c667ff0c-f436-42d4-83df-ec9079039e1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "21363f25-c53e-493c-bd1b-19d5dc8a9b70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac2d2-d01e-009e-1be5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail08650247aeb5a66Fri, 06 Sep 2019 19:00:06 GMT\"0x8D732FC6EDD8E71\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "21363f25-c53e-493c-bd1b-19d5dc8a9b70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail08650247aeb5a66?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" : "9ccb4e8c-6846-4b6f-8233-232f3d79efcd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ac2f5-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "9ccb4e8c-6846-4b6f-8233-232f3d79efcd" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail08650247aeb5a66", "javablobappendblockfromurlacdestinationfail1166713260fa1", "javablobappendblockfromurlacdestinationfail2263306b6b799" ] +} \ 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..86f2a762df75 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131?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" : "404cdb24-f0f7-405d-8ae6-1959fa441337" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F0C0AD5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac33f-d01e-009e-72e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "404cdb24-f0f7-405d-8ae6-1959fa441337" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131/javablobappendblockfromurlacdestinationfail177619fd0f64b", + "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" : "89af6ed9-7b62-4f5c-9b3e-4eeb9ff8731e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F12723D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac372-d01e-009e-14e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "89af6ed9-7b62-4f5c-9b3e-4eeb9ff8731e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ff0ac746-40f9-413a-a8d9-24f634f81889", + "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" : "\"0x8D732FC6F185BAF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac3a5-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "ff0ac746-40f9-413a-a8d9-24f634f81889" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131/javablobappendblockfromurlacdestinationfail233227c2d9835", + "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" : "cdfc92cd-f3a0-4b32-a1eb-0fab05a02b90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F1E8304\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac3d4-d01e-009e-5ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "cdfc92cd-f3a0-4b32-a1eb-0fab05a02b90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131/javablobappendblockfromurlacdestinationfail233227c2d9835?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", + "x-ms-client-request-id" : "51578d0c-7452-4158-a543-9a0a5367c035", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "ETag" : "\"0x8D732FC6F24ED30\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac3fa-d01e-009e-7ce5-644931000000", + "x-ms-client-request-id" : "51578d0c-7452-4158-a543-9a0a5367c035", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131/javablobappendblockfromurlacdestinationfail177619fd0f64b?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", + "x-ms-client-request-id" : "4ddffcdf-7530-43d9-bc53-76fee8c68ef8" + }, + "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" : "b92ac423-d01e-009e-1ce5-644931000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ac423-d01e-009e-1ce5-644931000000\nTime:2019-09-06T19:00:07.4403881Z", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "4ddffcdf-7530-43d9-bc53-76fee8c68ef8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2f610240-d64a-4c60-b774-f616f8c56453" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac43d-d01e-009e-35e5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail09678667db8c131Fri, 06 Sep 2019 19:00:07 GMT\"0x8D732FC6F185BAF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "2f610240-d64a-4c60-b774-f616f8c56453", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail09678667db8c131?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" : "00fbdb7d-8787-4493-b232-27bac0f81b31" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ac45b-d01e-009e-4ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "00fbdb7d-8787-4493-b232-27bac0f81b31" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail09678667db8c131", "javablobappendblockfromurlacdestinationfail177619fd0f64b", "javablobappendblockfromurlacdestinationfail233227c2d9835" ] +} \ 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..2cd6b7b667d3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1?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" : "7637f546-edbf-45b6-83d4-4100c620628b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F42DEE7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac48d-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "7637f546-edbf-45b6-83d4-4100c620628b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1/javablobappendblockfromurlacdestinationfail1207586f79e56", + "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" : "62386cb2-b157-4a57-8c39-23778a8bb94f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F54BB2A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac50d-d01e-009e-5ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "62386cb2-b157-4a57-8c39-23778a8bb94f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "92c67bea-aaf9-4afe-b3ef-19999fbb1e41", + "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" : "\"0x8D732FC6F5ACBD4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac537-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "92c67bea-aaf9-4afe-b3ef-19999fbb1e41" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1/javablobappendblockfromurlacdestinationfail1207586f79e56", + "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" : "dc56a864-067d-421e-8078-65e524e1d4c6" + }, + "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" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:07 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" : "\"0x8D732FC6F54BB2A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:07 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac573-d01e-009e-2be5-644931000000", + "x-ms-client-request-id" : "dc56a864-067d-421e-8078-65e524e1d4c6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1/javablobappendblockfromurlacdestinationfail299815a89a53c", + "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" : "aa433652-f3cb-443b-b5a9-1d90e2fde191" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F65FD5C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac59e-d01e-009e-4ee5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "aa433652-f3cb-443b-b5a9-1d90e2fde191" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1/javablobappendblockfromurlacdestinationfail299815a89a53c?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", + "x-ms-client-request-id" : "a997cfd9-a1c0-450a-808e-f74fc02d6928", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "ETag" : "\"0x8D732FC6F6C406F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac5c4-d01e-009e-6ee5-644931000000", + "x-ms-client-request-id" : "a997cfd9-a1c0-450a-808e-f74fc02d6928", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1/javablobappendblockfromurlacdestinationfail1207586f79e56?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", + "x-ms-client-request-id" : "5fa747c3-bce8-4417-999f-db98c0b7c242" + }, + "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" : "b92ac5dc-d01e-009e-03e5-644931000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ac5dc-d01e-009e-03e5-644931000000\nTime:2019-09-06T19:00:07.9238208Z", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "5fa747c3-bce8-4417-999f-db98c0b7c242", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "65248d45-b9bd-4c01-8cf5-18446e966162" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac600-d01e-009e-21e5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail02280387b2cdcf1Fri, 06 Sep 2019 19:00:07 GMT\"0x8D732FC6F5ACBD4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "65248d45-b9bd-4c01-8cf5-18446e966162", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02280387b2cdcf1?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" : "88f21298-7c65-41fc-9551-2a168048979f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ac616-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "88f21298-7c65-41fc-9551-2a168048979f" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail02280387b2cdcf1", "javablobappendblockfromurlacdestinationfail1207586f79e56", "javablobappendblockfromurlacdestinationfail299815a89a53c" ] +} \ 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..33f48b668f12 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098?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" : "3c990b55-4f79-4616-8dda-64175ad97384" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F84B1E8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac646-d01e-009e-5ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "3c990b55-4f79-4616-8dda-64175ad97384" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098/javablobappendblockfromurlacdestinationfail104025ab74b79", + "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" : "b5f97e2d-d2b9-4f93-ad43-503b946e5aa1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F8AA51F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac671-d01e-009e-7ae5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "b5f97e2d-d2b9-4f93-ad43-503b946e5aa1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "745390c6-6508-4fec-b68a-efb5be0695ab", + "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" : "\"0x8D732FC6F901982\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac699-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "745390c6-6508-4fec-b68a-efb5be0695ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098/javablobappendblockfromurlacdestinationfail104025ab74b79?comp=lease", + "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" : "799b411a-0290-4839-84e6-0aa431389298" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F8AA51F\"", + "x-ms-lease-id" : "4b7a939c-e7b0-41cc-9bb6-338acfcfdc1c", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac6bc-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "799b411a-0290-4839-84e6-0aa431389298" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098/javablobappendblockfromurlacdestinationfail24959469aa068", + "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" : "622ead97-c02c-4714-965d-fd59c4d95bb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6F9AD59E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac6e8-d01e-009e-5de5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:07 GMT", + "x-ms-client-request-id" : "622ead97-c02c-4714-965d-fd59c4d95bb3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098/javablobappendblockfromurlacdestinationfail24959469aa068?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", + "x-ms-client-request-id" : "feafcd1d-e9ee-4f7d-901d-32fbe8035647", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "ETag" : "\"0x8D732FC6FA0CA79\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac712-d01e-009e-01e5-644931000000", + "x-ms-client-request-id" : "feafcd1d-e9ee-4f7d-901d-32fbe8035647", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098/javablobappendblockfromurlacdestinationfail104025ab74b79?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", + "x-ms-client-request-id" : "364a83d8-2c8b-4447-afac-2cd61e272912" + }, + "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" : "b92ac73e-d01e-009e-2ce5-644931000000", + "Body" : "\nLeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92ac73e-d01e-009e-2ce5-644931000000\nTime:2019-09-06T19:00:08.2621242Z", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "364a83d8-2c8b-4447-afac-2cd61e272912", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "47640ae5-7a10-4a16-b8f3-7eeb5f1a11ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac779-d01e-009e-5fe5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0384450528c4098Fri, 06 Sep 2019 19:00:08 GMT\"0x8D732FC6F901982\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "47640ae5-7a10-4a16-b8f3-7eeb5f1a11ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0384450528c4098?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" : "f30ebce6-f351-4c35-b429-6bcb903bb841" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ac798-d01e-009e-7de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "f30ebce6-f351-4c35-b429-6bcb903bb841" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0384450528c4098", "javablobappendblockfromurlacdestinationfail104025ab74b79", "javablobappendblockfromurlacdestinationfail24959469aa068" ] +} \ 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..d253eab33048 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e?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" : "b03f45f6-0adc-4d2b-91ea-9b00aa3cf4da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6FB829C5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac7c7-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "b03f45f6-0adc-4d2b-91ea-9b00aa3cf4da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e/javablobappendblockfromurlacdestinationfail153979ef6c1de", + "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" : "e8539f23-fbe1-4650-8774-f358d9acdbe3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6FBE4496\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac7ee-d01e-009e-4ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "e8539f23-fbe1-4650-8774-f358d9acdbe3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8669f22c-1b98-45e4-98df-f304d9ec3100", + "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" : "\"0x8D732FC6FC42E6F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac816-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "8669f22c-1b98-45e4-98df-f304d9ec3100" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e/javablobappendblockfromurlacdestinationfail21200321e1921", + "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" : "693e99b0-3bec-4f01-b90e-7f50e298e4b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6FC9E017\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac83b-d01e-009e-08e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "693e99b0-3bec-4f01-b90e-7f50e298e4b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e/javablobappendblockfromurlacdestinationfail21200321e1921?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", + "x-ms-client-request-id" : "b3e48737-7b31-4c1a-a97d-f46d4527bc29", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "ETag" : "\"0x8D732FC6FD04A43\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac85f-d01e-009e-28e5-644931000000", + "x-ms-client-request-id" : "b3e48737-7b31-4c1a-a97d-f46d4527bc29", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e/javablobappendblockfromurlacdestinationfail153979ef6c1de?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", + "x-ms-client-request-id" : "f52eb694-bbd5-4d2c-b27b-a30fd26433d2" + }, + "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" : "b92ac89f-d01e-009e-63e5-644931000000", + "Body" : "\nAppendPositionConditionNotMetThe append position condition specified was not met.\nRequestId:b92ac89f-d01e-009e-63e5-644931000000\nTime:2019-09-06T19:00:08.5994283Z", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "f52eb694-bbd5-4d2c-b27b-a30fd26433d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7260a7a1-24cd-4ca1-9f0a-94775c98325e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac8c4-d01e-009e-06e5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0148563cf4ab34eFri, 06 Sep 2019 19:00:08 GMT\"0x8D732FC6FC42E6F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "7260a7a1-24cd-4ca1-9f0a-94775c98325e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0148563cf4ab34e?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" : "20f8b930-0273-4590-bfa9-d88fd5699981" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ac8fd-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "20f8b930-0273-4590-bfa9-d88fd5699981" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0148563cf4ab34e", "javablobappendblockfromurlacdestinationfail153979ef6c1de", "javablobappendblockfromurlacdestinationfail21200321e1921" ] +} \ 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..9788d6f41bb9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12?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" : "3f4cfb1e-468a-400b-9628-b76120ca0975" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6FEE617D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac939-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "3f4cfb1e-468a-400b-9628-b76120ca0975" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12/javablobappendblockfromurlacdestinationfail179286cb311ff", + "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" : "c296402f-7aea-4829-be9f-e566a29bc370" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6FF4CAD6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac967-d01e-009e-16e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "c296402f-7aea-4829-be9f-e566a29bc370" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e0325ad3-b0a0-4176-a782-1673b95db3c7", + "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" : "\"0x8D732FC6FFA3F9B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ac98e-d01e-009e-34e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "e0325ad3-b0a0-4176-a782-1673b95db3c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12/javablobappendblockfromurlacdestinationfail2779315119f1a", + "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" : "13fb6dc1-a35c-44c7-87e7-93f0ef29bfb8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6FFFA2DC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ac9b4-d01e-009e-53e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "13fb6dc1-a35c-44c7-87e7-93f0ef29bfb8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12/javablobappendblockfromurlacdestinationfail2779315119f1a?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", + "x-ms-client-request-id" : "65483024-8350-4ee3-95d2-ff74c7a5de4d", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "ETag" : "\"0x8D732FC7006D07F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ac9e3-d01e-009e-7ce5-644931000000", + "x-ms-client-request-id" : "65483024-8350-4ee3-95d2-ff74c7a5de4d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12/javablobappendblockfromurlacdestinationfail179286cb311ff?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", + "x-ms-client-request-id" : "47318d7d-67ff-4e7b-a071-43758db6512f" + }, + "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" : "b92aca18-d01e-009e-29e5-644931000000", + "Body" : "\nMaxBlobSizeConditionNotMetThe max blob size condition specified was not met.\nRequestId:b92aca18-d01e-009e-29e5-644931000000\nTime:2019-09-06T19:00:08.9347315Z", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "47318d7d-67ff-4e7b-a071-43758db6512f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f09666df-9aa1-435c-bb73-acc64a8df2fd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aca3e-d01e-009e-4be5-644931000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail090190639a32d12Fri, 06 Sep 2019 19:00:08 GMT\"0x8D732FC6FFA3F9B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "f09666df-9aa1-435c-bb73-acc64a8df2fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail090190639a32d12?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" : "0d45670a-bfe5-4843-94ea-9b67c4ef3a47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aca5a-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "0d45670a-bfe5-4843-94ea-9b67c4ef3a47" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail090190639a32d12", "javablobappendblockfromurlacdestinationfail179286cb311ff", "javablobappendblockfromurlacdestinationfail2779315119f1a" ] +} \ 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..492fadbf85b6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e?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" : "9d33c251-bf7a-4627-bd64-8da0669c9a74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC716811C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad26e-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "9d33c251-bf7a-4627-bd64-8da0669c9a74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e/javablobappendblockfromurlacsourcefail119466c0610c212", + "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" : "b1df637e-e2c6-43fe-abc4-e9254277438e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC716E7E1C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad29b-d01e-009e-0ee5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "b1df637e-e2c6-43fe-abc4-e9254277438e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8854d72e-cc5f-4341-b854-515a44138ae2", + "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" : "\"0x8D732FC7174DEE9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad2c1-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "8854d72e-cc5f-4341-b854-515a44138ae2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e/javablobappendblockfromurlacsourcefail20823232f5ebc27", + "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" : "7207b0b0-cb54-43b8-bb4c-1bb3e046d2eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC717A67D0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad2f1-d01e-009e-58e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "7207b0b0-cb54-43b8-bb4c-1bb3e046d2eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e/javablobappendblockfromurlacsourcefail20823232f5ebc27?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", + "x-ms-client-request-id" : "d2f52679-1d80-4b95-80b7-78e959a893e8", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "ETag" : "\"0x8D732FC717FE75F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad31b-d01e-009e-7ee5-644931000000", + "x-ms-client-request-id" : "d2f52679-1d80-4b95-80b7-78e959a893e8", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e/javablobappendblockfromurlacsourcefail119466c0610c212?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", + "x-ms-client-request-id" : "64e8c505-f375-4f52-af73-0a014c96873c" + }, + "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" : "b92ad331-d01e-009e-13e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "64e8c505-f375-4f52-af73-0a014c96873c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a4bdc02d-459f-49fb-aaae-50609d368e5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad353-d01e-009e-33e5-644931000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail095074b7994019c37eFri, 06 Sep 2019 19:00:11 GMT\"0x8D732FC7174DEE9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "a4bdc02d-459f-49fb-aaae-50609d368e5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail095074b7994019c37e?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" : "1de2641d-c2e2-4a74-b3cc-18391d500b93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad383-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "1de2641d-c2e2-4a74-b3cc-18391d500b93" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail095074b7994019c37e", "javablobappendblockfromurlacsourcefail119466c0610c212", "javablobappendblockfromurlacsourcefail20823232f5ebc27" ] +} \ 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..f322a32b4180 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a?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" : "2b6eb6af-7f47-4258-b0c3-1a4072acf353" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC71A501C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad3b4-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "2b6eb6af-7f47-4258-b0c3-1a4072acf353" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a/javablobappendblockfromurlacsourcefail19916036e7ea957", + "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" : "8aed1606-a39e-4877-b5f1-6fd29eb9599d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC71B55BF0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad448-d01e-009e-7fe5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "8aed1606-a39e-4877-b5f1-6fd29eb9599d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "963245fe-9e9b-4eb6-98d3-ac7e987b214d", + "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" : "\"0x8D732FC71C44AA2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad4a7-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "963245fe-9e9b-4eb6-98d3-ac7e987b214d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a/javablobappendblockfromurlacsourcefail273158fa679e0de", + "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" : "b9b1a61e-abe1-460f-8746-145604aaa77e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC71CAE4DB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad4df-d01e-009e-05e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "b9b1a61e-abe1-460f-8746-145604aaa77e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a/javablobappendblockfromurlacsourcefail273158fa679e0de?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", + "x-ms-client-request-id" : "5f301a72-0968-4244-9e47-bc7f0066410b", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "ETag" : "\"0x8D732FC71D08B86\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad4fc-d01e-009e-22e5-644931000000", + "x-ms-client-request-id" : "5f301a72-0968-4244-9e47-bc7f0066410b", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a/javablobappendblockfromurlacsourcefail19916036e7ea957?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", + "x-ms-client-request-id" : "563b544c-c504-4749-bc0f-5b93f31abaf9" + }, + "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" : "b92ad51e-d01e-009e-3de5-644931000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:b92ad51e-d01e-009e-3de5-644931000000\nTime:2019-09-06T19:00:11.9874714Z", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "563b544c-c504-4749-bc0f-5b93f31abaf9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "74bb8459-89df-47bd-98fc-c85a7391db40" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad572-d01e-009e-0ae5-644931000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail085463552e97b4d58aFri, 06 Sep 2019 19:00:11 GMT\"0x8D732FC71C44AA2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "74bb8459-89df-47bd-98fc-c85a7391db40", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail085463552e97b4d58a?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" : "6f6fe4e1-88b2-4bf9-9e75-e24f3382d870" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad594-d01e-009e-26e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "6f6fe4e1-88b2-4bf9-9e75-e24f3382d870" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail085463552e97b4d58a", "javablobappendblockfromurlacsourcefail19916036e7ea957", "javablobappendblockfromurlacsourcefail273158fa679e0de" ] +} \ 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..57fb95fe94fd --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542?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" : "673f9023-b33e-4895-acb2-52cf4e89a5ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC71F15EA9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad5ca-d01e-009e-57e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "673f9023-b33e-4895-acb2-52cf4e89a5ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542/javablobappendblockfromurlacsourcefail1163712d8c64f95", + "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" : "efbad294-6b9e-4029-b7c7-bede598c9e02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC71F7CC05\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad5ec-d01e-009e-75e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "efbad294-6b9e-4029-b7c7-bede598c9e02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5596991a-9750-43aa-a713-3922eadf6410", + "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" : "\"0x8D732FC71FDB80C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad61c-d01e-009e-1ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:11 GMT", + "x-ms-client-request-id" : "5596991a-9750-43aa-a713-3922eadf6410" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542/javablobappendblockfromurlacsourcefail2209519a789046c", + "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" : "2538a6ef-cd7d-4af8-ae21-0938d6e66d7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7203DCB0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad649-d01e-009e-46e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "2538a6ef-cd7d-4af8-ae21-0938d6e66d7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542/javablobappendblockfromurlacsourcefail2209519a789046c?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", + "x-ms-client-request-id" : "46319b0b-f05c-40b9-be4f-2fa0cb75ddf5", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "ETag" : "\"0x8D732FC720A46DC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad672-d01e-009e-6ce5-644931000000", + "x-ms-client-request-id" : "46319b0b-f05c-40b9-be4f-2fa0cb75ddf5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542/javablobappendblockfromurlacsourcefail1163712d8c64f95?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", + "x-ms-client-request-id" : "2f3763a7-68f0-4700-b5d1-9572f018592a" + }, + "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" : "b92ad697-d01e-009e-0fe5-644931000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:b92ad697-d01e-009e-0fe5-644931000000\nTime:2019-09-06T19:00:12.3047576Z", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "2f3763a7-68f0-4700-b5d1-9572f018592a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9ce03349-2342-473b-b843-e67344c8318b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad6b9-d01e-009e-30e5-644931000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail01672818481a577542Fri, 06 Sep 2019 19:00:12 GMT\"0x8D732FC71FDB80C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "9ce03349-2342-473b-b843-e67344c8318b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01672818481a577542?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" : "48d6b0a4-b400-42d2-8c20-22e6c8ee2a74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad6d6-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "48d6b0a4-b400-42d2-8c20-22e6c8ee2a74" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail01672818481a577542", "javablobappendblockfromurlacsourcefail1163712d8c64f95", "javablobappendblockfromurlacsourcefail2209519a789046c" ] +} \ 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..8b9a6631809c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8?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" : "ca8186c7-86a4-49b3-9c50-6963a99a8839" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC72223DE8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad6f9-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "ca8186c7-86a4-49b3-9c50-6963a99a8839" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8/javablobappendblockfromurlacsourcefail1854774e851d8bf", + "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" : "6a125831-4fc0-479d-8bcd-bff44c961d47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC72280F20\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad715-d01e-009e-80e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "6a125831-4fc0-479d-8bcd-bff44c961d47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9733075c-75ac-4c54-abf8-010fa34924ea", + "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" : "\"0x8D732FC722D8627\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad738-d01e-009e-1fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "9733075c-75ac-4c54-abf8-010fa34924ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8/javablobappendblockfromurlacsourcefail231185c2baea448", + "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" : "175c6994-31f8-4637-bb23-101c277f570b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC72335C6F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad75a-d01e-009e-3ee5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "175c6994-31f8-4637-bb23-101c277f570b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8/javablobappendblockfromurlacsourcefail231185c2baea448?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", + "x-ms-client-request-id" : "c1441adc-6fa7-4e78-a3d1-6f9632296413", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "ETag" : "\"0x8D732FC7239514C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad780-d01e-009e-61e5-644931000000", + "x-ms-client-request-id" : "c1441adc-6fa7-4e78-a3d1-6f9632296413", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8/javablobappendblockfromurlacsourcefail231185c2baea448", + "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" : "63855c0d-2e24-4804-bf7c-6719c1822e01" + }, + "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" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:12 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" : "\"0x8D732FC7239514C\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ad79c-d01e-009e-7be5-644931000000", + "x-ms-client-request-id" : "63855c0d-2e24-4804-bf7c-6719c1822e01", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8/javablobappendblockfromurlacsourcefail1854774e851d8bf?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", + "x-ms-client-request-id" : "85eb5d8c-35b5-4e8d-b014-f3dc24ae2838" + }, + "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" : "b92ad7f7-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "85eb5d8c-35b5-4e8d-b014-f3dc24ae2838" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cb125284-0049-4fac-bef7-c065110e1215" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad814-d01e-009e-61e5-644931000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail06002774ffd65a4aa8Fri, 06 Sep 2019 19:00:12 GMT\"0x8D732FC722D8627\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "cb125284-0049-4fac-bef7-c065110e1215", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail06002774ffd65a4aa8?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" : "0574aab2-948e-4535-876d-a9cc29d4d430" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad82b-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "0574aab2-948e-4535-876d-a9cc29d4d430" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail06002774ffd65a4aa8", "javablobappendblockfromurlacsourcefail1854774e851d8bf", "javablobappendblockfromurlacsourcefail231185c2baea448" ] +} \ 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..8a0caeff981a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90?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" : "d92d8def-352e-4579-9a7b-06076932d16c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C3427D6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab088-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "d92d8def-352e-4579-9a7b-06076932d16c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90/javablobappendblockfromurldestinationac146945418a4a5c1", + "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" : "e337c4f3-93fe-47f8-9a17-61f9f26d0c41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C3A3B4C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab0b5-d01e-009e-3ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "e337c4f3-93fe-47f8-9a17-61f9f26d0c41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f23b8962-9d04-4390-9d93-6660502361e8", + "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" : "\"0x8D732FC6C4048DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab0e3-d01e-009e-68e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "f23b8962-9d04-4390-9d93-6660502361e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90/javablobappendblockfromurldestinationac29017164e6984ab", + "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" : "d6ed4e54-accb-456d-b2ca-547eaaea40ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C47FA34\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab11a-d01e-009e-19e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "d6ed4e54-accb-456d-b2ca-547eaaea40ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90/javablobappendblockfromurldestinationac29017164e6984ab?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", + "x-ms-client-request-id" : "997eb266-14fa-4445-87f1-277df68c8d63", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "ETag" : "\"0x8D732FC6C4E1624\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab139-d01e-009e-37e5-644931000000", + "x-ms-client-request-id" : "997eb266-14fa-4445-87f1-277df68c8d63", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90/javablobappendblockfromurldestinationac146945418a4a5c1?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", + "x-ms-client-request-id" : "98ab5416-2483-4e8a-b407-39948b3ae62d" + }, + "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" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6C593C6A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab186-d01e-009e-7ce5-644931000000", + "x-ms-client-request-id" : "98ab5416-2483-4e8a-b407-39948b3ae62d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2bed5672-8b71-42b7-8ca3-9db4f96a7873" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab1b0-d01e-009e-20e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac020073b99e4c7fb90Fri, 06 Sep 2019 19:00:02 GMT\"0x8D732FC6C4048DE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "2bed5672-8b71-42b7-8ca3-9db4f96a7873", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020073b99e4c7fb90?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" : "e8ddbfbc-8eec-4316-a4ea-e47e7295bdc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ab1ce-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "e8ddbfbc-8eec-4316-a4ea-e47e7295bdc1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac020073b99e4c7fb90", "javablobappendblockfromurldestinationac146945418a4a5c1", "javablobappendblockfromurldestinationac29017164e6984ab" ] +} \ 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..eca85f25a16c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529?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" : "21f3ea13-f7cb-442d-b67a-16e552427b99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C6F69AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab1fb-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "21f3ea13-f7cb-442d-b67a-16e552427b99" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529/javablobappendblockfromurldestinationac17115568e94c897", + "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" : "a81d150a-b03d-4fea-a180-4d4771e12040" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C85D532\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab296-d01e-009e-6ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "a81d150a-b03d-4fea-a180-4d4771e12040" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c60ff1f-a795-4b77-be20-5c06279029f4", + "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" : "\"0x8D732FC6C8B6DC9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab2b8-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "4c60ff1f-a795-4b77-be20-5c06279029f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529/javablobappendblockfromurldestinationac262081b303053c5", + "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" : "8a1466c7-1f1c-4dad-9fa6-513aa6d0ff6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C9197C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab2e4-d01e-009e-32e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "8a1466c7-1f1c-4dad-9fa6-513aa6d0ff6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529/javablobappendblockfromurldestinationac262081b303053c5?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", + "x-ms-client-request-id" : "c3ece051-adbf-45b6-97f7-efc2816c0ddd", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "ETag" : "\"0x8D732FC6C978C9F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab317-d01e-009e-61e5-644931000000", + "x-ms-client-request-id" : "c3ece051-adbf-45b6-97f7-efc2816c0ddd", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529/javablobappendblockfromurldestinationac17115568e94c897?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", + "x-ms-client-request-id" : "d6f56204-5019-4281-91c0-5fcb1dceb7de" + }, + "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" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6CAAA3FF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab34f-d01e-009e-15e5-644931000000", + "x-ms-client-request-id" : "d6f56204-5019-4281-91c0-5fcb1dceb7de", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "83284cf7-986c-4aae-ab06-20129103871a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab3b9-d01e-009e-70e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac068849e8169352529Fri, 06 Sep 2019 19:00:03 GMT\"0x8D732FC6C8B6DC9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "83284cf7-986c-4aae-ab06-20129103871a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068849e8169352529?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" : "55a15048-5065-42ab-965c-7a3823fa75c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ab3da-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "55a15048-5065-42ab-965c-7a3823fa75c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac068849e8169352529", "javablobappendblockfromurldestinationac17115568e94c897", "javablobappendblockfromurldestinationac262081b303053c5" ] +} \ 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..9872afbe4486 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618?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" : "f6d71d31-bd7b-449c-923c-6d7138cfb74f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6CD56ED0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab46f-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "f6d71d31-bd7b-449c-923c-6d7138cfb74f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618/javablobappendblockfromurldestinationac168669a92c9700b", + "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" : "54762844-d03e-4094-b678-25095037f838" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6CDCE37A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab496-d01e-009e-3ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "54762844-d03e-4094-b678-25095037f838" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "928bc61b-ed25-4345-b882-30f7564d83c4", + "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" : "\"0x8D732FC6CE2F1CE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab4bb-d01e-009e-5ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "928bc61b-ed25-4345-b882-30f7564d83c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618/javablobappendblockfromurldestinationac23466393b49468d", + "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" : "f9bfcfca-a770-4d54-a11c-c4897acce9d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6CE9DEE2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab4dc-d01e-009e-7ee5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "f9bfcfca-a770-4d54-a11c-c4897acce9d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618/javablobappendblockfromurldestinationac23466393b49468d?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", + "x-ms-client-request-id" : "c3c3bfce-96bf-4aff-8b7f-b575dee28060", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "ETag" : "\"0x8D732FC6CF1F718\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab506-d01e-009e-27e5-644931000000", + "x-ms-client-request-id" : "c3c3bfce-96bf-4aff-8b7f-b575dee28060", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618/javablobappendblockfromurldestinationac168669a92c9700b?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", + "x-ms-client-request-id" : "48d9624a-bddc-406d-bdd9-7b5a8fab54b3" + }, + "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" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6CFA3672\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab52f-d01e-009e-50e5-644931000000", + "x-ms-client-request-id" : "48d9624a-bddc-406d-bdd9-7b5a8fab54b3", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8bb7db23-703e-4300-bb50-6957efde047d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab55e-d01e-009e-79e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0266457a8fab18618Fri, 06 Sep 2019 19:00:03 GMT\"0x8D732FC6CE2F1CE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "8bb7db23-703e-4300-bb50-6957efde047d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0266457a8fab18618?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" : "22439659-65af-4eaf-b64d-4b7e7aa5d2d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ab57f-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "22439659-65af-4eaf-b64d-4b7e7aa5d2d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0266457a8fab18618", "javablobappendblockfromurldestinationac168669a92c9700b", "javablobappendblockfromurldestinationac23466393b49468d" ] +} \ 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..e674b4493929 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448?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" : "abde7efd-a555-4be9-bcdc-28a16a6107c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D10B0A1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab5af-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "abde7efd-a555-4be9-bcdc-28a16a6107c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448/javablobappendblockfromurldestinationac14656321aa417a9", + "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" : "bf35cfd0-74e5-4b3e-ae0a-9a2b462605f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D169ECC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab5f8-d01e-009e-0ae5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "bf35cfd0-74e5-4b3e-ae0a-9a2b462605f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bf29f5dd-a01f-4b40-8fd1-56850cce7e19", + "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" : "\"0x8D732FC6D20309F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab62f-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "bf29f5dd-a01f-4b40-8fd1-56850cce7e19" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448/javablobappendblockfromurldestinationac14656321aa417a9", + "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" : "ebdc34ca-ebb2-44e9-a14b-f181b32483d7" + }, + "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" : "Fri, 06 Sep 2019 19:00:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:03 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" : "\"0x8D732FC6D169ECC\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:03 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab64d-d01e-009e-57e5-644931000000", + "x-ms-client-request-id" : "ebdc34ca-ebb2-44e9-a14b-f181b32483d7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448/javablobappendblockfromurldestinationac28810614b3b8e4a", + "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" : "f53a6620-0359-45c8-b419-3ab9d8dc4a66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D2C9D09\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab679-d01e-009e-7ae5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "x-ms-client-request-id" : "f53a6620-0359-45c8-b419-3ab9d8dc4a66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448/javablobappendblockfromurldestinationac28810614b3b8e4a?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", + "x-ms-client-request-id" : "41ae378e-f488-4222-a228-6cd6553ae6db", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:03 GMT", + "ETag" : "\"0x8D732FC6D343FFB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab6a5-d01e-009e-21e5-644931000000", + "x-ms-client-request-id" : "41ae378e-f488-4222-a228-6cd6553ae6db", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448/javablobappendblockfromurldestinationac14656321aa417a9?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", + "x-ms-client-request-id" : "c079e093-065f-4e57-b8ba-8c09eac755dd" + }, + "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" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6D43108D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab6d8-d01e-009e-50e5-644931000000", + "x-ms-client-request-id" : "c079e093-065f-4e57-b8ba-8c09eac755dd", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "00e12425-6637-43f1-859e-a7638bb858a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab75e-d01e-009e-46e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac020311bb52fe6d448Fri, 06 Sep 2019 19:00:04 GMT\"0x8D732FC6D20309F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "00e12425-6637-43f1-859e-a7638bb858a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac020311bb52fe6d448?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" : "a81e8fc4-0885-44ab-80e5-f0167c2ed8b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ab783-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "a81e8fc4-0885-44ab-80e5-f0167c2ed8b9" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac020311bb52fe6d448", "javablobappendblockfromurldestinationac14656321aa417a9", "javablobappendblockfromurldestinationac28810614b3b8e4a" ] +} \ 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..4856fe526256 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40?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" : "08346940-e3a4-4038-accf-eaef3ccb878e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D5EE29E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab7c0-d01e-009e-1ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "08346940-e3a4-4038-accf-eaef3ccb878e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40/javablobappendblockfromurldestinationac1936763952fd067", + "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" : "721c8214-dada-4157-955b-35d55b0322f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D64F87A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab7e7-d01e-009e-40e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "721c8214-dada-4157-955b-35d55b0322f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b16b68da-2e4d-41a2-ba9c-79f7ea3691e4", + "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" : "\"0x8D732FC6D6A6AD7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab7f8-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "b16b68da-2e4d-41a2-ba9c-79f7ea3691e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40/javablobappendblockfromurldestinationac235622dba45ba08", + "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" : "0a332444-6683-4105-bfd1-feda39116431" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D6FA968\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab826-d01e-009e-7ce5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "0a332444-6683-4105-bfd1-feda39116431" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40/javablobappendblockfromurldestinationac235622dba45ba08?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", + "x-ms-client-request-id" : "220c9d31-cd06-4818-b337-b2d71be73c37", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "ETag" : "\"0x8D732FC6D75C55D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab849-d01e-009e-19e5-644931000000", + "x-ms-client-request-id" : "220c9d31-cd06-4818-b337-b2d71be73c37", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40/javablobappendblockfromurldestinationac1936763952fd067?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", + "x-ms-client-request-id" : "1be7714a-44ed-4077-9c60-771a2dd057e5" + }, + "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" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6D8000F8\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab865-d01e-009e-34e5-644931000000", + "x-ms-client-request-id" : "1be7714a-44ed-4077-9c60-771a2dd057e5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac959ec1-a14c-4182-a5d9-62f8ec9d7218" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab8d2-d01e-009e-10e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0119527fff7be8c40Fri, 06 Sep 2019 19:00:04 GMT\"0x8D732FC6D6A6AD7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "ac959ec1-a14c-4182-a5d9-62f8ec9d7218", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0119527fff7be8c40?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" : "b172127a-7db2-4188-8214-016b6e646283" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ab8fe-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "b172127a-7db2-4188-8214-016b6e646283" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0119527fff7be8c40", "javablobappendblockfromurldestinationac1936763952fd067", "javablobappendblockfromurldestinationac235622dba45ba08" ] +} \ 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..871fe5871358 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059?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" : "17c42aa1-e877-4a7b-bc31-eddd98e89973" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6D9B363B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab935-d01e-009e-65e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "17c42aa1-e877-4a7b-bc31-eddd98e89973" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059/javablobappendblockfromurldestinationac173790b31f93950", + "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" : "6c7f902e-77fe-488f-aba2-24ce485a3c72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6DA12564\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab956-d01e-009e-02e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "6c7f902e-77fe-488f-aba2-24ce485a3c72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9e2b93ca-9f37-478a-97f0-88ff69006717", + "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" : "\"0x8D732FC6DA6BF10\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab979-d01e-009e-22e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "9e2b93ca-9f37-478a-97f0-88ff69006717" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059/javablobappendblockfromurldestinationac173790b31f93950?comp=lease", + "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" : "db9bfb85-89ea-4649-84dc-3cf0872e39e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6DA12564\"", + "x-ms-lease-id" : "6fadb284-7aec-4644-bddc-394f89cc83f7", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab99c-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "db9bfb85-89ea-4649-84dc-3cf0872e39e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059/javablobappendblockfromurldestinationac299238a0de0f7d8", + "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" : "d2622b8c-1377-4901-851a-cc720743feff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6DB4D924\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab9cf-d01e-009e-72e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "d2622b8c-1377-4901-851a-cc720743feff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059/javablobappendblockfromurldestinationac299238a0de0f7d8?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", + "x-ms-client-request-id" : "606e4b10-6ad3-44b5-ae19-d99fd796ccb4", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "ETag" : "\"0x8D732FC6DBA0A81\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ab9fe-d01e-009e-1de5-644931000000", + "x-ms-client-request-id" : "606e4b10-6ad3-44b5-ae19-d99fd796ccb4", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059/javablobappendblockfromurldestinationac173790b31f93950?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", + "x-ms-client-request-id" : "2b580c70-1661-424b-beff-660a5c772f13" + }, + "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" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6DC8B401\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aba1f-d01e-009e-3de5-644931000000", + "x-ms-client-request-id" : "2b580c70-1661-424b-beff-660a5c772f13", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dbf0fd3c-0b16-4505-a192-927dba7e905b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aba99-d01e-009e-26e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0084421480d719059Fri, 06 Sep 2019 19:00:04 GMT\"0x8D732FC6DA6BF10\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:04 GMT", + "x-ms-client-request-id" : "dbf0fd3c-0b16-4505-a192-927dba7e905b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0084421480d719059?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" : "e306299b-698f-468d-8fce-5e01b8712bcc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92abac8-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "e306299b-698f-468d-8fce-5e01b8712bcc" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0084421480d719059", "javablobappendblockfromurldestinationac173790b31f93950", "javablobappendblockfromurldestinationac299238a0de0f7d8" ] +} \ 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..b5906da29b1b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46?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" : "301231ce-71d9-45c5-9073-e979fe9a599c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6DE23AB2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abb14-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "301231ce-71d9-45c5-9073-e979fe9a599c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46/javablobappendblockfromurldestinationac159853e3522beec", + "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" : "1578f957-8335-4e22-bc48-5fdd91f39878" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6DEA4DB6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abb4d-d01e-009e-46e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "1578f957-8335-4e22-bc48-5fdd91f39878" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cbfb8174-03c2-4c0d-92ec-5349380e9f11", + "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" : "\"0x8D732FC6DF0F96C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92abb7d-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "cbfb8174-03c2-4c0d-92ec-5349380e9f11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46/javablobappendblockfromurldestinationac20577378d9e62e0", + "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" : "61c12923-bbe8-492c-977b-d5f25627d1c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6DF72202\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abbae-d01e-009e-1fe5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "61c12923-bbe8-492c-977b-d5f25627d1c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46/javablobappendblockfromurldestinationac20577378d9e62e0?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", + "x-ms-client-request-id" : "6dde10f2-1757-4275-bedd-62863dd53071", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "ETag" : "\"0x8D732FC6DFD8C24\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92abbd3-d01e-009e-41e5-644931000000", + "x-ms-client-request-id" : "6dde10f2-1757-4275-bedd-62863dd53071", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46/javablobappendblockfromurldestinationac159853e3522beec?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", + "x-ms-client-request-id" : "cdb90b44-bb6f-41b9-955f-c571c4449f83" + }, + "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" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6E09C410\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92abbf3-d01e-009e-5fe5-644931000000", + "x-ms-client-request-id" : "cdb90b44-bb6f-41b9-955f-c571c4449f83", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "80b85c2d-4837-49e3-9c7b-8074b21a77f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92abc85-d01e-009e-61e5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac086586aca53c10a46Fri, 06 Sep 2019 19:00:05 GMT\"0x8D732FC6DF0F96C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "80b85c2d-4837-49e3-9c7b-8074b21a77f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac086586aca53c10a46?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" : "bb3cfcb4-0633-4d1c-9ee8-114159b68d3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92abca9-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "bb3cfcb4-0633-4d1c-9ee8-114159b68d3b" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac086586aca53c10a46", "javablobappendblockfromurldestinationac159853e3522beec", "javablobappendblockfromurldestinationac20577378d9e62e0" ] +} \ 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..1464b63dee25 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4?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" : "7a188de1-0f9b-41e8-902d-9cc150ee32e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6E28C9C4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abced-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "7a188de1-0f9b-41e8-902d-9cc150ee32e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4/javablobappendblockfromurldestinationac1892541c64a45b1", + "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" : "9d818783-b5b7-46a9-9f75-e4c39a9fb55e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6E39E033\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abd6f-d01e-009e-2fe5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "9d818783-b5b7-46a9-9f75-e4c39a9fb55e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1f05eb74-ab36-4ed7-b289-b8657f3f110d", + "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" : "\"0x8D732FC6E3FC8BE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92abd9b-d01e-009e-5ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "1f05eb74-ab36-4ed7-b289-b8657f3f110d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4/javablobappendblockfromurldestinationac217882968b30e3c", + "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" : "1f0fa9b2-2d33-4f1e-bc80-e20c9fe1bf32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6E452D7D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92abdb9-d01e-009e-74e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "1f0fa9b2-2d33-4f1e-bc80-e20c9fe1bf32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4/javablobappendblockfromurldestinationac217882968b30e3c?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", + "x-ms-client-request-id" : "b8d473dd-eac7-45a4-89f0-38ab1012b265", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "ETag" : "\"0x8D732FC6E4B97A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92abde0-d01e-009e-16e5-644931000000", + "x-ms-client-request-id" : "b8d473dd-eac7-45a4-89f0-38ab1012b265", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4/javablobappendblockfromurldestinationac1892541c64a45b1?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", + "x-ms-client-request-id" : "e59b8898-a7a2-4247-92dd-d50bd93ee23e" + }, + "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" : "Fri, 06 Sep 2019 19:00:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC6E5C164A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92abe04-d01e-009e-37e5-644931000000", + "x-ms-client-request-id" : "e59b8898-a7a2-4247-92dd-d50bd93ee23e", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e70f3369-8972-404e-b802-6b6b414b6468" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92abebf-d01e-009e-5fe5-644931000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac094417d7fe12aaea4Fri, 06 Sep 2019 19:00:05 GMT\"0x8D732FC6E3FC8BE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:05 GMT", + "x-ms-client-request-id" : "e70f3369-8972-404e-b802-6b6b414b6468", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac094417d7fe12aaea4?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" : "bc4ab3e3-f8d4-459b-93c3-b2708027cd68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92abee4-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:06 GMT", + "x-ms-client-request-id" : "bc4ab3e3-f8d4-459b-93c3-b2708027cd68" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac094417d7fe12aaea4", "javablobappendblockfromurldestinationac1892541c64a45b1", "javablobappendblockfromurldestinationac217882968b30e3c" ] +} \ 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..2c760ad9e01e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c?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" : "e84ccfe8-12c5-4c1d-a87c-a7091bc05812" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6BBB327E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aad78-d01e-009e-6be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "e84ccfe8-12c5-4c1d-a87c-a7091bc05812" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c/javablobappendblockfromurlmd5165041190d41c744a640", + "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" : "0f9ebf84-6809-4ba7-b0fc-b74da245689a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6BC8E7FD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aadde-d01e-009e-41e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "0f9ebf84-6809-4ba7-b0fc-b74da245689a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "36c73b94-4d6a-46a6-9e3c-dc6d61a3519f", + "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" : "\"0x8D732FC6BD362F2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aae2d-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "36c73b94-4d6a-46a6-9e3c-dc6d61a3519f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c/javablobappendblockfromurlmd5165041190d41c744a640?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", + "x-ms-client-request-id" : "75215869-a3a8-4d4b-ac03-0a6965de7135", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "7PFM2uuur5U=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "ETag" : "\"0x8D732FC6BD8CA44\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aae58-d01e-009e-2be5-644931000000", + "x-ms-client-request-id" : "75215869-a3a8-4d4b-ac03-0a6965de7135", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c/javablobappendblockfromurlmd5200237518e69a10ca34a", + "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" : "d9f4b3ba-b81f-4c03-be8c-0e79c9330e74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6BE26987\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aaea7-d01e-009e-72e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "d9f4b3ba-b81f-4c03-be8c-0e79c9330e74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c/javablobappendblockfromurlmd5200237518e69a10ca34a?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", + "x-ms-client-request-id" : "a6530078-c92a-4569-93e2-74999fbe57a8" + }, + "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" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "Content-MD5" : "lvjC6oHbEFInfMlRciRUqQ==", + "ETag" : "\"0x8D732FC6BEE050F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aaef5-d01e-009e-3ae5-644931000000", + "x-ms-client-request-id" : "a6530078-c92a-4569-93e2-74999fbe57a8", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4ba3cca8-05b3-410f-8307-3f39889be739" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aaf1e-d01e-009e-5ee5-644931000000", + "Body" : "jtcappendblockfromurlmd5jtcappendblockfromurlmd5099383c64e3789bb30447cFri, 06 Sep 2019 19:00:01 GMT\"0x8D732FC6BD362F2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "4ba3cca8-05b3-410f-8307-3f39889be739", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5099383c64e3789bb30447c?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" : "dc20faed-0acd-4a84-a9f7-da9b0f8f2664" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aaf46-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "dc20faed-0acd-4a84-a9f7-da9b0f8f2664" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmd5099383c64e3789bb30447c", "javablobappendblockfromurlmd5165041190d41c744a640", "1de3b620-cba9-4a2a-9cf0-ddc47aaa2955", "javablobappendblockfromurlmd5200237518e69a10ca34a" ] +} \ 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..28f5a2c0568b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a?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" : "81c2fb5f-e7fe-4801-a67e-5af79417d723" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C0061C1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aaf82-d01e-009e-34e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "81c2fb5f-e7fe-4801-a67e-5af79417d723" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a/javablobappendblockfromurlmd5fail1568938d790be78cd3", + "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" : "9d9d36b4-55d8-4c97-9188-ae95e8aa1bad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C071133\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aafa0-d01e-009e-50e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "9d9d36b4-55d8-4c97-9188-ae95e8aa1bad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "53b9688d-bc89-44c1-a2d3-667e5e8bdb1a", + "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" : "\"0x8D732FC6C0C8224\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aafcc-d01e-009e-76e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "53b9688d-bc89-44c1-a2d3-667e5e8bdb1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a/javablobappendblockfromurlmd5fail1568938d790be78cd3?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", + "x-ms-client-request-id" : "c21119f4-8e04-41e6-a97e-41ae2fb79c57", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ZOyekCR1BMk=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "ETag" : "\"0x8D732FC6C12D3CC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aafe5-d01e-009e-0de5-644931000000", + "x-ms-client-request-id" : "c21119f4-8e04-41e6-a97e-41ae2fb79c57", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a/javablobappendblockfromurlmd5fail2578872627b1656193", + "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" : "4082ed97-b207-4531-803f-656f00a72962" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6C18C8A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ab005-d01e-009e-29e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "4082ed97-b207-4531-803f-656f00a72962" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a/javablobappendblockfromurlmd5fail2578872627b1656193?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", + "x-ms-client-request-id" : "a2973e5e-26ff-4c43-9db3-5f94db7ba1e2" + }, + "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" : "b92ab020-d01e-009e-42e5-644931000000", + "Body" : "\nMd5MismatchThe MD5 value specified in the request did not match with the MD5 value calculated by the server.\nRequestId:b92ab020-d01e-009e-42e5-644931000000\nTime:2019-09-06T19:00:02.3378121Z", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "a2973e5e-26ff-4c43-9db3-5f94db7ba1e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5d52facc-8146-4263-ad5a-ac71f0842b97" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ab03d-d01e-009e-57e5-644931000000", + "Body" : "jtcappendblockfromurlmd5failjtcappendblockfromurlmd5fail054794e34c7e2052c24aFri, 06 Sep 2019 19:00:02 GMT\"0x8D732FC6C0C8224\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "5d52facc-8146-4263-ad5a-ac71f0842b97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail054794e34c7e2052c24a?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" : "c2811fbd-1916-4521-af4d-8b6ba0a1b9d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ab05e-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:02 GMT", + "x-ms-client-request-id" : "c2811fbd-1916-4521-af4d-8b6ba0a1b9d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmd5fail054794e34c7e2052c24a", "javablobappendblockfromurlmd5fail1568938d790be78cd3", "7c4dc2f6-7334-40a0-bf8b-b81ff5ce9b4c", "javablobappendblockfromurlmd5fail2578872627b1656193" ] +} \ 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..1e17a2313e55 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3?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" : "a3fe7c6a-5870-4fac-9089-7b20253d6184" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC66D83A13\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a92a0-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "a3fe7c6a-5870-4fac-9089-7b20253d6184" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3/javablobappendblockfromurlmin1209295f9beffce57c45", + "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" : "7e23a887-6d99-4044-83cc-68ae263f8d84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC66DDF4A0\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a92ce-d01e-009e-3fe5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "7e23a887-6d99-4044-83cc-68ae263f8d84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cf008809-62d9-4a08-91f8-46098a25a52c", + "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" : "\"0x8D732FC66E843BB\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a931f-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "cf008809-62d9-4a08-91f8-46098a25a52c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3/javablobappendblockfromurlmin1209295f9beffce57c45?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", + "x-ms-client-request-id" : "9dae3f24-c94c-4f9e-b1a3-f6c7676ea965", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "byeZ8ZlUpyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "ETag" : "\"0x8D732FC66EEC175\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a9345-d01e-009e-28e5-644931000000", + "x-ms-client-request-id" : "9dae3f24-c94c-4f9e-b1a3-f6c7676ea965", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3/javablobappendblockfromurlmin2648154e4fd6f9c22646", + "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" : "ec7ce44b-5f0d-4ad9-ac13-449be10d91f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC66F440FD\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a9363-d01e-009e-45e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:53 GMT", + "x-ms-client-request-id" : "ec7ce44b-5f0d-4ad9-ac13-449be10d91f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3/javablobappendblockfromurlmin2648154e4fd6f9c22646?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", + "x-ms-client-request-id" : "7a5253ac-53f7-4bc3-bab4-915a38d470f4" + }, + "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" : "Fri, 06 Sep 2019 19:00:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:00 GMT", + "Content-MD5" : "Cck7fby1BzEWzWPUWqFR+Q==", + "ETag" : "\"0x8D732FC6AED47FA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92a93a2-d01e-009e-7fe5-644931000000", + "x-ms-client-request-id" : "7a5253ac-53f7-4bc3-bab4-915a38d470f4", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2bb6c352-fc2f-408c-a85b-d3cb4a4c2383" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aabf7-d01e-009e-0ce5-644931000000", + "Body" : "jtcappendblockfromurlminjtcappendblockfromurlmin001983e773ce15b98946f3Fri, 06 Sep 2019 18:59:53 GMT\"0x8D732FC66E843BB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:00 GMT", + "x-ms-client-request-id" : "2bb6c352-fc2f-408c-a85b-d3cb4a4c2383", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin001983e773ce15b98946f3?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" : "c033fb5f-392f-4caa-9965-a2abfd651fad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aac0a-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:00 GMT", + "x-ms-client-request-id" : "c033fb5f-392f-4caa-9965-a2abfd651fad" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmin001983e773ce15b98946f3", "javablobappendblockfromurlmin1209295f9beffce57c45", "bd576a6e-4b42-41e8-8a9f-befb49c8c39b", "javablobappendblockfromurlmin2648154e4fd6f9c22646" ] +} \ 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..2c26c9c0cadb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json @@ -0,0 +1,213 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492?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" : "713564e9-09ee-417a-ac9f-c52588735615" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6B79FBB8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aac3a-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "713564e9-09ee-417a-ac9f-c52588735615" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492/javablobappendblockfromurlrange16248698214a4e8f724", + "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" : "5cca6271-d261-4b35-8d9b-86cdb7608b54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6B7FBFAB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aac5a-d01e-009e-68e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "5cca6271-d261-4b35-8d9b-86cdb7608b54" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "137db012-14cc-47a5-8df3-a37fe010243a", + "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" : "\"0x8D732FC6B855743\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aac84-d01e-009e-0be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "137db012-14cc-47a5-8df3-a37fe010243a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492/javablobappendblockfromurlrange16248698214a4e8f724?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", + "x-ms-client-request-id" : "c0321a8d-251b-42a0-8a6d-b223cf533f57", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "R8vAv5GUNfA=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "ETag" : "\"0x8D732FC6B8A97B6\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aacaa-d01e-009e-2ee5-644931000000", + "x-ms-client-request-id" : "c0321a8d-251b-42a0-8a6d-b223cf533f57", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492/javablobappendblockfromurlrange283021cf2f30aaf5214", + "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" : "f96b1a98-9ee2-40b0-8578-78ce4445315e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6B908C8D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aacc4-d01e-009e-46e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "f96b1a98-9ee2-40b0-8578-78ce4445315e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492/javablobappendblockfromurlrange283021cf2f30aaf5214?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", + "x-ms-client-request-id" : "24f4ba14-1057-4e19-a0e9-a65d949bf076" + }, + "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" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "Content-MD5" : "52ZHg5XZnlU8t/WWhQ9ljg==", + "ETag" : "\"0x8D732FC6B9A52E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aaced-d01e-009e-6ae5-644931000000", + "x-ms-client-request-id" : "24f4ba14-1057-4e19-a0e9-a65d949bf076", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492/javablobappendblockfromurlrange283021cf2f30aaf5214", + "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" : "2280bda0-ffa2-43ab-b448-271b0a10fa9b" + }, + "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" : "Fri, 06 Sep 2019 19:00:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC6B9A52E0\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:01 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "b92aad16-d01e-009e-0ee5-644931000000", + "Body" : "[99, 46, -57, -69, 54, 63, -124, -66, -49, 85, -79, 28, 66, 17, -54, 31, -13, -22, -98, -104, -58, 29, -101, 124, 118, 42, 76, 99, 36, 113, 47, -31, -114, -73, 27, -90, -115, 110, 87, 28, 93, 60, -67, 39, -8, -88, -88, 70, -34, 17, 117, 105, -76, 109, -104, 80, 87, 47, -101, -93, 5, 116, 100, -127, -90, -12, 113, 113, 123, 23, 91, -1, -27, 7, 114, -86, -45, 94, 30, 98, 58, -58, 60, 26, -92, -25, 34, 118, -53, -128, -128, 62, 50, 47, 15, 5, 48, 58, -29, 27, 17, -85, 36, 37, -33, -91, 124, 53, -127, 72, 45, 48, 88, 26, -122, -20, -85, 71, 26, 53, 36, -56, -122, 71, 44, -112, 88, 82, -24, 42, 8, -9, -122, -98, -80, 104, 22, 31, 79, 117, 118, -106, -63, 97, -5, -99, 74, -120, 66, -20, -18, 117, 71, -85, -29, -115, 120, 7, -108, 6, 60, -54, -8, -62, -76, 75, 9, 96, 42, 46, -31, 53, 104, -88, -24, -8, -34, 24, -52, 123, -60, 62, 6, 61, 46, 75, 27, -78, 30, 101, -125, 46, -49, 94, 76, 97, -104, 97, -71, 70, 14, 38, 125, -68, -44, 49, 38, 26, 44, 21, -96, -127, -15, -85, 19, -118, 103, 18, 37, 68, 45, -59, -119, -117, -10, 36, 67, 18, -43, -28, -21, 12, -118, 40, -45, 110, 120, 110, -103, -80, 6, 58, -78, 55, 110, 44, 104, -49, -109, -45, -21, -38, 53, -116, -97, -50, 62, -47, -125, -119, 50, -64, 91, -67, -70, -84, -52, -85, -41, 102, -28, -56, 1, 118, 71, -63, 67, 93, 122, -13, -24, 55, 67, -105, -53, 115, 25, -70, -28, -30, 22, -85, 23, -27, 116, -50, -115, 85, -38, 15, -72, 68, 7, 83, -91, -7, 75, 69, 91, 40, 41, 21, -80, 125, -84, -19, 8, -89, -108, 107, 91, -58, -119, 108, 20, -4, 72, 93, 71, 24, -74, 27, -89, -73, -95, 15, -17, 1, 118, 89, 7, -3, 122, 25, -56, -122, -124, -29, 11, -17, -103, 39, -54, -57, 99, 41, 91, -91, 57, -61, -1, -78, -45, 89, 115, 105, 76, -55, -49, 114, 7, 50, 124, -104, -37, 95, 34, 55, 117, 37, 114, -17, -55, -32, -117, -43, 86, -75, 65, 73, 122, 113, 34, 115, -7, -85, -82, -126, -4, -98, -85, 65, 56, -35, 80, 94, 26, -40, 67, 35, 68, 126, -27, 114, -92, 92, -82, 18, -42, -103, -63, 120, -53, 127, -18, 75, -69, 95, 49, 63, -93, 16, -37, -81, -109, -24, 1, 65, -85, 27, -59, -114, 88, 62, -116, -57, 60, 72, 116, 57, -4, 55, -8, -35, 17, -26, -8, 60, -46, 5, -107, -110, 123, -77, 42, 85, -46, -115, 110, 58, -20, 25, -42, -70, -110, 21, -109, 43, 109, -57, -44, -51, -21, -6, -86, -68, -86, -22, -90, 8, -118, -51, -70, -36, -73, -17, 91, -6, -6, -21, 92, 84, 113, 93, -72, -124, 78, -70, -83, 73, 91, 9, -7, 31, 19, 98, -68, 2, -96, -23, -74, 58, -65, 82, 68, -82, -127, -19, -94, 67, -44, -32, -14, 64, -103, -18, 63, 84, -85, 121, -114, -59, 95, 53, -63, 30, -2, 109, -72, -24, 29, 59, -75, 126, 39, 98, 25, -99, 125, -29, 39, 43, -15, -51, 61, -125, -20, 93, 86, 90, 115, 118, 112, -40, -94, -109, 64, -6, -97, -27, 76, 34, -52, -87, -119, 70, -34, 52, -28, 40, 69, 77, -121, 75, -30, -13, -83, 39, 9, -113, 122, 31, 60, -19, -113, -3, -1, 44, 59, -106, 62, -3, -53, -98, -20, -101, -24, -64, 111, 9, -107, -81, -120, 44, 82, -6, 85, 21, -106, 12, 29, 115, 61, 98, -102, 77, -83, -82, 2, 62, -82, -52, 105, 35, -86, -39, 97, -52, -34, 31, -36, -51, -33, 113, -53, 91, -114, 50, 49, -61, -80, -70, 48, 0, -60, 69, -125, 89, -113, 48, 14, -63, 71, -128, -88, 27, 4, -69, -2, 50, 75, 47, 77, -61, -71, -89, -21, 37, 50, 79, -21, 9, -104, -51, -60, 88, 74, -48, 52, -59, 125, 111, 2, 4, -24, 126, -59, 25, 23, 8, -62, -123, 99, 59, 120, -95, -34, -92, -24, -55, -84, -107, -74, 55, 77, -20, -125, 69, -101, -71, 63, 3, -58, -21, -17, -75, 40, 52, -26, 67, -59, 99, -33, -114, 44, 71, -26, -60, 77, 13, -103, 78, 92, -112, 63, 26, -77, 81, 11, -39, -103, -119, -116, 1, 58, -74, -84, 25, -45, 43, -43, -36, 20, -33, -73, 109, 3, -109, -100, 96, -55, 25, 67, 14, 23, 57, 13, 98, 19, -27, 11, 84, -69, 6, 118, -99, -82, 124, 92, 18, 102, 100, 42, 91, -82, 25, 36, -69, 24, 115, -33, -128, 89, -20, 72, -82, -91, -13, -53, -48, -103, -30, 69, 38, -119, -12, 82, 126, 124, -90, 61, -113, -108, 113, 59, -35, 98, -14, -79, 115, -19, 117, 9, -22, -55, -12, 90, -53, 66, 88, 13, 119, -43, 19, 33, 55, 33, 34, 9, -41, 0, -127, 77, 116, -61, 110, -3, -68, -95, -57, -73, 124, -38, -38, -80, -125, 40, 101, -30, 126, 33, -50, 70, -115, 59, -104, -29, 118, -75, -56, -125, 72, 28, 124, -107, 125, -113, -63, 66, -126, 2, 72, 95, -109, -116, 88, -107, 13, 72, -74, -107, 6, -28, -11, 24, 99, -93, 61, -55, 23, 11, 58, 39, -64, -76, 118, 51, -61, 71, -84, -2, 20, -66, -46, 9, 119, -126, 51, 16, 81, 66, 60, 105, 67, 38, -28, 41, 119, -55, 104, 125, -76, -4, -34, -101, -74, 51, 27, 111, 116, 107, -80, 120, -36, 52, 104, -80, 42, -113, -92, 0, -33, -17, -54, 77, 121, -15, 43, 28, 9, -50, -115, -71, 23, -11, -123, -118, -92, 5, 76, 110, 24, 52, -63, -103, 107, 102, 42, 33, 59, 91, -113, 110, -81, 111, 106, 111, -75, 72, -71, 108, 94, -75, 56, 10, 79, 121, 1, 36, -36, 27, -96, 90, 35]", + "x-ms-client-request-id" : "2280bda0-ffa2-43ab-b448-271b0a10fa9b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "552a1d19-cfb3-469b-9f0b-35918d3a1227" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aad48-d01e-009e-3de5-644931000000", + "Body" : "jtcappendblockfromurlrangejtcappendblockfromurlrange03985096c0aea5f83e492Fri, 06 Sep 2019 19:00:01 GMT\"0x8D732FC6B855743\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "552a1d19-cfb3-469b-9f0b-35918d3a1227", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange03985096c0aea5f83e492?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" : "95afe808-e436-4647-a80b-cd56e11df1fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aad60-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:01 GMT", + "x-ms-client-request-id" : "95afe808-e436-4647-a80b-cd56e11df1fa" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlrange03985096c0aea5f83e492", "javablobappendblockfromurlrange16248698214a4e8f724", "8e3cdb53-a4a4-4911-814c-515dfce531bd", "javablobappendblockfromurlrange283021cf2f30aaf5214" ] +} \ 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..866e7ae9ffe1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f?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" : "4966702b-e280-4263-a0b7-67776e0e8fd2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70205273\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aca8b-d01e-009e-12e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "4966702b-e280-4263-a0b7-67776e0e8fd2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f/javablobappendblockfromurlsourceac1330540ec87e9ab89", + "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" : "708dc788-bab0-41d1-bf26-139980309ce0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70273173\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92acad1-d01e-009e-49e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "708dc788-bab0-41d1-bf26-139980309ce0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15e31cba-8a6d-47a7-a8ee-879dcada3d47", + "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" : "\"0x8D732FC7031144E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92acb17-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "15e31cba-8a6d-47a7-a8ee-879dcada3d47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f/javablobappendblockfromurlsourceac205365a9a4802c3d5", + "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" : "1c630df2-14cb-4993-8d45-3ebb26e7a8e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7036774F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92acb51-d01e-009e-39e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:08 GMT", + "x-ms-client-request-id" : "1c630df2-14cb-4993-8d45-3ebb26e7a8e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f/javablobappendblockfromurlsourceac205365a9a4802c3d5?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", + "x-ms-client-request-id" : "c9da4799-10c3-4d68-b50f-580caf37482a", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "ETag" : "\"0x8D732FC703C6C2C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92acb7d-d01e-009e-5be5-644931000000", + "x-ms-client-request-id" : "c9da4799-10c3-4d68-b50f-580caf37482a", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f/javablobappendblockfromurlsourceac1330540ec87e9ab89?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", + "x-ms-client-request-id" : "b65a13a5-6c21-4417-a476-cb8e477c7f78" + }, + "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" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC704D6021\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92acbe6-d01e-009e-31e5-644931000000", + "x-ms-client-request-id" : "b65a13a5-6c21-4417-a476-cb8e477c7f78", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "af411ed7-0b96-46b1-a028-c645b5267400" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92acc27-d01e-009e-6de5-644931000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac04366964037c7f2c624fFri, 06 Sep 2019 19:00:09 GMT\"0x8D732FC7031144E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "af411ed7-0b96-46b1-a028-c645b5267400", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac04366964037c7f2c624f?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" : "3cc16027-b9be-41a9-a2bd-82addf0e7657" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92acc50-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "3cc16027-b9be-41a9-a2bd-82addf0e7657" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac04366964037c7f2c624f", "javablobappendblockfromurlsourceac1330540ec87e9ab89", "javablobappendblockfromurlsourceac205365a9a4802c3d5" ] +} \ 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..01249cc7bb7d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c?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" : "47a5ecac-9bbe-4bd3-975c-4a7712b2f88c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7065337E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92acc9c-d01e-009e-52e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "47a5ecac-9bbe-4bd3-975c-4a7712b2f88c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c/javablobappendblockfromurlsourceac170985f42f260a882", + "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" : "9a5f7b9b-cace-4d94-9280-e9a46cefc2d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC706BEBE5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92accd0-d01e-009e-02e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "9a5f7b9b-cace-4d94-9280-e9a46cefc2d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7160477f-0277-459b-a413-43a84bc949ac", + "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" : "\"0x8D732FC7071884C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92accfc-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "7160477f-0277-459b-a413-43a84bc949ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c/javablobappendblockfromurlsourceac24095630c2f1b73b0", + "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" : "fe6ec7f4-a398-4dc1-ae7d-a010f6e1b7fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC707A4733\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92acd2f-d01e-009e-53e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "fe6ec7f4-a398-4dc1-ae7d-a010f6e1b7fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c/javablobappendblockfromurlsourceac24095630c2f1b73b0?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", + "x-ms-client-request-id" : "44a6a684-f5b4-4d64-bd86-e1a33dfe90fa", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "ETag" : "\"0x8D732FC707FC6B9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92acd45-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "44a6a684-f5b4-4d64-bd86-e1a33dfe90fa", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c/javablobappendblockfromurlsourceac170985f42f260a882?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", + "x-ms-client-request-id" : "d941a945-49a2-46fa-9a69-ee61603c6255" + }, + "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" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC708A9EBA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92acd76-d01e-009e-10e5-644931000000", + "x-ms-client-request-id" : "d941a945-49a2-46fa-9a69-ee61603c6255", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b134bb7f-0737-47d9-8425-6d66e280c727" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92acda5-d01e-009e-3ce5-644931000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac00906685e4197d941d4cFri, 06 Sep 2019 19:00:09 GMT\"0x8D732FC7071884C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "b134bb7f-0737-47d9-8425-6d66e280c727", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00906685e4197d941d4c?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" : "fd5aae79-c39e-4a7f-94b5-20c2c4986a9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92acdbe-d01e-009e-55e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "fd5aae79-c39e-4a7f-94b5-20c2c4986a9d" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac00906685e4197d941d4c", "javablobappendblockfromurlsourceac170985f42f260a882", "javablobappendblockfromurlsourceac24095630c2f1b73b0" ] +} \ 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..70ac95fd92b6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040?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" : "2fd43851-5966-4e2e-9cc2-14d829d9b948" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70B07E93\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ace76-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "2fd43851-5966-4e2e-9cc2-14d829d9b948" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040/javablobappendblockfromurlsourceac1503912bf470b3f7f", + "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" : "6734a4c0-68cc-4994-b62d-c4721637eb02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70BBCC8B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aceac-d01e-009e-29e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "6734a4c0-68cc-4994-b62d-c4721637eb02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "45975347-1086-46d3-b701-fc2ab7d8faa0", + "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" : "\"0x8D732FC70C11B07\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aced2-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "45975347-1086-46d3-b701-fc2ab7d8faa0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040/javablobappendblockfromurlsourceac221805bee2713cdd0", + "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" : "93973b20-c967-4ba8-bf1b-b8d4e95cb8bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70C7DD57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92acef3-d01e-009e-65e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "x-ms-client-request-id" : "93973b20-c967-4ba8-bf1b-b8d4e95cb8bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040/javablobappendblockfromurlsourceac221805bee2713cdd0?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", + "x-ms-client-request-id" : "1c505012-6b2d-41c5-8bd6-8379736e47d3", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:09 GMT", + "ETag" : "\"0x8D732FC70CDF94B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92acf27-d01e-009e-11e5-644931000000", + "x-ms-client-request-id" : "1c505012-6b2d-41c5-8bd6-8379736e47d3", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040/javablobappendblockfromurlsourceac1503912bf470b3f7f?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", + "x-ms-client-request-id" : "c63c394f-8169-4e1b-ba91-2a3bcc8ce984" + }, + "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" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC70E8DAB2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92acf5e-d01e-009e-40e5-644931000000", + "x-ms-client-request-id" : "c63c394f-8169-4e1b-ba91-2a3bcc8ce984", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "77803e20-54bf-4075-a2ab-319e2a3ae51d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92acfd0-d01e-009e-22e5-644931000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac030028b787bb2cd6a040Fri, 06 Sep 2019 19:00:10 GMT\"0x8D732FC70C11B07\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "77803e20-54bf-4075-a2ab-319e2a3ae51d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac030028b787bb2cd6a040?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" : "adb46338-dff7-4935-98e4-05ba307d7fc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92acfec-d01e-009e-37e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "adb46338-dff7-4935-98e4-05ba307d7fc0" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac030028b787bb2cd6a040", "javablobappendblockfromurlsourceac1503912bf470b3f7f", "javablobappendblockfromurlsourceac221805bee2713cdd0" ] +} \ 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..0c13d7dea714 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047?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" : "9b6d44c9-861e-46f2-8db3-d5546226fdd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70F9F47D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad006-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "9b6d44c9-861e-46f2-8db3-d5546226fdd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047/javablobappendblockfromurlsourceac161357d5a094df384", + "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" : "e27fd7a0-8c8e-496c-8669-916669c5b744" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC70FFEA9D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad02c-d01e-009e-6be5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "e27fd7a0-8c8e-496c-8669-916669c5b744" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a44f18a0-6f9e-4273-bad0-76b37e771b7f", + "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" : "\"0x8D732FC7105877E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad044-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "a44f18a0-6f9e-4273-bad0-76b37e771b7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047/javablobappendblockfromurlsourceac28851783b3e91ae3e", + "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" : "1581a322-20ef-4d14-b9cf-865b96e06dfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC710AE9BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad063-d01e-009e-19e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "1581a322-20ef-4d14-b9cf-865b96e06dfa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047/javablobappendblockfromurlsourceac28851783b3e91ae3e?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", + "x-ms-client-request-id" : "f3ea3e30-d45c-446f-a9ab-16ec1458c322", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "ETag" : "\"0x8D732FC71106945\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad088-d01e-009e-3ae5-644931000000", + "x-ms-client-request-id" : "f3ea3e30-d45c-446f-a9ab-16ec1458c322", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047/javablobappendblockfromurlsourceac28851783b3e91ae3e", + "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" : "b89853fb-1f62-4929-a0c7-c80e1291e2ab" + }, + "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" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC71106945\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:10 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ad0a7-d01e-009e-56e5-644931000000", + "x-ms-client-request-id" : "b89853fb-1f62-4929-a0c7-c80e1291e2ab", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047/javablobappendblockfromurlsourceac161357d5a094df384?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", + "x-ms-client-request-id" : "2fe9d3b6-3ee3-458e-8c71-32a06ecaec72" + }, + "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" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC711EEBA4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad0c9-d01e-009e-74e5-644931000000", + "x-ms-client-request-id" : "2fe9d3b6-3ee3-458e-8c71-32a06ecaec72", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c280e292-f70d-44ca-9c18-b36e80aee56f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad101-d01e-009e-25e5-644931000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac086346b4cba18a8dc047Fri, 06 Sep 2019 19:00:10 GMT\"0x8D732FC7105877E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "c280e292-f70d-44ca-9c18-b36e80aee56f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac086346b4cba18a8dc047?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" : "f29e818b-6459-4a77-90a3-ef54390d12ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad114-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "f29e818b-6459-4a77-90a3-ef54390d12ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac086346b4cba18a8dc047", "javablobappendblockfromurlsourceac161357d5a094df384", "javablobappendblockfromurlsourceac28851783b3e91ae3e" ] +} \ 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..dd239ea50f4a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645?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" : "9fb1c841-aed6-4e70-b7d4-15e8f905042c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7131DA2E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad12e-d01e-009e-4ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "9fb1c841-aed6-4e70-b7d4-15e8f905042c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645/javablobappendblockfromurlsourceac1894655bf674463be", + "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" : "f1e66884-f509-4cab-a4cb-07db45b5e754" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7137D0BB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad148-d01e-009e-61e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "f1e66884-f509-4cab-a4cb-07db45b5e754" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac308cf4-60b1-460b-ab58-60c98b15df98", + "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" : "\"0x8D732FC7140F121\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad178-d01e-009e-0be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "ac308cf4-60b1-460b-ab58-60c98b15df98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645/javablobappendblockfromurlsourceac25510226911c273f3", + "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" : "bc4c6ea9-ce5d-4bf8-bbd2-f6e9cc20592a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC71480138\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad198-d01e-009e-27e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "bc4c6ea9-ce5d-4bf8-bbd2-f6e9cc20592a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645/javablobappendblockfromurlsourceac25510226911c273f3?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", + "x-ms-client-request-id" : "c78057f7-75cc-4a05-8612-f73550678505", + "Content-Type" : "application/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" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "ETag" : "\"0x8D732FC714E4443\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad1c6-d01e-009e-4be5-644931000000", + "x-ms-client-request-id" : "c78057f7-75cc-4a05-8612-f73550678505", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645/javablobappendblockfromurlsourceac1894655bf674463be?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", + "x-ms-client-request-id" : "9e6fe6aa-4c87-4361-ab0b-2967fec8434c" + }, + "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" : "Fri, 06 Sep 2019 19:00:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC71572007\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad1e7-d01e-009e-6ae5-644931000000", + "x-ms-client-request-id" : "9e6fe6aa-4c87-4361-ab0b-2967fec8434c", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e20c2110-bc18-4a40-8ac2-40ea20b67c3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad218-d01e-009e-17e5-644931000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac00723196ada8ad1a2645Fri, 06 Sep 2019 19:00:10 GMT\"0x8D732FC7140F121\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "e20c2110-bc18-4a40-8ac2-40ea20b67c3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac00723196ada8ad1a2645?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" : "0337a5ef-d863-493c-b230-3d235fa6a26f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad23f-d01e-009e-37e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:10 GMT", + "x-ms-client-request-id" : "0337a5ef-d863-493c-b230-3d235fa6a26f" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac00723196ada8ad1a2645", "javablobappendblockfromurlsourceac1894655bf674463be", "javablobappendblockfromurlsourceac25510226911c273f3" ] +} \ 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..94359213c789 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia8b002233035c?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" : "00ba6aa3-e0b0-4e46-aa46-aa8e9e2042fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC637DEC45\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13a0c-201e-012e-5fe5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "00ba6aa3-e0b0-4e46-aa46-aa8e9e2042fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia8b002233035c/javablobappendblockia1appendblobapitestappendblockia8b0325629", + "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" : "a6330dce-a4e6-4cf2-806f-abce818aed3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC638B1957\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13a2a-201e-012e-7ae5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:47 GMT", + "x-ms-client-request-id" : "a6330dce-a4e6-4cf2-806f-abce818aed3a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b6abeb65-448e-4181-a29a-b1462d0ac0f7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13a44-201e-012e-0fe5-64f6e4000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockia8b002233035cFri, 06 Sep 2019 18:59:47 GMT\"0x8D732FC637DEC45\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:47 GMT", + "x-ms-client-request-id" : "b6abeb65-448e-4181-a29a-b1462d0ac0f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia8b002233035c?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" : "6cb5abef-2736-458e-835e-0c8e4a533f87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13a5a-201e-012e-22e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:47 GMT", + "x-ms-client-request-id" : "6cb5abef-2736-458e-835e-0c8e4a533f87" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockia8b002233035c", "javablobappendblockia1appendblobapitestappendblockia8b0325629" ] +} \ 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..aee56ccd90ef --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec398930ef5a?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" : "004776ae-51c3-4260-af73-0b010b614f14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC63A21E70\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13a66-201e-012e-2de5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:47 GMT", + "x-ms-client-request-id" : "004776ae-51c3-4260-af73-0b010b614f14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec398930ef5a/javablobappendblockia1appendblobapitestappendblockiaec3202179", + "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" : "cf2d00d7-47f3-4461-ac2e-7ef13a9bbada" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC63AA6894\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13a8c-201e-012e-4be5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:47 GMT", + "x-ms-client-request-id" : "cf2d00d7-47f3-4461-ac2e-7ef13a9bbada" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec398930ef5a/javablobappendblockia1appendblobapitestappendblockiaec3202179?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", + "x-ms-client-request-id" : "0ccfe568-0a8d-4b12-afc4-2658eaaedc20", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "11e3bd8d-7d1c-4ad3-8560-fe1e7efcf975" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a5bf08d7-c01e-0002-62e5-64328c000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockiaec398930ef5aFri, 06 Sep 2019 18:59:48 GMT\"0x8D732FC63A21E70\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "11e3bd8d-7d1c-4ad3-8560-fe1e7efcf975", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec398930ef5a?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" : "19151580-c294-483c-b161-7aff3ac66407" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "a5bf091b-c01e-0002-17e5-64328c000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "19151580-c294-483c-b161-7aff3ac66407" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockiaec398930ef5a", "javablobappendblockia1appendblobapitestappendblockiaec3202179" ] +} \ 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..1973bad80dcb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec877573442a?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" : "80a842c7-c4f2-4d6c-b180-9f2d5f879b48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC63DEFAE1\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a5bf0928-c01e-0002-24e5-64328c000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "80a842c7-c4f2-4d6c-b180-9f2d5f879b48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec877573442a/javablobappendblockia1appendblobapitestappendblockiaec861993d", + "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" : "6811201f-1860-42de-9c50-2d9585c4635e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC63E5359D\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a5bf0943-c01e-0002-36e5-64328c000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "6811201f-1860-42de-9c50-2d9585c4635e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec877573442a/javablobappendblockia1appendblobapitestappendblockiaec861993d?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", + "x-ms-client-request-id" : "27568965-d51e-4a1a-b698-85382583440b", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6e45506b-6c99-45d7-a29a-32ac2b8cf127" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a80f8-d01e-009e-0ee5-644931000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockiaec877573442aFri, 06 Sep 2019 18:59:48 GMT\"0x8D732FC63DEFAE1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "6e45506b-6c99-45d7-a29a-32ac2b8cf127", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaec877573442a?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" : "317b0a54-4797-42ed-9a5b-488c1613086e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a8135-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "317b0a54-4797-42ed-9a5b-488c1613086e" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockiaec877573442a", "javablobappendblockia1appendblobapitestappendblockiaec861993d" ] +} \ 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..36a1269a4ab5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblocknullbody07389644d03ef58d6b41928?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" : "a7c94e0a-811c-4fdb-a057-e11e4278cc22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC642C7A30\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a8238-d01e-009e-34e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "a7c94e0a-811c-4fdb-a057-e11e4278cc22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblocknullbody07389644d03ef58d6b41928/javablobappendblocknullbody1445829e955e603b7e478", + "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" : "25855f49-400a-4758-8faf-3eb1c35bd5c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6432A4AF\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92a824e-d01e-009e-48e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "25855f49-400a-4758-8faf-3eb1c35bd5c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "49a417ce-6f72-4c2b-a938-d02ff50e26be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92a8270-d01e-009e-68e5-644931000000", + "Body" : "jtcappendblocknullbodyjtcappendblocknullbody07389644d03ef58d6b41928Fri, 06 Sep 2019 18:59:48 GMT\"0x8D732FC642C7A30\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "49a417ce-6f72-4c2b-a938-d02ff50e26be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblocknullbody07389644d03ef58d6b41928?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" : "a39c12fe-979a-4a4b-8077-fdeb5138478d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92a828e-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 18:59:48 GMT", + "x-ms-client-request-id" : "a39c12fe-979a-4a4b-8077-fdeb5138478d" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblocknullbody07389644d03ef58d6b41928", "javablobappendblocknullbody1445829e955e603b7e478" ] +} \ 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..a430ad0e611b --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac66898796d8bccbd83?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" : "35dff7d6-2ed0-46b3-b8ac-7b9ae6eb02d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61AAE2EB\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13586-201e-012e-72e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "35dff7d6-2ed0-46b3-b8ac-7b9ae6eb02d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac66898796d8bccbd83/javablobcreateac1appendblobapitestcreateac668807323b5f61", + "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" : "bf9eb186-c589-4be5-b11d-13e573457f1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61B154D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13598-201e-012e-01e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "bf9eb186-c589-4be5-b11d-13e573457f1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac66898796d8bccbd83/javablobcreateac1appendblobapitestcreateac668807323b5f61", + "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" : "9ec6bbe9-8dce-4a78-9970-8e77b30bdfac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61B770CD\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d135a3-201e-012e-0be5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "9ec6bbe9-8dce-4a78-9970-8e77b30bdfac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0be3a306-c073-4140-a0a0-aec272fe6ed0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d135bb-201e-012e-1fe5-64f6e4000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac66898796d8bccbd83Fri, 06 Sep 2019 18:59:44 GMT\"0x8D732FC61AAE2EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "0be3a306-c073-4140-a0a0-aec272fe6ed0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac66898796d8bccbd83?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" : "dd0ad514-d27b-4760-af21-e694aa14e21a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d135c9-201e-012e-2de5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "dd0ad514-d27b-4760-af21-e694aa14e21a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac66898796d8bccbd83", "javablobcreateac1appendblobapitestcreateac668807323b5f61" ] +} \ 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..4f818424de6f --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac28292945d20dc8af0?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" : "bc98d270-493f-4540-958a-33a3460a2c48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61CA31FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d135d5-201e-012e-37e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "bc98d270-493f-4540-958a-33a3460a2c48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac28292945d20dc8af0/javablobcreateac1appendblobapitestcreateac28271039ee88ad", + "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" : "0962acee-2cee-4c83-8aef-17b9b75ca0e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61D0CB33\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d135e5-201e-012e-46e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "0962acee-2cee-4c83-8aef-17b9b75ca0e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac28292945d20dc8af0/javablobcreateac1appendblobapitestcreateac28271039ee88ad", + "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" : "5da9f839-6d5f-4015-8fd5-da8f06b4d230" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61D69900\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d135f7-201e-012e-57e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "5da9f839-6d5f-4015-8fd5-da8f06b4d230" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c50ef4e-c827-41f3-b970-e3a3f4de1fa0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13609-201e-012e-66e5-64f6e4000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac28292945d20dc8af0Fri, 06 Sep 2019 18:59:45 GMT\"0x8D732FC61CA31FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "7c50ef4e-c827-41f3-b970-e3a3f4de1fa0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac28292945d20dc8af0?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" : "64ce2a0e-e37e-45eb-9a36-35035c0c47e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d1361a-201e-012e-76e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "64ce2a0e-e37e-45eb-9a36-35035c0c47e6" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac28292945d20dc8af0", "javablobcreateac1appendblobapitestcreateac28271039ee88ad" ] +} \ 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..c883cc3cf89d --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac3d137402c2466b93b?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" : "9ba7504a-6419-4910-8613-9eb3730b69cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61E8E4AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1362a-201e-012e-04e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "9ba7504a-6419-4910-8613-9eb3730b69cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac3d137402c2466b93b/javablobcreateac1appendblobapitestcreateac3d106262efea48", + "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" : "54820a54-e60e-4e7f-9916-4a575addcda8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61EFA53D\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1363c-201e-012e-13e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "54820a54-e60e-4e7f-9916-4a575addcda8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac3d137402c2466b93b/javablobcreateac1appendblobapitestcreateac3d106262efea48", + "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" : "919de31a-055b-4f23-ae70-a991660a9117" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61F59A17\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13650-201e-012e-25e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "919de31a-055b-4f23-ae70-a991660a9117" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b5edfa4a-dbee-44dd-a0c3-d1207de91009" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13665-201e-012e-36e5-64f6e4000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac3d137402c2466b93bFri, 06 Sep 2019 18:59:45 GMT\"0x8D732FC61E8E4AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "b5edfa4a-dbee-44dd-a0c3-d1207de91009", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac3d137402c2466b93b?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" : "5b1cfefd-c1ce-4df5-ad72-1a6e69cbb933" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13673-201e-012e-43e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "5b1cfefd-c1ce-4df5-ad72-1a6e69cbb933" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac3d137402c2466b93b", "javablobcreateac1appendblobapitestcreateac3d106262efea48" ] +} \ 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..875b81a84675 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacc961406640edf48f5?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" : "f1fdd6cb-6df1-4f6c-9648-a349fd6e08a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC620AA541\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1368c-201e-012e-59e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "f1fdd6cb-6df1-4f6c-9648-a349fd6e08a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacc961406640edf48f5/javablobcreateac1appendblobapitestcreateacc96404736d11a5", + "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" : "1646ff66-7a76-4cfb-9a98-9753a95f4ebd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62118D2D\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13699-201e-012e-63e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "1646ff66-7a76-4cfb-9a98-9753a95f4ebd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacc961406640edf48f5/javablobcreateac1appendblobapitestcreateacc96404736d11a5", + "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" : "4f0de9e3-15e7-489e-bce4-72b4d959a77b" + }, + "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" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:44 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" : "\"0x8D732FC62118D2D\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:45 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "94d136a7-201e-012e-6fe5-64f6e4000000", + "x-ms-client-request-id" : "4f0de9e3-15e7-489e-bce4-72b4d959a77b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacc961406640edf48f5/javablobcreateac1appendblobapitestcreateacc96404736d11a5", + "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" : "bc1988a8-c920-44b5-9374-1b022a51d25f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC621C8C4A\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d136b5-201e-012e-7ce5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "bc1988a8-c920-44b5-9374-1b022a51d25f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b48c9a74-d540-4a00-b72b-2a3ad84b2e63" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d136c3-201e-012e-0ae5-64f6e4000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateacc961406640edf48f5Fri, 06 Sep 2019 18:59:45 GMT\"0x8D732FC620AA541\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "b48c9a74-d540-4a00-b72b-2a3ad84b2e63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacc961406640edf48f5?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" : "0ba79b09-1405-40cb-9122-76c93effa729" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d136d3-201e-012e-1ae5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "0ba79b09-1405-40cb-9122-76c93effa729" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateacc961406640edf48f5", "javablobcreateac1appendblobapitestcreateacc96404736d11a5" ] +} \ 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..b43a284f329c --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac55923571cefb1bfb5?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" : "d36b0f29-4dca-4cec-98b2-597027a820d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC622F4CBF\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d136e8-201e-012e-2be5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "d36b0f29-4dca-4cec-98b2-597027a820d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac55923571cefb1bfb5/javablobcreateac1appendblobapitestcreateac5594783067eb38", + "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" : "e2f949ec-cc2f-405d-9e2d-520213eb2c19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62365BF4\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d136f2-201e-012e-34e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "e2f949ec-cc2f-405d-9e2d-520213eb2c19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac55923571cefb1bfb5/javablobcreateac1appendblobapitestcreateac5594783067eb38", + "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" : "c4050845-acbe-4961-b420-094f14693176" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC623BDB8C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13706-201e-012e-45e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "c4050845-acbe-4961-b420-094f14693176" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "372ee211-4465-4d1f-94e8-2ae9e2aed889" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13723-201e-012e-5ce5-64f6e4000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac55923571cefb1bfb5Fri, 06 Sep 2019 18:59:45 GMT\"0x8D732FC622F4CBF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "372ee211-4465-4d1f-94e8-2ae9e2aed889", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac55923571cefb1bfb5?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" : "82132f0a-792e-44a1-ae02-aef5caa1ff4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13730-201e-012e-67e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "82132f0a-792e-44a1-ae02-aef5caa1ff4a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac55923571cefb1bfb5", "javablobcreateac1appendblobapitestcreateac5594783067eb38" ] +} \ 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..42320dab0943 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacdbd96008dd844f14e?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" : "82e35195-2706-4ef4-846f-ceb5ae9347df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC624E4D97\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1375c-201e-012e-0de5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:44 GMT", + "x-ms-client-request-id" : "82e35195-2706-4ef4-846f-ceb5ae9347df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacdbd96008dd844f14e/javablobcreateac1appendblobapitestcreateacdbd35350b0d0d6", + "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" : "b8015787-f9ce-4cb4-8bed-991068aa0483" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62549987\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13768-201e-012e-17e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "b8015787-f9ce-4cb4-8bed-991068aa0483" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacdbd96008dd844f14e/javablobcreateac1appendblobapitestcreateacdbd35350b0d0d6?comp=lease", + "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" : "d940c0e6-dcb4-4e85-8f29-68a3622f47d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62549987\"", + "x-ms-lease-id" : "8edb881c-645d-4e27-a20f-fc92a910b1e5", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1377e-201e-012e-2be5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "d940c0e6-dcb4-4e85-8f29-68a3622f47d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacdbd96008dd844f14e/javablobcreateac1appendblobapitestcreateacdbd35350b0d0d6", + "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" : "bf1de3ec-1da8-464d-a91c-5bcb09498122" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62603504\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13787-201e-012e-34e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "bf1de3ec-1da8-464d-a91c-5bcb09498122" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ef545c31-6eb6-49a0-b473-2932a1f0bddd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d1378d-201e-012e-3ae5-64f6e4000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateacdbd96008dd844f14eFri, 06 Sep 2019 18:59:45 GMT\"0x8D732FC624E4D97\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "ef545c31-6eb6-49a0-b473-2932a1f0bddd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacdbd96008dd844f14e?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" : "a1b9a781-9057-45ee-bd9e-8bda18345246" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d137a3-201e-012e-4de5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "a1b9a781-9057-45ee-bd9e-8bda18345246" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateacdbd96008dd844f14e", "javablobcreateac1appendblobapitestcreateacdbd35350b0d0d6" ] +} \ 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..9d9b12f46eb7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail17e85910ee4dd?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" : "6555228f-0faa-4f72-976b-442f3bcbaa2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62787491\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d137cb-201e-012e-71e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "6555228f-0faa-4f72-976b-442f3bcbaa2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail17e85910ee4dd/javablobcreateacfail1appendblobapitestcreateacfail17e176414e", + "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" : "0cac2b15-73ab-4cd2-a3d0-efbd467503f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC627F5D38\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d137f1-201e-012e-12e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "0cac2b15-73ab-4cd2-a3d0-efbd467503f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail17e85910ee4dd/javablobcreateacfail1appendblobapitestcreateacfail17e176414e", + "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" : "31e892a6-219d-4e33-b6da-015dcb7462b5" + }, + "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" : "94d13803-201e-012e-21e5-64f6e4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:94d13803-201e-012e-21e5-64f6e4000000\nTime:2019-09-06T18:59:46.2384122Z", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "31e892a6-219d-4e33-b6da-015dcb7462b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "93b9f71a-95cd-426d-b436-ef2a4736627c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13812-201e-012e-2fe5-64f6e4000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail17e85910ee4ddFri, 06 Sep 2019 18:59:46 GMT\"0x8D732FC62787491\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "93b9f71a-95cd-426d-b436-ef2a4736627c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail17e85910ee4dd?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" : "f05dc659-e179-4cba-8e9e-5240b8d5d2d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13820-201e-012e-3ce5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "f05dc659-e179-4cba-8e9e-5240b8d5d2d3" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail17e85910ee4dd", "javablobcreateacfail1appendblobapitestcreateacfail17e176414e" ] +} \ 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..75403c8b5439 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailda937866a67e3?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" : "c2aa05fd-8909-4a85-990b-9554b942f09b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6299E6FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1383c-201e-012e-56e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "c2aa05fd-8909-4a85-990b-9554b942f09b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailda937866a67e3/javablobcreateacfail1appendblobapitestcreateacfailda907987d9", + "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" : "2a85c5cc-e74e-4435-adc9-24a76845349a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62A0F6EA\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1384f-201e-012e-67e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "2a85c5cc-e74e-4435-adc9-24a76845349a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailda937866a67e3/javablobcreateacfail1appendblobapitestcreateacfailda907987d9", + "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" : "328f8f5a-b600-4f03-ab42-99deb488d580" + }, + "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" : "94d13866-201e-012e-7ae5-64f6e4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:94d13866-201e-012e-7ae5-64f6e4000000\nTime:2019-09-06T18:59:46.4566092Z", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "328f8f5a-b600-4f03-ab42-99deb488d580", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3bf9fd08-c5f7-4f52-840b-a1ae0231e356" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13872-201e-012e-05e5-64f6e4000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfailda937866a67e3Fri, 06 Sep 2019 18:59:46 GMT\"0x8D732FC6299E6FF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "3bf9fd08-c5f7-4f52-840b-a1ae0231e356", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailda937866a67e3?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" : "f125b82d-6760-47dc-b7e7-b4568ef70671" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d1387c-201e-012e-0fe5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "f125b82d-6760-47dc-b7e7-b4568ef70671" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfailda937866a67e3", "javablobcreateacfail1appendblobapitestcreateacfailda907987d9" ] +} \ 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..290b947f1524 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailf377275550f11?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" : "2a5ebacc-eb28-4315-8c6e-172e2057c5d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62BD55B5\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13889-201e-012e-1ce5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "2a5ebacc-eb28-4315-8c6e-172e2057c5d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailf377275550f11/javablobcreateacfail1appendblobapitestcreateacfailf3793719d5", + "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" : "6fe22fef-2fd1-4bdc-b3c1-2c7d3af2979c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62C5C5B5\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13899-201e-012e-2ae5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "6fe22fef-2fd1-4bdc-b3c1-2c7d3af2979c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailf377275550f11/javablobcreateacfail1appendblobapitestcreateacfailf3793719d5", + "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" : "e7a2035a-da0c-4623-9a40-a58a6e8a12a8" + }, + "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" : "94d138d4-201e-012e-5ce5-64f6e4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:94d138d4-201e-012e-5ce5-64f6e4000000\nTime:2019-09-06T18:59:46.8519683Z", + "Date" : "Fri, 06 Sep 2019 18:59:45 GMT", + "x-ms-client-request-id" : "e7a2035a-da0c-4623-9a40-a58a6e8a12a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "494cf8bb-cc06-4374-aba0-df189a832c58" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d138e0-201e-012e-65e5-64f6e4000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfailf377275550f11Fri, 06 Sep 2019 18:59:46 GMT\"0x8D732FC62BD55B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "494cf8bb-cc06-4374-aba0-df189a832c58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailf377275550f11?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" : "1e604916-8eee-450a-8185-7c41b9b7bd24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d138e8-201e-012e-6de5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "1e604916-8eee-450a-8185-7c41b9b7bd24" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfailf377275550f11", "javablobcreateacfail1appendblobapitestcreateacfailf3793719d5" ] +} \ 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..f3a02ce50a16 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail4a49377186e35?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" : "514755d8-cf96-4bc4-9edd-a2ded84afd60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC62F9341D\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d138fa-201e-012e-7be5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "514755d8-cf96-4bc4-9edd-a2ded84afd60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail4a49377186e35/javablobcreateacfail1appendblobapitestcreateacfail4a466024c9", + "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" : "4d9f2ebf-6fa4-4f84-899f-defd189f65cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6300E0FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1390d-201e-012e-07e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "4d9f2ebf-6fa4-4f84-899f-defd189f65cd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail4a49377186e35/javablobcreateacfail1appendblobapitestcreateacfail4a466024c9", + "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" : "3c96b0a8-2eb5-408a-bd73-3585e18c5d76" + }, + "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" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:46 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" : "\"0x8D732FC6300E0FB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:47 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "94d1391e-201e-012e-17e5-64f6e4000000", + "x-ms-client-request-id" : "3c96b0a8-2eb5-408a-bd73-3585e18c5d76", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail4a49377186e35/javablobcreateacfail1appendblobapitestcreateacfail4a466024c9", + "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" : "6c6c47fa-98f8-41f8-91fa-16880c5021dc" + }, + "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" : "94d13939-201e-012e-2ce5-64f6e4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:94d13939-201e-012e-2ce5-64f6e4000000\nTime:2019-09-06T18:59:47.1182094Z", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "6c6c47fa-98f8-41f8-91fa-16880c5021dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "401ccf1f-2324-4895-ae0f-e7d4221746bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13944-201e-012e-36e5-64f6e4000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail4a49377186e35Fri, 06 Sep 2019 18:59:46 GMT\"0x8D732FC62F9341D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "401ccf1f-2324-4895-ae0f-e7d4221746bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail4a49377186e35?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" : "09fbc669-3be6-4513-957c-58f10d5f9e39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13951-201e-012e-40e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "09fbc669-3be6-4513-957c-58f10d5f9e39" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail4a49377186e35", "javablobcreateacfail1appendblobapitestcreateacfail4a466024c9" ] +} \ 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..a4e30d04d927 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaila5b55892ce945?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" : "4f21af1f-a6c3-49c8-8575-e1ba1556612f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC631EC63C\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1395b-201e-012e-4ae5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "4f21af1f-a6c3-49c8-8575-e1ba1556612f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaila5b55892ce945/javablobcreateacfail1appendblobapitestcreateacfaila5b610868b", + "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" : "cf5ef3b3-9455-43ed-b428-5001eb676ccd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC63262510\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1396b-201e-012e-57e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "cf5ef3b3-9455-43ed-b428-5001eb676ccd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaila5b55892ce945/javablobcreateacfail1appendblobapitestcreateacfaila5b610868b?comp=lease", + "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" : "faede192-29cd-420a-a2e1-3e0597b00d4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC63262510\"", + "x-ms-lease-id" : "89ef4288-b547-449c-b0ef-bc9e22d9429b", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13974-201e-012e-60e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "faede192-29cd-420a-a2e1-3e0597b00d4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaila5b55892ce945/javablobcreateacfail1appendblobapitestcreateacfaila5b610868b", + "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" : "27bfec00-19bf-4c0a-8f71-75d611537cf1" + }, + "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" : "94d1397c-201e-012e-68e5-64f6e4000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:94d1397c-201e-012e-68e5-64f6e4000000\nTime:2019-09-06T18:59:47.3594299Z", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "27bfec00-19bf-4c0a-8f71-75d611537cf1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f9624b15-0f29-4435-8505-4e442aa7b505" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d1398d-201e-012e-76e5-64f6e4000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfaila5b55892ce945Fri, 06 Sep 2019 18:59:47 GMT\"0x8D732FC631EC63C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "f9624b15-0f29-4435-8505-4e442aa7b505", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaila5b55892ce945?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" : "a4348164-bf89-489e-a006-953e86e3b383" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d139a2-201e-012e-07e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:46 GMT", + "x-ms-client-request-id" : "a4348164-bf89-489e-a006-953e86e3b383" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfaila5b55892ce945", "javablobcreateacfail1appendblobapitestcreateacfaila5b610868b" ] +} \ 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..0842725b9e0f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsa71243519b5?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" : "293559b7-9f63-46c4-8768-4b27d3887636" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC5FFB9688\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13176-201e-012e-1fe5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:41 GMT", + "x-ms-client-request-id" : "293559b7-9f63-46c4-8768-4b27d3887636" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsa71243519b5/javablobcreatedefaults1appendblobapitestcreatedefaultsa7114451", + "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" : "049ff2a2-c22d-497b-b304-e2e03e8ea3da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC602FFE81\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13232-201e-012e-34e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:41 GMT", + "x-ms-client-request-id" : "049ff2a2-c22d-497b-b304-e2e03e8ea3da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsa71243519b5/javablobcreatedefaults1appendblobapitestcreatedefaultsa7114451", + "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" : "57d1a2ea-710a-4efb-8e84-ccb5ee8c9a22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6046991B\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13268-201e-012e-5fe5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:41 GMT", + "x-ms-client-request-id" : "57d1a2ea-710a-4efb-8e84-ccb5ee8c9a22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1569340a-21ac-44ac-a773-35d3da333f49" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d132a4-201e-012e-11e5-64f6e4000000", + "Body" : "jtccreatedefaultsjtccreatedefaults0appendblobapitestcreatedefaultsa71243519b5Fri, 06 Sep 2019 18:59:41 GMT\"0x8D732FC5FFB9688\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:41 GMT", + "x-ms-client-request-id" : "1569340a-21ac-44ac-a773-35d3da333f49", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsa71243519b5?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" : "4345a3ce-24b1-4909-9dbc-6412db54b41b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d132d0-201e-012e-37e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:41 GMT", + "x-ms-client-request-id" : "4345a3ce-24b1-4909-9dbc-6412db54b41b" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatedefaults0appendblobapitestcreatedefaultsa71243519b5", "javablobcreatedefaults1appendblobapitestcreatedefaultsa7114451" ] +} \ 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..f5464b5e5ccc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror85a89254a15b16?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" : "e7e70d51-7279-434d-9aca-f74d9be0d7b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC60AEE35B\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1335a-201e-012e-2be5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "e7e70d51-7279-434d-9aca-f74d9be0d7b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror85a89254a15b16/javablobcreateerror1appendblobapitestcreateerror85a63609df7", + "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" : "4168c806-23a6-4d8c-85b1-80408c96fe41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC60B66568\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1336b-201e-012e-3ae5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "4168c806-23a6-4d8c-85b1-80408c96fe41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror85a89254a15b16/javablobcreateerror1appendblobapitestcreateerror85a63609df7", + "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" : "74858330-2167-421c-83ea-ed434354e664" + }, + "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" : "94d1337f-201e-012e-4ce5-64f6e4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:94d1337f-201e-012e-4ce5-64f6e4000000\nTime:2019-09-06T18:59:43.2326916Z", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "74858330-2167-421c-83ea-ed434354e664", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "afc3a64b-7aef-483b-a2db-e50de6d42b20" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13385-201e-012e-52e5-64f6e4000000", + "Body" : "jtccreateerrorjtccreateerror0appendblobapitestcreateerror85a89254a15b16Fri, 06 Sep 2019 18:59:43 GMT\"0x8D732FC60AEE35B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "afc3a64b-7aef-483b-a2db-e50de6d42b20", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror85a89254a15b16?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" : "1f0a20bc-a24c-4ed8-b5ea-ae0d9987290c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13390-201e-012e-5be5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "1f0a20bc-a24c-4ed8-b5ea-ae0d9987290c" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0appendblobapitestcreateerror85a89254a15b16", "javablobcreateerror1appendblobapitestcreateerror85a63609df7" ] +} \ 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..a5f0329d4696 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersd0535214d9d0?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" : "07419927-ea63-4086-a7d9-0001f7d66506" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC60D9587E\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d133a7-201e-012e-6ce5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "07419927-ea63-4086-a7d9-0001f7d66506" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersd0535214d9d0/javablobcreateheaders1appendblobapitestcreateheadersd05875002", + "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" : "73f6be6f-0a90-42ec-bb3a-4b70fb0e12c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC60EC0115\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d133c0-201e-012e-80e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "73f6be6f-0a90-42ec-bb3a-4b70fb0e12c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersd0535214d9d0/javablobcreateheaders1appendblobapitestcreateheadersd05875002", + "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" : "9c266853-2b26-4cee-b4e1-44dbcd3c4561" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC60F37CEE\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d133cd-201e-012e-0de5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "9c266853-2b26-4cee-b4e1-44dbcd3c4561" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersd0535214d9d0/javablobcreateheaders1appendblobapitestcreateheadersd05875002", + "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" : "d668d35d-ec93-4c24-9241-9e213874b5cf" + }, + "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" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:42 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" : "\"0x8D732FC60F37CEE\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:43 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "94d133dc-201e-012e-18e5-64f6e4000000", + "x-ms-client-request-id" : "d668d35d-ec93-4c24-9241-9e213874b5cf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dff8845a-8f0a-4583-93a2-347a03dcf7f5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d133ec-201e-012e-27e5-64f6e4000000", + "Body" : "jtccreateheadersjtccreateheaders0appendblobapitestcreateheadersd0535214d9d0Fri, 06 Sep 2019 18:59:43 GMT\"0x8D732FC60D9587E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "dff8845a-8f0a-4583-93a2-347a03dcf7f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersd0535214d9d0?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" : "16db244f-6181-4ab9-a991-052967e2ee6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d133f8-201e-012e-30e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "16db244f-6181-4ab9-a991-052967e2ee6f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0appendblobapitestcreateheadersd0535214d9d0", "javablobcreateheaders1appendblobapitestcreateheadersd05875002" ] +} \ 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..83412396b2a3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersce244553abf8?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" : "4979776c-4b55-4c1c-b6fc-139019f8f08b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61133A9D\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13403-201e-012e-39e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "4979776c-4b55-4c1c-b6fc-139019f8f08b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersce244553abf8/javablobcreateheaders1appendblobapitestcreateheadersce2911172", + "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" : "6f4ea7bf-1cf4-4f03-bfd1-236d5c907f1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC611B59B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1341d-201e-012e-4de5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "6f4ea7bf-1cf4-4f03-bfd1-236d5c907f1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersce244553abf8/javablobcreateheaders1appendblobapitestcreateheadersce2911172", + "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" : "f5aa59fa-e587-4f99-8fa9-7b556745cc3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6123990E\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13437-201e-012e-60e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "f5aa59fa-e587-4f99-8fa9-7b556745cc3f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersce244553abf8/javablobcreateheaders1appendblobapitestcreateheadersce2911172", + "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" : "bbd64c3f-e844-4b14-be8b-1e3ea1422b85" + }, + "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" : "Fri, 06 Sep 2019 18:59:43 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" : "Fri, 06 Sep 2019 18:59:43 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "94d13449-201e-012e-70e5-64f6e4000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-blob-committed-block-count" : "0", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D732FC6123990E\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "bbd64c3f-e844-4b14-be8b-1e3ea1422b85", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6a1779cb-1e88-42a5-bb2f-c8e8646e9312" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d13459-201e-012e-7fe5-64f6e4000000", + "Body" : "jtccreateheadersjtccreateheaders0appendblobapitestcreateheadersce244553abf8Fri, 06 Sep 2019 18:59:43 GMT\"0x8D732FC61133A9D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "6a1779cb-1e88-42a5-bb2f-c8e8646e9312", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheadersce244553abf8?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" : "5a9ce145-4215-423b-b8c6-aa69bcb97bd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13463-201e-012e-08e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "5a9ce145-4215-423b-b8c6-aa69bcb97bd5" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0appendblobapitestcreateheadersce244553abf8", "javablobcreateheaders1appendblobapitestcreateheadersce2911172" ] +} \ 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..7ea9a5ef6216 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8?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" : "2b30a0c8-1d25-4999-9427-3756bcd98070" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC613EE8AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13484-201e-012e-1ee5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "2b30a0c8-1d25-4999-9427-3756bcd98070" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8/javablobcreatemetadata1appendblobapitestcreatemetadata19d09680", + "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" : "b23fd1db-1b44-42a5-8640-9264cac794c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC614692AE\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1349f-201e-012e-33e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "b23fd1db-1b44-42a5-8640-9264cac794c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8/javablobcreatemetadata1appendblobapitestcreatemetadata19d09680", + "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" : "86b428ce-4ebe-4b62-a673-09fd92573d5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC614CFCCB\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d134b0-201e-012e-41e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "86b428ce-4ebe-4b62-a673-09fd92573d5b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8/javablobcreatemetadata1appendblobapitestcreatemetadata19d09680", + "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" : "2bee6620-386e-4580-9071-c199f2943ff9" + }, + "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" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59: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" : "\"0x8D732FC614CFCCB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:44 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "94d134bf-201e-012e-4fe5-64f6e4000000", + "x-ms-client-request-id" : "2bee6620-386e-4580-9071-c199f2943ff9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "73d6250d-94b4-4a14-a8d2-16d5d37b8f4e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d134cd-201e-012e-5ae5-64f6e4000000", + "Body" : "jtccreatemetadatajtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8Fri, 06 Sep 2019 18:59:44 GMT\"0x8D732FC613EE8AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "73d6250d-94b4-4a14-a8d2-16d5d37b8f4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8?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" : "4473a558-c487-4071-9b9b-06e50f9ab8e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d134e3-201e-012e-6ce5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "4473a558-c487-4071-9b9b-06e50f9ab8e2" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0appendblobapitestcreatemetadata19d55018fb8", "javablobcreatemetadata1appendblobapitestcreatemetadata19d09680" ] +} \ 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..c3ae084c03d1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata08e89708aca?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" : "eab6bce6-fbca-450d-b610-1fd16d014f6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6179B56D\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13511-201e-012e-13e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "eab6bce6-fbca-450d-b610-1fd16d014f6b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata08e89708aca/javablobcreatemetadata1appendblobapitestcreatemetadata08e82870", + "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" : "2bb60578-0219-4628-b8e7-c27b1be8e604" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC6180C357\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d1351d-201e-012e-1de5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "2bb60578-0219-4628-b8e7-c27b1be8e604" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata08e89708aca/javablobcreatemetadata1appendblobapitestcreatemetadata08e82870", + "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" : "e11ae31b-73a8-4714-9234-55de34619c24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC61872D7B\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13530-201e-012e-2be5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "e11ae31b-73a8-4714-9234-55de34619c24" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata08e89708aca/javablobcreatemetadata1appendblobapitestcreatemetadata08e82870", + "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" : "69b25efd-1d92-49af-9d03-078eb95767fb" + }, + "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" : "Fri, 06 Sep 2019 18:59:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 18:59:43 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" : "\"0x8D732FC61872D7B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 18:59:44 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "94d1355f-201e-012e-53e5-64f6e4000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "69b25efd-1d92-49af-9d03-078eb95767fb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "55acef48-557b-4088-ae82-6546fc3854b5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d1356c-201e-012e-5ce5-64f6e4000000", + "Body" : "jtccreatemetadatajtccreatemetadata0appendblobapitestcreatemetadata08e89708acaFri, 06 Sep 2019 18:59:44 GMT\"0x8D732FC6179B56D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "55acef48-557b-4088-ae82-6546fc3854b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata08e89708aca?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" : "b6ca62d1-f7ee-42f5-9145-c3a5663deb9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d13577-201e-012e-65e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:43 GMT", + "x-ms-client-request-id" : "b6ca62d1-f7ee-42f5-9145-c3a5663deb9f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0appendblobapitestcreatemetadata08e89708aca", "javablobcreatemetadata1appendblobapitestcreatemetadata08e82870" ] +} \ 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..daa310e1cc78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin3c010336acc35bd6?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" : "aec7bc52-8b42-43f4-8915-b944bec437c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC608ED0C8\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d132e2-201e-012e-48e5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "aec7bc52-8b42-43f4-8915-b944bec437c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin3c010336acc35bd6/javablobcreatemin1appendblobapitestcreatemin3c0176791d316", + "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" : "0d24f662-5710-4fe4-bba2-18f1080ddea0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC609679C5\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13313-201e-012e-70e5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "0d24f662-5710-4fe4-bba2-18f1080ddea0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin3c010336acc35bd6/javablobcreatemin1appendblobapitestcreatemin3c0176791d316", + "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" : "dd4976a2-e99e-4d3e-8d0a-c9eea0ada570" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC609C4786\"", + "Last-Modified" : "Fri, 06 Sep 2019 18:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "94d13322-201e-012e-7ce5-64f6e4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "dd4976a2-e99e-4d3e-8d0a-c9eea0ada570" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4b72c04e-1d55-4821-ac61-83fff24b6b5e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "94d1332f-201e-012e-07e5-64f6e4000000", + "Body" : "jtccreateminjtccreatemin0appendblobapitestcreatemin3c010336acc35bd6Fri, 06 Sep 2019 18:59:42 GMT\"0x8D732FC608ED0C8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "4b72c04e-1d55-4821-ac61-83fff24b6b5e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin3c010336acc35bd6?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" : "62af4802-9905-42fb-8aa2-e0549fbde633" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "94d1334d-201e-012e-1fe5-64f6e4000000", + "Date" : "Fri, 06 Sep 2019 18:59:42 GMT", + "x-ms-client-request-id" : "62af4802-9905-42fb-8aa2-e0549fbde633" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0appendblobapitestcreatemin3c010336acc35bd6", "javablobcreatemin1appendblobapitestcreatemin3c0176791d316" ] +} \ 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..3375df1ec2f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json @@ -0,0 +1,219 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy69015152a1e5869ee2e?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" : "3b08d23a-22e2-466b-9f46-21e441e52e1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9CCD96E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92be94e-d01e-009e-5fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "x-ms-client-request-id" : "3b08d23a-22e2-466b-9f46-21e441e52e1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy69015152a1e5869ee2e/javablobabortcopy1blobapitestabortcopy69071831c6c680a8", + "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" : "15b4806d-1d68-448d-af3a-3ec5c7ec4f37", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9CDDF99A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92be981-d01e-009e-06e5-644931000000", + "x-ms-client-request-id" : "15b4806d-1d68-448d-af3a-3ec5c7ec4f37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy69015152a1e5869ee2e/javablobabortcopy1blobapitestabortcopy69071831c6c680a8", + "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" : "a13cee55-0401-429b-bbf9-07e57b0724cd", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Uyz21+EkpQc=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "Content-MD5" : "X3DfmfiGfy3iEdNSVVv/1g==", + "ETag" : "\"0x8D732FC9D42517C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bea53-d01e-009e-3ae5-644931000000", + "x-ms-client-request-id" : "a13cee55-0401-429b-bbf9-07e57b0724cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy69015152a1e5869ee2e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e20a612e-e3c3-4ccd-9b60-6419074121ba", + "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" : "\"0x8D732FC9D59A3E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92becf9-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "e20a612e-e3c3-4ccd-9b60-6419074121ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy69029683800b21e9?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" : "473eed56-6031-46a0-bc20-5c88083444af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9D5E7760\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f16f51-301e-004b-32e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "473eed56-6031-46a0-bc20-5c88083444af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy69029683800b21e9/javablobabortcopy3blobapitestabortcopy690312056f0e4158", + "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" : "f0ee2525-f43e-46c5-815c-877a115a7a1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "cceb28f9-c238-48b0-9dbb-9d221cbd6987", + "ETag" : "\"0x8D732FC9D65584B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "b8f16f67-301e-004b-40e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "f0ee2525-f43e-46c5-815c-877a115a7a1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy69029683800b21e9/javablobabortcopy3blobapitestabortcopy690312056f0e4158?copyid=cceb28f9-c238-48b0-9dbb-9d221cbd6987&comp=copy", + "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" : "beea559e-288d-4a14-bf53-47677d173128" + }, + "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" : "b8f16f86-301e-004b-5ce5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "beea559e-288d-4a14-bf53-47677d173128" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy69029683800b21e9?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" : "bfae5d27-f90c-4e49-9ed1-c562d6b097c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f16fb1-301e-004b-01e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "bfae5d27-f90c-4e49-9ed1-c562d6b097c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "861cad53-4f1d-4529-804b-01fd9506da18" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bedd9-d01e-009e-58e5-644931000000", + "Body" : "jtcabortcopyjtcabortcopy0blobapitestabortcopy69015152a1e5869ee2eFri, 06 Sep 2019 19:01:24 GMT\"0x8D732FC9D59A3E0\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "861cad53-4f1d-4529-804b-01fd9506da18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy69015152a1e5869ee2e?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" : "217ed723-5f67-4df7-9b48-28429de84696" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bee02-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "217ed723-5f67-4df7-9b48-28429de84696" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopy0blobapitestabortcopy69015152a1e5869ee2e", "javablobabortcopy1blobapitestabortcopy69071831c6c680a8", "64ff5144-d6cb-491b-a16e-7df200580a89", "javablobabortcopy2blobapitestabortcopy69029683800b21e9", "javablobabortcopy3blobapitestabortcopy690312056f0e4158" ] +} \ 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..760d01a34d29 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror9274918474a314?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" : "c22b764f-812c-46f8-a953-fbeee2ce61f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9FAB47BE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bfcea-d01e-009e-5de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "c22b764f-812c-46f8-a953-fbeee2ce61f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror9274918474a314/javablobabortcopyerror1blobapitestabortcopyerror9277456393d", + "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" : "1fa50441-0328-499c-9787-f1175254a8de", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9FB0FF6C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bfd12-d01e-009e-7fe5-644931000000", + "x-ms-client-request-id" : "1fa50441-0328-499c-9787-f1175254a8de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror9274918474a314/javablobabortcopyerror2blobapitestabortcopyerror92729909346?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2431535-6fd3-42db-a656-5e8e6ccd4e0d" + }, + "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" : "b92bfd3d-d01e-009e-26e5-644931000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b92bfd3d-d01e-009e-26e5-644931000000\nTime:2019-09-06T19:01:28.8934974Zcopyididcopyid needs to be valid Guid.", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "d2431535-6fd3-42db-a656-5e8e6ccd4e0d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "27fd5333-80c2-4241-9df8-4b94622a0ff7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bfd68-d01e-009e-4be5-644931000000", + "Body" : "jtcabortcopyerrorjtcabortcopyerror0blobapitestabortcopyerror9274918474a314Fri, 06 Sep 2019 19:01:28 GMT\"0x8D732FC9FAB47BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "27fd5333-80c2-4241-9df8-4b94622a0ff7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror9274918474a314?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" : "2d1d3af4-d1f4-4337-97fc-9b19f26f2474" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bfd89-d01e-009e-6be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "2d1d3af4-d1f4-4337-97fc-9b19f26f2474" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopyerror0blobapitestabortcopyerror9274918474a314", "javablobabortcopyerror1blobapitestabortcopyerror9277456393d", "javablobabortcopyerror2blobapitestabortcopyerror92729909346" ] +} \ 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..bb1bb749a82a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json @@ -0,0 +1,266 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3f?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" : "53e63464-7365-4dc9-851a-96248d6dee7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9E457222\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bf313-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:26 GMT", + "x-ms-client-request-id" : "53e63464-7365-4dc9-851a-96248d6dee7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3f/javablobabortcopylease1blobapitestabortcopyleaseb9f76387d41", + "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" : "ba1e73d4-b753-4732-be10-e1ce01efee25", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9E4C1154\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bf350-d01e-009e-3ce5-644931000000", + "x-ms-client-request-id" : "ba1e73d4-b753-4732-be10-e1ce01efee25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3f/javablobabortcopylease1blobapitestabortcopyleaseb9f76387d41", + "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" : "9174f15a-9fa7-4416-b40c-d2bbc8da34a6", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "vKmbXL7yolc=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "Content-MD5" : "SNaOkFYAdannbQMuZOWkUQ==", + "ETag" : "\"0x8D732FC9EE36C3F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bf3c3-d01e-009e-25e5-644931000000", + "x-ms-client-request-id" : "9174f15a-9fa7-4416-b40c-d2bbc8da34a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fe00fbc9-f4b3-4399-bebc-bf52a3c0ea45", + "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" : "\"0x8D732FC9EEFC130\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bf7e6-d01e-009e-63e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "x-ms-client-request-id" : "fe00fbc9-f4b3-4399-bebc-bf52a3c0ea45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d?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" : "c80033d7-0c00-434e-8098-de3b753156c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9EF643B9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1747e-301e-004b-30e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "x-ms-client-request-id" : "c80033d7-0c00-434e-8098-de3b753156c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d/javablobabortcopylease3blobapitestabortcopyleaseb9f41549874", + "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" : "11cd4360-ef5b-4a63-8fac-2e1a0507fa6c", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9EFCAEA4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1748d-301e-004b-3de5-64feb1000000", + "x-ms-client-request-id" : "11cd4360-ef5b-4a63-8fac-2e1a0507fa6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d/javablobabortcopylease3blobapitestabortcopyleaseb9f41549874?comp=lease", + "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" : "0fc2c46f-7a68-4f70-9305-008d9dd95e20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9EFCAEA4\"", + "x-ms-lease-id" : "4aeb2e2f-f6c3-474a-9639-c483c0df6431", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f17585-301e-004b-15e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "x-ms-client-request-id" : "0fc2c46f-7a68-4f70-9305-008d9dd95e20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d/javablobabortcopylease3blobapitestabortcopyleaseb9f41549874", + "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" : "28b7ea10-3f42-4e04-b6b5-b8ed95a7d81e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "a59d6ca8-1351-4b04-9e7b-0773fa9e92d9", + "ETag" : "\"0x8D732FC9F593CF0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "b8f17594-301e-004b-21e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "x-ms-client-request-id" : "28b7ea10-3f42-4e04-b6b5-b8ed95a7d81e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d/javablobabortcopylease3blobapitestabortcopyleaseb9f41549874?copyid=a59d6ca8-1351-4b04-9e7b-0773fa9e92d9&comp=copy", + "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" : "2607307a-026b-4b30-94ea-19f90fd3d2aa" + }, + "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" : "b8f175d1-301e-004b-53e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "x-ms-client-request-id" : "2607307a-026b-4b30-94ea-19f90fd3d2aa" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d?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" : "3714e475-5e23-4a3f-b8ab-dcd61f5e78b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f175de-301e-004b-5de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:27 GMT", + "x-ms-client-request-id" : "3714e475-5e23-4a3f-b8ab-dcd61f5e78b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "973c4f1f-d78a-42f8-b73b-dd2d5d3c5c25" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bfb5c-d01e-009e-75e5-644931000000", + "Body" : "jtcabortcopyleasejtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3fFri, 06 Sep 2019 19:01:27 GMT\"0x8D732FC9EEFC130\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "973c4f1f-d78a-42f8-b73b-dd2d5d3c5c25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3f?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" : "4d4d5b3b-dc8e-45d2-931e-7dcf913640c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bfb81-d01e-009e-15e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "4d4d5b3b-dc8e-45d2-931e-7dcf913640c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopylease0blobapitestabortcopyleaseb9f78239d3cf3f", "javablobabortcopylease1blobapitestabortcopyleaseb9f76387d41", "e9b2b787-8264-46f3-b466-2bc7b9f750ec", "jtcabortcopylease2blobapitestabortcopyleaseb9f5101708820d", "javablobabortcopylease3blobapitestabortcopyleaseb9f41549874" ] +} \ 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..8725906d2116 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json @@ -0,0 +1,269 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932?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" : "d07f4160-c23c-4d54-bad0-ffe2b06c25fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9B476077\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bdec9-d01e-009e-71e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "x-ms-client-request-id" : "d07f4160-c23c-4d54-bad0-ffe2b06c25fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932/javablobabortcopyleasefail16187873e5d41a8958404", + "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" : "1d1b40ad-8432-490f-8a34-885272afadd0", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9B4D849F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bdeeb-d01e-009e-0fe5-644931000000", + "x-ms-client-request-id" : "1d1b40ad-8432-490f-8a34-885272afadd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932/javablobabortcopyleasefail16187873e5d41a8958404", + "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" : "f56854cf-9cdf-42bd-9a1a-109c38cab214", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "aRVrGtLU7DI=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "Content-MD5" : "KjVChE9s87RF9iPeYM2Kfw==", + "ETag" : "\"0x8D732FC9BAE593A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bdf2c-d01e-009e-47e5-644931000000", + "x-ms-client-request-id" : "f56854cf-9cdf-42bd-9a1a-109c38cab214" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1d9ade97-c963-410e-a9a9-ae2148dc0901", + "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" : "\"0x8D732FC9BC31146\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92be1ff-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "x-ms-client-request-id" : "1d9ade97-c963-410e-a9a9-ae2148dc0901" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail225107eec2b110abe9427?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" : "7a56ac89-b86c-4c95-94df-c70f05554a9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9C34F114\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f16ac0-301e-004b-34e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:22 GMT", + "x-ms-client-request-id" : "7a56ac89-b86c-4c95-94df-c70f05554a9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail225107eec2b110abe9427/javablobabortcopyleasefail3429336bc8eeb888484de", + "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" : "e9353fad-6b3e-49cb-bbb0-d8f479240b72", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9C40B567\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f16af2-301e-004b-5ce5-64feb1000000", + "x-ms-client-request-id" : "e9353fad-6b3e-49cb-bbb0-d8f479240b72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail225107eec2b110abe9427/javablobabortcopyleasefail3429336bc8eeb888484de?comp=lease", + "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" : "a5720fc0-6a16-4baa-bfc5-d49305ea0b41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9C40B567\"", + "x-ms-lease-id" : "b9610a23-5291-4117-8136-e29ae7cd554d", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f16b0d-301e-004b-73e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:22 GMT", + "x-ms-client-request-id" : "a5720fc0-6a16-4baa-bfc5-d49305ea0b41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail225107eec2b110abe9427/javablobabortcopyleasefail3429336bc8eeb888484de", + "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" : "5da290e3-3b54-4b5f-ad59-e18811843dcf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d0312fce-92b6-4a50-bbf8-f962899a7aa3", + "ETag" : "\"0x8D732FC9CAC628C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "b8f16b2a-301e-004b-0de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "x-ms-client-request-id" : "5da290e3-3b54-4b5f-ad59-e18811843dcf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail225107eec2b110abe9427/javablobabortcopyleasefail3429336bc8eeb888484de?copyid=d0312fce-92b6-4a50-bbf8-f962899a7aa3&comp=copy", + "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" : "563157a7-d4a0-4ca9-b1ca-fe4aaca1a51f" + }, + "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" : "b8f16d1d-301e-004b-46e5-64feb1000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b8f16d1d-301e-004b-46e5-64feb1000000\nTime:2019-09-06T19:01:23.8585310Z", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "x-ms-client-request-id" : "563157a7-d4a0-4ca9-b1ca-fe4aaca1a51f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail225107eec2b110abe9427?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" : "5049710d-58b7-47d8-a9d5-1dd1b5c82b1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f16d6e-301e-004b-14e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "x-ms-client-request-id" : "5049710d-58b7-47d8-a9d5-1dd1b5c82b1e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2fabe16d-f8e1-4360-bcda-38760982a02e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92be8fa-d01e-009e-1be5-644931000000", + "Body" : "jtcabortcopyleasefailjtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932Fri, 06 Sep 2019 19:01:22 GMT\"0x8D732FC9BC31146\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "x-ms-client-request-id" : "2fabe16d-f8e1-4360-bcda-38760982a02e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932?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" : "2ce564ae-2ecd-4657-849e-bcebdce6b824" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92be921-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:23 GMT", + "x-ms-client-request-id" : "2ce564ae-2ecd-4657-849e-bcebdce6b824" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopyleasefail0blobapitestabortcopyleasefailfff0138932", "javablobabortcopyleasefail16187873e5d41a8958404", "53964f85-584b-4f71-a20b-56aa1754b61f", "javablobabortcopyleasefail225107eec2b110abe9427", "javablobabortcopyleasefail3429336bc8eeb888484de" ] +} \ 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..4a55117600da --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json @@ -0,0 +1,200 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75?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" : "a7221b91-403a-40be-b136-7d3f9a9894fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9D868A0A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bee43-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "x-ms-client-request-id" : "a7221b91-403a-40be-b136-7d3f9a9894fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75/javablobabortcopymin1blobapitestabortcopyminbd730298cd16e", + "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" : "50065184-bf88-4819-aa6f-9d112fc90937", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9D8C6466\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bee6a-d01e-009e-5be5-644931000000", + "x-ms-client-request-id" : "50065184-bf88-4819-aa6f-9d112fc90937" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75/javablobabortcopymin1blobapitestabortcopyminbd730298cd16e", + "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" : "9d847142-65d7-4b7c-a2a6-1d01e799e7b7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "13phUWkc24c=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:25 GMT", + "Content-MD5" : "KUrSDo5TZ17sxdKKmx0ogw==", + "ETag" : "\"0x8D732FC9DF949D5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92beea0-d01e-009e-0de5-644931000000", + "x-ms-client-request-id" : "9d847142-65d7-4b7c-a2a6-1d01e799e7b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0c3ef31c-8f01-49f3-8e6f-29ef3979e061", + "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" : "\"0x8D732FC9E061300\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bf152-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:25 GMT", + "x-ms-client-request-id" : "0c3ef31c-8f01-49f3-8e6f-29ef3979e061" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopyminbd749890370e4?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" : "6f8ae919-e2d1-421d-801e-0667770784aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9E0BD19B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1718f-301e-004b-21e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:25 GMT", + "x-ms-client-request-id" : "6f8ae919-e2d1-421d-801e-0667770784aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopyminbd749890370e4/javablobabortcopymin3blobapitestabortcopyminbd720073b9ac2", + "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" : "3ed65136-df2f-4aff-b059-1158490e8386" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "dc780621-2900-4fef-8df1-73c2790cf48c", + "ETag" : "\"0x8D732FC9E28D79E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "b8f171ad-301e-004b-3de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:25 GMT", + "x-ms-client-request-id" : "3ed65136-df2f-4aff-b059-1158490e8386" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopyminbd749890370e4/javablobabortcopymin3blobapitestabortcopyminbd720073b9ac2?copyid=dc780621-2900-4fef-8df1-73c2790cf48c&comp=copy", + "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" : "81c83d14-a1ca-486e-bcd4-695f6e7a2f33" + }, + "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" : "b8f1722b-301e-004b-28e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:25 GMT", + "x-ms-client-request-id" : "81c83d14-a1ca-486e-bcd4-695f6e7a2f33" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc25b6fe-fdab-4502-99aa-752636f0a6d0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bf2c2-d01e-009e-3ce5-644931000000", + "Body" : "jtcabortcopyminjtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75Fri, 06 Sep 2019 19:01:26 GMT\"0x8D732FC9E061300\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:26 GMT", + "x-ms-client-request-id" : "bc25b6fe-fdab-4502-99aa-752636f0a6d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75?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" : "50a736b7-2596-4a9b-9773-819c02a59fe2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bf2e2-d01e-009e-58e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:26 GMT", + "x-ms-client-request-id" : "50a736b7-2596-4a9b-9773-819c02a59fe2" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopymin0blobapitestabortcopyminbd745357bf30ef75", "javablobabortcopymin1blobapitestabortcopyminbd730298cd16e", "039012f0-5ec3-4e65-8d14-9856758ae13f", "javablobabortcopymin2blobapitestabortcopyminbd749890370e4", "javablobabortcopymin3blobapitestabortcopyminbd720073b9ac2" ] +} \ 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..703edb597c1e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasefc82156812e80bbc?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" : "8257069c-3dc6-4e19-831b-8c4bd0202b9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7E6C603F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b23eb-d01e-009e-17e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "8257069c-3dc6-4e19-831b-8c4bd0202b9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasefc82156812e80bbc/javablobacquirelease1blobapitestacquireleasefc8938869d424", + "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" : "a71a9039-cb6f-4c6f-8c0f-3d559ee8c37f", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7E73D148\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2418-d01e-009e-40e5-644931000000", + "x-ms-client-request-id" : "a71a9039-cb6f-4c6f-8c0f-3d559ee8c37f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasefc82156812e80bbc/javablobacquirelease1blobapitestacquireleasefc8938869d424?comp=lease", + "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" : "e31a270b-0f1f-42d4-821e-f3a26081e1f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7E73D148\"", + "x-ms-lease-id" : "28ced4f7-e30d-4769-a3b7-9561490b1b4b", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2443-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "e31a270b-0f1f-42d4-821e-f3a26081e1f5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasefc82156812e80bbc/javablobacquirelease1blobapitestacquireleasefc8938869d424", + "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" : "91c519e6-eafb-44c1-bff3-2474e25d68f8" + }, + "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" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7E73D148\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "b92b2472-d01e-009e-14e5-644931000000", + "x-ms-client-request-id" : "91c519e6-eafb-44c1-bff3-2474e25d68f8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9c39cf9f-f2cc-4ba5-8055-70d509da7133" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b249f-d01e-009e-3be5-644931000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquireleasefc82156812e80bbcFri, 06 Sep 2019 19:00:33 GMT\"0x8D732FC7E6C603F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "9c39cf9f-f2cc-4ba5-8055-70d509da7133", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasefc82156812e80bbc?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" : "196c3eca-79e4-4376-8646-90850c0d56df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b24cd-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "196c3eca-79e4-4376-8646-90850c0d56df" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquireleasefc82156812e80bbc", "javablobacquirelease1blobapitestacquireleasefc8938869d424" ] +} \ 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..874abbcc3cc0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease9824385563e04c7f?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" : "bac6e2eb-6a9e-4a41-bf0b-7ffc2786bc15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7E968729\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b24f3-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "bac6e2eb-6a9e-4a41-bf0b-7ffc2786bc15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease9824385563e04c7f/javablobacquirelease1blobapitestacquirelease98222921a6dcc", + "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" : "abdca77c-aa1d-4834-93b3-7b1c2f9988e8", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7EA01BE8\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b250a-d01e-009e-1be5-644931000000", + "x-ms-client-request-id" : "abdca77c-aa1d-4834-93b3-7b1c2f9988e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease9824385563e04c7f/javablobacquirelease1blobapitestacquirelease98222921a6dcc?comp=lease", + "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" : "45d36371-8ea3-4905-9209-b552761729d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7EA01BE8\"", + "x-ms-lease-id" : "7b8248f5-2b2c-4a8b-be28-b28112d316eb", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b253a-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "45d36371-8ea3-4905-9209-b552761729d7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease9824385563e04c7f/javablobacquirelease1blobapitestacquirelease98222921a6dcc", + "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" : "d96f0f85-5d16-474f-935d-5603a9be1c53" + }, + "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" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7EA01BE8\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-lease-duration" : "fixed", + "Content-Length" : "7", + "x-ms-request-id" : "b92b25a3-d01e-009e-26e5-644931000000", + "x-ms-client-request-id" : "d96f0f85-5d16-474f-935d-5603a9be1c53", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ed49043c-8fd6-4eaf-a376-62f1a16a65ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b25ca-d01e-009e-4be5-644931000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquirelease9824385563e04c7fFri, 06 Sep 2019 19:00:33 GMT\"0x8D732FC7E968729\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "ed49043c-8fd6-4eaf-a376-62f1a16a65ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease9824385563e04c7f?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" : "6ad48c46-7331-40ed-b819-ac53ff6e6449" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b25f2-d01e-009e-71e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "6ad48c46-7331-40ed-b819-ac53ff6e6449" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquirelease9824385563e04c7f", "javablobacquirelease1blobapitestacquirelease98222921a6dcc" ] +} \ 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..4c1df37eb053 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4?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" : "b5e92f72-8643-47d4-95f2-89098a320dd6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7ED01AEF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2625-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "b5e92f72-8643-47d4-95f2-89098a320dd6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4/javablobacquirelease1blobapitestacquirelease0cc36322efc61", + "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" : "35b76d2b-8825-4820-b4c6-a13157156d26", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7ED98910\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b265e-d01e-009e-52e5-644931000000", + "x-ms-client-request-id" : "35b76d2b-8825-4820-b4c6-a13157156d26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4/javablobacquirelease1blobapitestacquirelease0cc36322efc61?comp=lease", + "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" : "3dd71a00-2b3a-4b0c-b1f6-6056112dad82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7ED98910\"", + "x-ms-lease-id" : "22cb1623-2bd0-4084-aeea-59d859a0c596", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2692-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "3dd71a00-2b3a-4b0c-b1f6-6056112dad82" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4/javablobacquirelease1blobapitestacquirelease0cc36322efc61", + "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" : "ebfb7941-fb71-4bf0-b032-d4cb91c567e1" + }, + "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" : "Fri, 06 Sep 2019 19:00:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7ED98910\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "b92b26b4-d01e-009e-20e5-644931000000", + "x-ms-client-request-id" : "ebfb7941-fb71-4bf0-b032-d4cb91c567e1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f3e27574-2c72-452d-b141-9e3f75992b4b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b26d0-d01e-009e-3be5-644931000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4Fri, 06 Sep 2019 19:00:33 GMT\"0x8D732FC7ED01AEF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "f3e27574-2c72-452d-b141-9e3f75992b4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4?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" : "d75e1bc7-0213-400d-bd0f-bdb744753255" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b26eb-d01e-009e-54e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "d75e1bc7-0213-400d-bd0f-bdb744753255" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquirelease0cc39087ed0b59f4", "javablobacquirelease1blobapitestacquirelease0cc36322efc61" ] +} \ 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..59fac0e5b54f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac6f9629466bd6f6?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" : "5c56d1ae-e9bf-45d0-abe8-6157b181bf70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7F1EE945\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b280b-d01e-009e-5fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "5c56d1ae-e9bf-45d0-abe8-6157b181bf70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac6f9629466bd6f6/javablobacquireleaseac1blobapitestacquireleaseac6f986389a39", + "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" : "4c3e87ee-acb2-43c5-b078-ad6d5a3ec476", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7F257124\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b284b-d01e-009e-14e5-644931000000", + "x-ms-client-request-id" : "4c3e87ee-acb2-43c5-b078-ad6d5a3ec476" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac6f9629466bd6f6/javablobacquireleaseac1blobapitestacquireleaseac6f986389a39?comp=lease", + "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" : "fe340af3-f33e-4c31-b607-1524ac9d5770" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7F257124\"", + "x-ms-lease-id" : "c53a2d5b-6da9-48b1-9eec-ed42111a63fb", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2884-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "fe340af3-f33e-4c31-b607-1524ac9d5770" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9139ce45-37f5-44ab-8bab-cace4586f038" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2952-d01e-009e-01e5-644931000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac6f9629466bd6f6Fri, 06 Sep 2019 19:00:34 GMT\"0x8D732FC7F1EE945\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "9139ce45-37f5-44ab-8bab-cace4586f038", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac6f9629466bd6f6?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" : "b0d6e031-1ac1-4985-9fbc-9f4bbeb445e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b296d-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "b0d6e031-1ac1-4985-9fbc-9f4bbeb445e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac6f9629466bd6f6", "javablobacquireleaseac1blobapitestacquireleaseac6f986389a39" ] +} \ 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..0e16610f6652 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac0e384153924f98?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" : "9cfd44b9-1ecc-49f5-964a-42935d264908" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7F6D9077\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b29f2-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "9cfd44b9-1ecc-49f5-964a-42935d264908" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac0e384153924f98/javablobacquireleaseac1blobapitestacquireleaseac0e3777985b4", + "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" : "5dc2325b-764e-49aa-aeea-c014bfb198c2", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7F8EFA62\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2aa6-d01e-009e-35e5-644931000000", + "x-ms-client-request-id" : "5dc2325b-764e-49aa-aeea-c014bfb198c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac0e384153924f98/javablobacquireleaseac1blobapitestacquireleaseac0e3777985b4?comp=lease", + "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" : "a86cc093-2779-48a0-b38f-adf73c9e6031" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7F8EFA62\"", + "x-ms-lease-id" : "1dc0621b-7905-40de-812d-e5bdb339bbb3", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2ad0-d01e-009e-5ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "a86cc093-2779-48a0-b38f-adf73c9e6031" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f871244c-60df-4751-96f4-bb623ce5d63f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2af4-d01e-009e-7ee5-644931000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac0e384153924f98Fri, 06 Sep 2019 19:00:34 GMT\"0x8D732FC7F6D9077\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "f871244c-60df-4751-96f4-bb623ce5d63f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac0e384153924f98?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" : "b26c75d7-a90c-4bfa-939a-26216cbcff74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2b1b-d01e-009e-22e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "b26c75d7-a90c-4bfa-939a-26216cbcff74" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac0e384153924f98", "javablobacquireleaseac1blobapitestacquireleaseac0e3777985b4" ] +} \ 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..f9b547d4e634 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb7491306ae0953?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" : "4714a10a-b866-42ad-b061-a6164e9a49b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7FAA0B14\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2b6a-d01e-009e-65e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "x-ms-client-request-id" : "4714a10a-b866-42ad-b061-a6164e9a49b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb7491306ae0953/javablobacquireleaseac1blobapitestacquireleaseacb7430239d2a", + "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" : "4451b964-6421-4d1d-8d68-7d7424ff6658", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7FB32CCD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2b8e-d01e-009e-06e5-644931000000", + "x-ms-client-request-id" : "4451b964-6421-4d1d-8d68-7d7424ff6658" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb7491306ae0953/javablobacquireleaseac1blobapitestacquireleaseacb7430239d2a?comp=lease", + "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" : "1e76b50d-d6de-4c5f-9842-6f2e2aa58291" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7FB32CCD\"", + "x-ms-lease-id" : "df2429e9-9433-481b-840d-ac6e05481de3", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2c39-d01e-009e-1be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "1e76b50d-d6de-4c5f-9842-6f2e2aa58291" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3c2e8a4e-7c33-4c7c-9ac5-2435f510c727" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2c5a-d01e-009e-3ae5-644931000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseacb7491306ae0953Fri, 06 Sep 2019 19:00:35 GMT\"0x8D732FC7FAA0B14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "3c2e8a4e-7c33-4c7c-9ac5-2435f510c727", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb7491306ae0953?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" : "742b2aca-1cbe-47fa-ae7a-05d590cbb991" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2c74-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "742b2aca-1cbe-47fa-ae7a-05d590cbb991" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseacb7491306ae0953", "javablobacquireleaseac1blobapitestacquireleaseacb7430239d2a" ] +} \ 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..a1d914bc0154 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326?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" : "f061c856-f1b9-4486-ac55-da8fa11d8e70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7FDFF494\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2c9d-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "f061c856-f1b9-4486-ac55-da8fa11d8e70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326/javablobacquireleaseac1blobapitestacquireleaseac7ab16679096", + "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" : "68033c7f-8c26-4fe5-93c8-1706e62ab063", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7FE6A514\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2cbb-d01e-009e-12e5-644931000000", + "x-ms-client-request-id" : "68033c7f-8c26-4fe5-93c8-1706e62ab063" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326/javablobacquireleaseac1blobapitestacquireleaseac7ab16679096", + "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" : "de561b33-e350-4a2c-8ad2-15126634bbc6" + }, + "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" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7FE6A514\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:35 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b2cec-d01e-009e-41e5-644931000000", + "x-ms-client-request-id" : "de561b33-e350-4a2c-8ad2-15126634bbc6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326/javablobacquireleaseac1blobapitestacquireleaseac7ab16679096?comp=lease", + "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" : "b413615d-6374-4dad-9319-bb1fe7da6e54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7FE6A514\"", + "x-ms-lease-id" : "abb3f9ff-8fd2-430a-9e70-2864210e9d25", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2d03-d01e-009e-58e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "b413615d-6374-4dad-9319-bb1fe7da6e54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2f9c6275-f704-4037-9305-ffd08a8ad0b1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2d26-d01e-009e-76e5-644931000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326Fri, 06 Sep 2019 19:00:35 GMT\"0x8D732FC7FDFF494\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "2f9c6275-f704-4037-9305-ffd08a8ad0b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326?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" : "d01b3bdb-2285-4905-bc2b-aec3dd51281c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2d42-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "d01b3bdb-2285-4905-bc2b-aec3dd51281c" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac7ab85240d01326", "javablobacquireleaseac1blobapitestacquireleaseac7ab16679096" ] +} \ 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..b438b7ae5bad --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb15168523cb8f1?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" : "1f217bf9-3a38-4366-9fbb-cd75f3895633" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC800734B2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2d71-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "1f217bf9-3a38-4366-9fbb-cd75f3895633" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb15168523cb8f1/javablobacquireleaseac1blobapitestacquireleaseacb15985662c8", + "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" : "b1233e62-1396-42c0-b37e-d27c10986e57", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC800D4918\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2d95-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "b1233e62-1396-42c0-b37e-d27c10986e57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb15168523cb8f1/javablobacquireleaseac1blobapitestacquireleaseacb15985662c8?comp=lease", + "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" : "03f8fbc5-4020-493a-9031-8887017e3c8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC800D4918\"", + "x-ms-lease-id" : "e3060ec1-7029-4c1c-a8a2-b27b74341e88", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2dba-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "03f8fbc5-4020-493a-9031-8887017e3c8b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "07b65efc-98e0-4c77-8b61-1c55a085f1bb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2dd9-d01e-009e-1ee5-644931000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseacb15168523cb8f1Fri, 06 Sep 2019 19:00:35 GMT\"0x8D732FC800734B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "07b65efc-98e0-4c77-8b61-1c55a085f1bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacb15168523cb8f1?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" : "a60063ab-79b8-48b2-8d49-d81337c83b38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2df8-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "a60063ab-79b8-48b2-8d49-d81337c83b38" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseacb15168523cb8f1", "javablobacquireleaseac1blobapitestacquireleaseacb15985662c8" ] +} \ 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..bd0efa75048d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail1d039935fc?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" : "cd49191f-def3-4fd0-bc1e-99b2d31010f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8023007D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2e21-d01e-009e-63e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "cd49191f-def3-4fd0-bc1e-99b2d31010f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail1d039935fc/javablobacquireleaseacfail17862411c6323d721345a", + "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" : "bec88d82-9aab-49e4-b9b1-911cfc88fdc7", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8029150E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2e4c-d01e-009e-09e5-644931000000", + "x-ms-client-request-id" : "bec88d82-9aab-49e4-b9b1-911cfc88fdc7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail1d039935fc/javablobacquireleaseacfail17862411c6323d721345a?comp=lease", + "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" : "4c172f4a-1245-44f1-920b-e2d84c504b7f" + }, + "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" : "b92b2e6f-d01e-009e-29e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b2e6f-d01e-009e-29e5-644931000000\nTime:2019-09-06T19:00:35.9900140Z", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "4c172f4a-1245-44f1-920b-e2d84c504b7f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "71cd4f28-9c94-42cf-9deb-272a7f86130d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2e86-d01e-009e-40e5-644931000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfail1d039935fcFri, 06 Sep 2019 19:00:35 GMT\"0x8D732FC8023007D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "71cd4f28-9c94-42cf-9deb-272a7f86130d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail1d039935fc?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" : "df030a12-78b1-4fae-bb44-724797ae86f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2ea1-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "df030a12-78b1-4fae-bb44-724797ae86f5" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfail1d039935fc", "javablobacquireleaseacfail17862411c6323d721345a" ] +} \ 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..aec7fcea110f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail48062289ae?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" : "a1f03cac-d89a-4896-b816-7e73dbbe931a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC803EA532\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2ee0-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "a1f03cac-d89a-4896-b816-7e73dbbe931a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail48062289ae/javablobacquireleaseacfail195574955b9b37375b492", + "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" : "0bec8041-c34c-4bf6-88bc-6ed6e44edef2", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8045081F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2f0b-d01e-009e-3ce5-644931000000", + "x-ms-client-request-id" : "0bec8041-c34c-4bf6-88bc-6ed6e44edef2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail48062289ae/javablobacquireleaseacfail195574955b9b37375b492?comp=lease", + "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" : "6a4e9a04-7ddc-4aec-8fcd-33a8620e1221" + }, + "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" : "b92b2f24-d01e-009e-52e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b2f24-d01e-009e-52e5-644931000000\nTime:2019-09-06T19:00:36.1721788Z", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "6a4e9a04-7ddc-4aec-8fcd-33a8620e1221", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15333c44-4572-4ec0-b1cd-543966bf7f87" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2f49-d01e-009e-73e5-644931000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfail48062289aeFri, 06 Sep 2019 19:00:36 GMT\"0x8D732FC803EA532\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "15333c44-4572-4ec0-b1cd-543966bf7f87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail48062289ae?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" : "c3d05b32-fd4b-45f2-8be1-2c556748cc78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2f68-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:35 GMT", + "x-ms-client-request-id" : "c3d05b32-fd4b-45f2-8be1-2c556748cc78" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfail48062289ae", "javablobacquireleaseacfail195574955b9b37375b492" ] +} \ 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..a5f4ed8983bb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailfc654752e9?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" : "447ab617-67ae-4550-87a6-84816c92cc5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC805BA9CA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2f9a-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "447ab617-67ae-4550-87a6-84816c92cc5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailfc654752e9/javablobacquireleaseacfail103716c90cba7c25cf4aa", + "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" : "997cf02a-fbce-4151-bc49-68249cd425d4", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC806197A7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2fbf-d01e-009e-5ce5-644931000000", + "x-ms-client-request-id" : "997cf02a-fbce-4151-bc49-68249cd425d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailfc654752e9/javablobacquireleaseacfail103716c90cba7c25cf4aa?comp=lease", + "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" : "e30b70f4-6459-4b25-8dc3-5403b3eaa9bc" + }, + "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" : "b92b2fee-d01e-009e-05e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b2fee-d01e-009e-05e5-644931000000\nTime:2019-09-06T19:00:36.3573451Z", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "e30b70f4-6459-4b25-8dc3-5403b3eaa9bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b35ff646-0d08-4fe4-a8ac-40f6ac0a35d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b3011-d01e-009e-26e5-644931000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailfc654752e9Fri, 06 Sep 2019 19:00:36 GMT\"0x8D732FC805BA9CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "b35ff646-0d08-4fe4-a8ac-40f6ac0a35d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailfc654752e9?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" : "505371a5-2464-4ddc-8b7d-880cac70954d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b3033-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "505371a5-2464-4ddc-8b7d-880cac70954d" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailfc654752e9", "javablobacquireleaseacfail103716c90cba7c25cf4aa" ] +} \ 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..838acbf61704 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483e?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" : "9801ccaa-e8d4-49f4-96c4-44d3e57a393c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC807811E9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b3063-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "9801ccaa-e8d4-49f4-96c4-44d3e57a393c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483e/javablobacquireleaseacfail103427e2f7fad68b94467", + "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" : "3c57f5db-2fa5-4dac-b200-29d570981c3d", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC807E270F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b3098-d01e-009e-1ce5-644931000000", + "x-ms-client-request-id" : "3c57f5db-2fa5-4dac-b200-29d570981c3d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483e/javablobacquireleaseacfail103427e2f7fad68b94467", + "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" : "c20cc9a8-dc53-4bd6-b13e-c0602023458b" + }, + "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" : "Fri, 06 Sep 2019 19:00:36 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC807E270F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:36 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b30bb-d01e-009e-3de5-644931000000", + "x-ms-client-request-id" : "c20cc9a8-dc53-4bd6-b13e-c0602023458b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483e/javablobacquireleaseacfail103427e2f7fad68b94467?comp=lease", + "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" : "a03697b8-26d3-4b10-ab40-1062782fa4ba" + }, + "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" : "b92b30e2-d01e-009e-60e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b30e2-d01e-009e-60e5-644931000000\nTime:2019-09-06T19:00:36.5815459Z", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "a03697b8-26d3-4b10-ab40-1062782fa4ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e8034677-ac5e-45ef-b0ac-e720355ee47e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b30fb-d01e-009e-75e5-644931000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483eFri, 06 Sep 2019 19:00:36 GMT\"0x8D732FC807811E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "e8034677-ac5e-45ef-b0ac-e720355ee47e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483e?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" : "567291ab-8cf5-4482-9a33-5c306cadca24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b3117-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "567291ab-8cf5-4482-9a33-5c306cadca24" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailaaf055483e", "javablobacquireleaseacfail103427e2f7fad68b94467" ] +} \ 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..d2707fa7eefb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror682423255cc?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" : "a28716c4-79cb-4c43-9d04-a2174ba343d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC809A95EE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b3142-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "a28716c4-79cb-4c43-9d04-a2174ba343d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror682423255cc/javablobacquireleaseerror1blobapitestacquireleaseerror68290489", + "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" : "56b677d5-b362-46f8-97ef-ab5558e2466c", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC80A120B5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b3175-d01e-009e-68e5-644931000000", + "x-ms-client-request-id" : "56b677d5-b362-46f8-97ef-ab5558e2466c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror682423255cc/javablobacquireleaseerror2blobapitestacquireleaseerror68262532?comp=lease", + "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" : "1696047f-8508-4e83-a3a1-3a02ac6c4f7b" + }, + "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" : "b92b3199-d01e-009e-09e5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92b3199-d01e-009e-09e5-644931000000\nTime:2019-09-06T19:00:36.7787223Z", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "1696047f-8508-4e83-a3a1-3a02ac6c4f7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dc73f785-4b50-46b5-b469-127bb904acbe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b31b6-d01e-009e-23e5-644931000000", + "Body" : "jtcacquireleaseerrorjtcacquireleaseerror0blobapitestacquireleaseerror682423255ccFri, 06 Sep 2019 19:00:36 GMT\"0x8D732FC809A95EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "dc73f785-4b50-46b5-b469-127bb904acbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror682423255cc?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" : "b9cbfc5b-2d2b-471e-acb5-fdf304773752" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b31d4-d01e-009e-40e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "b9cbfc5b-2d2b-471e-acb5-fdf304773752" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseerror0blobapitestacquireleaseerror682423255cc", "javablobacquireleaseerror1blobapitestacquireleaseerror68290489", "javablobacquireleaseerror2blobapitestacquireleaseerror68262532" ] +} \ 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..0491d3770393 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin81a67615f6588?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" : "6f089515-3398-4224-96c8-656e6686827f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7EFF4C13\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2718-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "6f089515-3398-4224-96c8-656e6686827f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin81a67615f6588/javablobacquireleasemin1blobapitestacquireleasemin81a60567f5", + "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" : "413380d0-2333-46aa-9c8e-3b252bbe6ebd", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7F0621E3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b276c-d01e-009e-47e5-644931000000", + "x-ms-client-request-id" : "413380d0-2333-46aa-9c8e-3b252bbe6ebd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin81a67615f6588/javablobacquireleasemin1blobapitestacquireleasemin81a60567f5?comp=lease", + "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" : "fa4b6de6-f829-4022-82bd-2f00a8c92f94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7F0621E3\"", + "x-ms-lease-id" : "6b25dea3-e927-4f4c-b8f3-3ec120f38f89", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b27a3-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "fa4b6de6-f829-4022-82bd-2f00a8c92f94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1b0ae989-53ab-4c12-aac2-74fb09d97604" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b27cd-d01e-009e-24e5-644931000000", + "Body" : "jtcacquireleaseminjtcacquireleasemin0blobapitestacquireleasemin81a67615f6588Fri, 06 Sep 2019 19:00:34 GMT\"0x8D732FC7EFF4C13\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "1b0ae989-53ab-4c12-aac2-74fb09d97604", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin81a67615f6588?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" : "933580d2-c2a4-485d-afbe-225ed73e8205" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b27ec-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:33 GMT", + "x-ms-client-request-id" : "933580d2-c2a4-485d-afbe-225ed73e8205" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleasemin0blobapitestacquireleasemin81a67615f6588", "javablobacquireleasemin1blobapitestacquireleasemin81a60567f5" ] +} \ 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..a297c2333c8e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorb61944113348f?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" : "433372f8-9670-4533-a27d-ca47bae734a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA9366BD9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c42d5-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "433372f8-9670-4533-a27d-ca47bae734a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorb61944113348f/javablobblobdeleteerror1blobapitestblobdeleteerrorb616368126", + "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" : "655691a6-56b4-4c83-974d-5a42dc78581c", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA93E0BE2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c4300-d01e-009e-53e5-644931000000", + "x-ms-client-request-id" : "655691a6-56b4-4c83-974d-5a42dc78581c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorb61944113348f/javablobblobdeleteerror2blobapitestblobdeleteerrorb6162160c4", + "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" : "c7fa705d-9171-48aa-a9a5-6b12433ce46c" + }, + "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" : "b92c431c-d01e-009e-6ee5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92c431c-d01e-009e-6ee5-644931000000\nTime:2019-09-06T19:01:44.9238843Z", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "c7fa705d-9171-48aa-a9a5-6b12433ce46c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "298ded45-9f7f-4b42-b64a-26246a49043c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c434e-d01e-009e-1ce5-644931000000", + "Body" : "jtcblobdeleteerrorjtcblobdeleteerror0blobapitestblobdeleteerrorb61944113348fFri, 06 Sep 2019 19:01:44 GMT\"0x8D732FCA9366BD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "298ded45-9f7f-4b42-b64a-26246a49043c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorb61944113348f?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" : "9265e026-3796-4634-b2cb-34851820ba12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c4369-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "9265e026-3796-4634-b2cb-34851820ba12" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobdeleteerror0blobapitestblobdeleteerrorb61944113348f", "javablobblobdeleteerror1blobapitestblobdeleteerrorb616368126", "javablobblobdeleteerror2blobapitestblobdeleteerrorb6162160c4" ] +} \ 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..096fb217341b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2?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" : "569e6274-5e70-4531-97f5-940e8813a034" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E571407\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8585-d01e-009e-74e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "569e6274-5e70-4531-97f5-940e8813a034" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2/javablobbreaklease1blobapitestbreakleasea81940283802787", + "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" : "9e860737-99f5-478e-b09b-4159c1e040bf", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8E63AF3F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b85fc-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "9e860737-99f5-478e-b09b-4159c1e040bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2/javablobbreaklease1blobapitestbreakleasea81940283802787?comp=lease", + "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" : "486a6e15-e11b-4b22-aa4f-284f762fadee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E63AF3F\"", + "x-ms-lease-id" : "839788c5-123e-45cf-aa01-353592085624", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b862b-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "486a6e15-e11b-4b22-aa4f-284f762fadee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2/javablobbreaklease1blobapitestbreakleasea81940283802787?comp=lease", + "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" : "66ad80c2-3d77-4505-a83a-7fce4bda676e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E63AF3F\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b86d1-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "66ad80c2-3d77-4505-a83a-7fce4bda676e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2/javablobbreaklease1blobapitestbreakleasea81940283802787", + "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" : "ab5bfb1a-967b-473c-9c6f-f2abf843bdc2" + }, + "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" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:59 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" : "\"0x8D732FC8E63AF3F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:59 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b8730-d01e-009e-6fe5-644931000000", + "x-ms-client-request-id" : "ab5bfb1a-967b-473c-9c6f-f2abf843bdc2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "daedeac6-5d6a-4011-b380-f5b90f8b8249" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8754-d01e-009e-0ce5-644931000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2Fri, 06 Sep 2019 19:00:59 GMT\"0x8D732FC8E571407\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "daedeac6-5d6a-4011-b380-f5b90f8b8249", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2?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" : "5bd3a9d9-0390-40da-9102-9250254cfa4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8779-d01e-009e-2ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "5bd3a9d9-0390-40da-9102-9250254cfa4d" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreakleasea81856164cb4c86bb2", "javablobbreaklease1blobapitestbreakleasea81940283802787", "839788c5-123e-45cf-aa01-353592085624" ] +} \ 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..f8cadd096f36 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb8928856996221ae88?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" : "175d5edf-5ba6-4118-8745-5b1c087b3a98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E9F02F8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b87b4-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "175d5edf-5ba6-4118-8745-5b1c087b3a98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb8928856996221ae88/javablobbreaklease1blobapitestbreakleaseb8956919b57d82e", + "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" : "2ee7e8aa-7b1e-4d11-b406-b6e5bc824570", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8EA5A9E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b87ec-d01e-009e-1be5-644931000000", + "x-ms-client-request-id" : "2ee7e8aa-7b1e-4d11-b406-b6e5bc824570" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb8928856996221ae88/javablobbreaklease1blobapitestbreakleaseb8956919b57d82e?comp=lease", + "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" : "fe245dad-010a-472d-ad4e-b1bd82a52fc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8EA5A9E1\"", + "x-ms-lease-id" : "35af7796-8598-47ab-b996-4592676f8db8", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8825-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "fe245dad-010a-472d-ad4e-b1bd82a52fc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb8928856996221ae88/javablobbreaklease1blobapitestbreakleaseb8956919b57d82e?comp=lease", + "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" : "3ed62797-11bc-4837-afb3-0bb60c7faebd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8EA5A9E1\"", + "x-ms-lease-time" : "20", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b88d6-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "3ed62797-11bc-4837-afb3-0bb60c7faebd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb8928856996221ae88/javablobbreaklease1blobapitestbreakleaseb8956919b57d82e", + "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" : "1c17b0d7-36aa-4b2f-8a0c-4e9837be83b1" + }, + "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" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FC8EA5A9E1\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:00 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b88fa-d01e-009e-09e5-644931000000", + "x-ms-client-request-id" : "1c17b0d7-36aa-4b2f-8a0c-4e9837be83b1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "461d5d05-dd1f-4c51-b820-1b68f137bc24" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b891a-d01e-009e-26e5-644931000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreakleaseb8928856996221ae88Fri, 06 Sep 2019 19:01:00 GMT\"0x8D732FC8E9F02F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "461d5d05-dd1f-4c51-b820-1b68f137bc24", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb8928856996221ae88?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" : "f4a241a3-cc11-47a1-bbbc-57aa13e0570b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8946-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "f4a241a3-cc11-47a1-bbbc-57aa13e0570b" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreakleaseb8928856996221ae88", "javablobbreaklease1blobapitestbreakleaseb8956919b57d82e", "35af7796-8598-47ab-b996-4592676f8db8" ] +} \ 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..daa895d732e1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease83522947a5898cede8?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" : "66ffdcf8-c2b7-4aa2-9a93-49cc637aac2d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8EE0D5F8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8977-d01e-009e-78e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "66ffdcf8-c2b7-4aa2-9a93-49cc637aac2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease83522947a5898cede8/javablobbreaklease1blobapitestbreaklease83562542b6b9ce9", + "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" : "7a8e0447-ab72-4a54-8b37-0b3b4b954487", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8EF1E032\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8a1c-d01e-009e-08e5-644931000000", + "x-ms-client-request-id" : "7a8e0447-ab72-4a54-8b37-0b3b4b954487" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease83522947a5898cede8/javablobbreaklease1blobapitestbreaklease83562542b6b9ce9?comp=lease", + "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" : "c6f3a3d3-2740-4a88-928d-51565f54da00" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8EF1E032\"", + "x-ms-lease-id" : "4c06ef16-1e52-4b88-bafc-8ab3ff5b3bec", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8a48-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "c6f3a3d3-2740-4a88-928d-51565f54da00" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease83522947a5898cede8/javablobbreaklease1blobapitestbreaklease83562542b6b9ce9?comp=lease", + "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" : "c6f419f7-cb86-48f1-ae5d-d9b001b99444" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8EF1E032\"", + "x-ms-lease-time" : "15", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8a76-d01e-009e-5fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "c6f419f7-cb86-48f1-ae5d-d9b001b99444" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease83522947a5898cede8/javablobbreaklease1blobapitestbreaklease83562542b6b9ce9", + "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" : "39322403-b5b9-440b-a26d-57acd5924652" + }, + "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" : "Fri, 06 Sep 2019 19:01:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FC8EF1E032\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:00 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b8a99-d01e-009e-7de5-644931000000", + "x-ms-client-request-id" : "39322403-b5b9-440b-a26d-57acd5924652", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "19c8ed8f-7bdb-4f88-842c-947411ca1f76" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8ac3-d01e-009e-1ee5-644931000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreaklease83522947a5898cede8Fri, 06 Sep 2019 19:01:00 GMT\"0x8D732FC8EE0D5F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "19c8ed8f-7bdb-4f88-842c-947411ca1f76", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease83522947a5898cede8?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" : "c2c992d2-e9b3-4df3-8bb8-6b8031177b11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8aeb-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "c2c992d2-e9b3-4df3-8bb8-6b8031177b11" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreaklease83522947a5898cede8", "javablobbreaklease1blobapitestbreaklease83562542b6b9ce9", "4c06ef16-1e52-4b88-bafc-8ab3ff5b3bec" ] +} \ 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..c5f4cdeebca7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836f?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" : "004af1dd-54fd-4c11-951a-7b508c5255a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F3BDC20\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8c48-d01e-009e-76e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "004af1dd-54fd-4c11-951a-7b508c5255a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836f/javablobbreakleaseac1blobapitestbreakleaseac4f44937123883", + "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" : "190a2d12-578f-4199-8454-182d48d25c1d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8F428454\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8c76-d01e-009e-20e5-644931000000", + "x-ms-client-request-id" : "190a2d12-578f-4199-8454-182d48d25c1d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836f/javablobbreakleaseac1blobapitestbreakleaseac4f44937123883?comp=lease", + "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" : "f9c8bb5d-7f83-4f3f-814e-25205a0673c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F428454\"", + "x-ms-lease-id" : "cd8a2158-bd1b-4df4-86bd-702217f379dc", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8c9d-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "f9c8bb5d-7f83-4f3f-814e-25205a0673c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836f/javablobbreakleaseac1blobapitestbreakleaseac4f44937123883?comp=lease", + "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" : "ef9efc68-e3f7-4187-8d28-9a3219576903" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F428454\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8cc8-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "ef9efc68-e3f7-4187-8d28-9a3219576903" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "97f9a83e-6de6-4ecb-b800-cc6077c2bf5c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8cf8-d01e-009e-19e5-644931000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836fFri, 06 Sep 2019 19:01:01 GMT\"0x8D732FC8F3BDC20\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "97f9a83e-6de6-4ecb-b800-cc6077c2bf5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836f?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" : "4badba69-9129-452b-9aac-a1d3cce9f64c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8d23-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "4badba69-9129-452b-9aac-a1d3cce9f64c" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac4f437069cce4836f", "javablobbreakleaseac1blobapitestbreakleaseac4f44937123883" ] +} \ 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..82d767e5a878 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacb4926119d923531c?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" : "358f7ea3-50b6-4fe7-836b-5fdfb2a5a9ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F5F71E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8d4f-d01e-009e-68e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "358f7ea3-50b6-4fe7-836b-5fdfb2a5a9ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacb4926119d923531c/javablobbreakleaseac1blobapitestbreakleaseacb49094366c840", + "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" : "a0230684-0ea8-4d54-9ef6-4b09502ccaee", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8F65CC27\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8d77-d01e-009e-0ae5-644931000000", + "x-ms-client-request-id" : "a0230684-0ea8-4d54-9ef6-4b09502ccaee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacb4926119d923531c/javablobbreakleaseac1blobapitestbreakleaseacb49094366c840?comp=lease", + "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" : "3d14863e-5a75-49a4-9d08-52ebe362d989" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F65CC27\"", + "x-ms-lease-id" : "0c8b78f7-4eb3-4d9f-b5c7-33b1609c6dd9", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8d9e-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "3d14863e-5a75-49a4-9d08-52ebe362d989" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacb4926119d923531c/javablobbreakleaseac1blobapitestbreakleaseacb49094366c840?comp=lease", + "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" : "b67e2d1c-d2cb-49ec-ab76-5a5e3404b8a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F65CC27\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8dcb-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "b67e2d1c-d2cb-49ec-ab76-5a5e3404b8a9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c3c4ff79-a6f2-40e4-8a1a-660c6cc2fdd5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8df8-d01e-009e-7de5-644931000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseacb4926119d923531cFri, 06 Sep 2019 19:01:01 GMT\"0x8D732FC8F5F71E5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "c3c4ff79-a6f2-40e4-8a1a-660c6cc2fdd5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacb4926119d923531c?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" : "90be5021-4d30-4c49-bd11-aa1455c9fa92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8e15-d01e-009e-17e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "90be5021-4d30-4c49-bd11-aa1455c9fa92" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseacb4926119d923531c", "javablobbreakleaseac1blobapitestbreakleaseacb49094366c840" ] +} \ 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..e374357436b3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac807269372517185c?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" : "8efd0c7f-1e58-4949-ba0a-60dc8decceaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F8F8DAB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8ea4-d01e-009e-1be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "8efd0c7f-1e58-4949-ba0a-60dc8decceaa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac807269372517185c/javablobbreakleaseac1blobapitestbreakleaseac807616263a5b1", + "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" : "fe4b6d6f-373c-445e-b2bd-14141ab217cd", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8F963679\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8ed2-d01e-009e-44e5-644931000000", + "x-ms-client-request-id" : "fe4b6d6f-373c-445e-b2bd-14141ab217cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac807269372517185c/javablobbreakleaseac1blobapitestbreakleaseac807616263a5b1?comp=lease", + "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" : "44dd32ba-0fac-4942-9a44-720af786285c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F963679\"", + "x-ms-lease-id" : "56f72cb8-89c1-4185-bda4-a50173cfca06", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8f02-d01e-009e-6fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "44dd32ba-0fac-4942-9a44-720af786285c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac807269372517185c/javablobbreakleaseac1blobapitestbreakleaseac807616263a5b1?comp=lease", + "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" : "c85264c4-4afc-423c-9b8a-7d7197f9dc97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F963679\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8f20-d01e-009e-0de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "c85264c4-4afc-423c-9b8a-7d7197f9dc97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0476edcd-056a-4b76-b4d1-0807f4cbee1f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8f3c-d01e-009e-28e5-644931000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac807269372517185cFri, 06 Sep 2019 19:01:01 GMT\"0x8D732FC8F8F8DAB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "0476edcd-056a-4b76-b4d1-0807f4cbee1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac807269372517185c?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" : "8cf63072-2c3b-4b62-8af3-65c68cf6b9d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b900a-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:01 GMT", + "x-ms-client-request-id" : "8cf63072-2c3b-4b62-8af3-65c68cf6b9d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac807269372517185c", "javablobbreakleaseac1blobapitestbreakleaseac807616263a5b1" ] +} \ 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..ef4c2996a087 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9?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" : "3db4a52e-01bb-45c1-8b7f-15419bd9ecfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91AB6F91\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9bd0-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "3db4a52e-01bb-45c1-8b7f-15419bd9ecfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9/javablobbreakleaseac1blobapitestbreakleaseac6ec60257eded0", + "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" : "3c411bfd-4132-4ac5-a664-32e74382e7e0", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC91B21CEA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b9c0a-d01e-009e-48e5-644931000000", + "x-ms-client-request-id" : "3c411bfd-4132-4ac5-a664-32e74382e7e0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9/javablobbreakleaseac1blobapitestbreakleaseac6ec60257eded0", + "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" : "9d7acda8-6e25-4286-8450-d9d6ae52b410" + }, + "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" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:05 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" : "\"0x8D732FC91B21CEA\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:05 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b9c3c-d01e-009e-77e5-644931000000", + "x-ms-client-request-id" : "9d7acda8-6e25-4286-8450-d9d6ae52b410", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9/javablobbreakleaseac1blobapitestbreakleaseac6ec60257eded0?comp=lease", + "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" : "06aee61d-2c42-4b2a-8ef8-8303535e22c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91B21CEA\"", + "x-ms-lease-id" : "25ab4629-af60-4871-b8f3-b4cbda555b38", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9c52-d01e-009e-0de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "06aee61d-2c42-4b2a-8ef8-8303535e22c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9/javablobbreakleaseac1blobapitestbreakleaseac6ec60257eded0?comp=lease", + "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" : "3872fcaa-f930-4ebc-ad13-307fb21c0634" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91B21CEA\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b9c71-d01e-009e-29e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "3872fcaa-f930-4ebc-ad13-307fb21c0634" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8e467ff2-5c36-469d-b665-71c69e00da30" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b9c92-d01e-009e-48e5-644931000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9Fri, 06 Sep 2019 19:01:05 GMT\"0x8D732FC91AB6F91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "8e467ff2-5c36-469d-b665-71c69e00da30", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9?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" : "f3a0c2be-6254-4bf4-9287-2797ab3e196f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b9cb1-d01e-009e-65e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "f3a0c2be-6254-4bf4-9287-2797ab3e196f" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac6ec81415d2eb38e9", "javablobbreakleaseac1blobapitestbreakleaseac6ec60257eded0" ] +} \ 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..4222a5bfa789 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381?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" : "30301d77-9c09-4eb5-a6ff-dd9ec1b803b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91D56F6D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9cdf-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "30301d77-9c09-4eb5-a6ff-dd9ec1b803b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381/javablobbreakleaseac1blobapitestbreakleaseacfd2172336cef7", + "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" : "6945ce3d-bca2-4273-b30e-95cd58ff13b9", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC91DD2EBB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b9d0a-d01e-009e-34e5-644931000000", + "x-ms-client-request-id" : "6945ce3d-bca2-4273-b30e-95cd58ff13b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381/javablobbreakleaseac1blobapitestbreakleaseacfd2172336cef7?comp=lease", + "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" : "81f7e8ee-6d1b-4296-bb28-edd4d4b3c846" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91DD2EBB\"", + "x-ms-lease-id" : "aed7cee8-4c11-40a4-82ef-36ae8c6391d4", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9d21-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "81f7e8ee-6d1b-4296-bb28-edd4d4b3c846" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381/javablobbreakleaseac1blobapitestbreakleaseacfd2172336cef7?comp=lease", + "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" : "714098f2-a990-4040-8026-ba7f61848f29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91DD2EBB\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b9d38-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "714098f2-a990-4040-8026-ba7f61848f29" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8424c2a6-80d1-44c1-9684-a84bae0c77e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b9d60-d01e-009e-04e5-644931000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381Fri, 06 Sep 2019 19:01:05 GMT\"0x8D732FC91D56F6D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "8424c2a6-80d1-44c1-9684-a84bae0c77e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381?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" : "5c4da918-d587-4c33-9d06-746163136d33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b9d79-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "5c4da918-d587-4c33-9d06-746163136d33" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseacfd2132823957f381", "javablobbreakleaseac1blobapitestbreakleaseacfd2172336cef7" ] +} \ 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..06c22a8a678c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392?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" : "2d41f18f-488b-44f1-91bf-54954ed90689" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC91FCD6A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9d98-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "2d41f18f-488b-44f1-91bf-54954ed90689" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392/javablobbreakleaseacfail1blobapitestbreakleaseacfailf8f980234", + "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" : "09e5e79f-6180-42d7-9fd9-962c0447a2a4", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9203AB95\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b9dce-d01e-009e-6be5-644931000000", + "x-ms-client-request-id" : "09e5e79f-6180-42d7-9fd9-962c0447a2a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392/javablobbreakleaseacfail1blobapitestbreakleaseacfailf8f980234?comp=lease", + "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" : "ad46b7ce-6c42-476e-b2ae-e98799559ec9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9203AB95\"", + "x-ms-lease-id" : "a60c23db-e674-4018-aef3-13823e27137b", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9df3-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "ad46b7ce-6c42-476e-b2ae-e98799559ec9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392/javablobbreakleaseacfail1blobapitestbreakleaseacfailf8f980234?comp=lease", + "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" : "a4676126-4577-44f7-add1-2e107c83726f" + }, + "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" : "b92b9e16-d01e-009e-2fe5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b9e16-d01e-009e-2fe5-644931000000\nTime:2019-09-06T19:01:05.9799317Z", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "a4676126-4577-44f7-add1-2e107c83726f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "61267c44-c661-4cc3-8765-9c1ae4faba39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b9e2b-d01e-009e-43e5-644931000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392Fri, 06 Sep 2019 19:01:05 GMT\"0x8D732FC91FCD6A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "61267c44-c661-4cc3-8765-9c1ae4faba39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392?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" : "cdd6535c-1363-4cc8-a4d6-517bcf0dfbd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b9e46-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "cdd6535c-1363-4cc8-a4d6-517bcf0dfbd0" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfailf8f73807b392", "javablobbreakleaseacfail1blobapitestbreakleaseacfailf8f980234" ] +} \ 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..916a0a58e464 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068?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" : "20ea0643-dad7-41bf-97fc-a63e76f5eac1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC922576A4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9e85-d01e-009e-15e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "20ea0643-dad7-41bf-97fc-a63e76f5eac1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068/javablobbreakleaseacfail1blobapitestbreakleaseacfail47742726b", + "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" : "f5a8892f-9ee6-40af-a475-5763afb1414b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC922E4826\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b9ed0-d01e-009e-56e5-644931000000", + "x-ms-client-request-id" : "f5a8892f-9ee6-40af-a475-5763afb1414b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068/javablobbreakleaseacfail1blobapitestbreakleaseacfail47742726b?comp=lease", + "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" : "f06b3225-e76f-4536-98f4-c1586a14a98b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC922E4826\"", + "x-ms-lease-id" : "7bb1c6b0-27fd-4d13-89de-fccbb9dedc91", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9f02-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "f06b3225-e76f-4536-98f4-c1586a14a98b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068/javablobbreakleaseacfail1blobapitestbreakleaseacfail47742726b?comp=lease", + "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" : "366efd1a-8e46-40e0-999b-c46b2349a4f5" + }, + "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" : "b92b9f39-d01e-009e-39e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b9f39-d01e-009e-39e5-644931000000\nTime:2019-09-06T19:01:06.2782008Z", + "Date" : "Fri, 06 Sep 2019 19:01:05 GMT", + "x-ms-client-request-id" : "366efd1a-8e46-40e0-999b-c46b2349a4f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2c9756f5-0916-49b5-8aaa-cf03c9ff613a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b9f63-d01e-009e-5ee5-644931000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068Fri, 06 Sep 2019 19:01:06 GMT\"0x8D732FC922576A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "2c9756f5-0916-49b5-8aaa-cf03c9ff613a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068?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" : "efd36720-6f98-4c75-8ce8-4faf9c74a2aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b9f8a-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "efd36720-6f98-4c75-8ce8-4faf9c74a2aa" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail477187603068", "javablobbreakleaseacfail1blobapitestbreakleaseacfail47742726b" ] +} \ 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..54b1aaa86eb8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994?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" : "d995d110-f530-46db-a43c-d1e170399e60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC925A9CA0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b9fbd-d01e-009e-2ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "d995d110-f530-46db-a43c-d1e170399e60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994/javablobbreakleaseacfail1blobapitestbreakleaseacfail6f5714008", + "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" : "335a9a4d-8143-4ebc-b540-45de0a5776ef", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9263E3DD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba025-d01e-009e-0de5-644931000000", + "x-ms-client-request-id" : "335a9a4d-8143-4ebc-b540-45de0a5776ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994/javablobbreakleaseacfail1blobapitestbreakleaseacfail6f5714008?comp=lease", + "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" : "888578a1-c143-48bb-bb9f-fa5ceef9e494" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9263E3DD\"", + "x-ms-lease-id" : "4e204df3-86bb-4125-990f-020115be92ef", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba059-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "888578a1-c143-48bb-bb9f-fa5ceef9e494" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994/javablobbreakleaseacfail1blobapitestbreakleaseacfail6f5714008?comp=lease", + "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" : "40fd3e3a-edf2-4b11-bf4e-3ee7a598ce24" + }, + "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" : "b92ba091-d01e-009e-70e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ba091-d01e-009e-70e5-644931000000\nTime:2019-09-06T19:01:06.6255114Z", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "40fd3e3a-edf2-4b11-bf4e-3ee7a598ce24", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "536850d1-8fd7-4e78-9b9b-67d3f3b72868" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba0b3-d01e-009e-0fe5-644931000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994Fri, 06 Sep 2019 19:01:06 GMT\"0x8D732FC925A9CA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "536850d1-8fd7-4e78-9b9b-67d3f3b72868", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994?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" : "de750f56-1a40-4f4c-8e40-c8b920952c1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ba0d7-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "de750f56-1a40-4f4c-8e40-c8b920952c1e" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail6f5782480994", "javablobbreakleaseacfail1blobapitestbreakleaseacfail6f5714008" ] +} \ 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..42289ff3c0bb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95?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" : "e71609bf-c32f-4948-a375-2b047283e8d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC928538D7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba10e-d01e-009e-65e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "e71609bf-c32f-4948-a375-2b047283e8d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95/javablobbreakleaseacfail1blobapitestbreakleaseacfail840003596", + "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" : "72a06d8f-5c82-474f-8a63-cce6d5a0e504", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC928CD248\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba146-d01e-009e-15e5-644931000000", + "x-ms-client-request-id" : "72a06d8f-5c82-474f-8a63-cce6d5a0e504" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95/javablobbreakleaseacfail1blobapitestbreakleaseacfail840003596", + "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" : "f109cd4b-8252-4b65-b6c5-e178f4b27233" + }, + "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" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:06 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" : "\"0x8D732FC928CD248\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:06 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ba18d-d01e-009e-54e5-644931000000", + "x-ms-client-request-id" : "f109cd4b-8252-4b65-b6c5-e178f4b27233", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95/javablobbreakleaseacfail1blobapitestbreakleaseacfail840003596?comp=lease", + "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" : "ce975e39-c91e-460a-adcb-48fb87cf35a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC928CD248\"", + "x-ms-lease-id" : "f6d89fef-0b81-4f5c-9191-0e835cc19fd9", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba1b8-d01e-009e-7ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "ce975e39-c91e-460a-adcb-48fb87cf35a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95/javablobbreakleaseacfail1blobapitestbreakleaseacfail840003596?comp=lease", + "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" : "e828f9d2-9fbe-47d5-a002-9afca4400534" + }, + "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" : "b92ba1d7-d01e-009e-1ae5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ba1d7-d01e-009e-1ae5-644931000000\nTime:2019-09-06T19:01:06.9357902Z", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "e828f9d2-9fbe-47d5-a002-9afca4400534", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1f3bb0e6-ca69-4c4a-b5cc-85f480e63a9c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba1f2-d01e-009e-34e5-644931000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95Fri, 06 Sep 2019 19:01:06 GMT\"0x8D732FC928538D7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "1f3bb0e6-ca69-4c4a-b5cc-85f480e63a9c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95?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" : "13a1fca1-e1ea-4c78-991c-19f786a09085" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ba20f-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "13a1fca1-e1ea-4c78-991c-19f786a09085" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail840264522a95", "javablobbreakleaseacfail1blobapitestbreakleaseacfail840003596" ] +} \ 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..69e5941ef56c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3cf88607fda7e?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" : "070ac480-63b9-4027-a36c-0a33e23149d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC92B442E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba24d-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:06 GMT", + "x-ms-client-request-id" : "070ac480-63b9-4027-a36c-0a33e23149d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3cf88607fda7e/javablobbreakleaseerror1blobapitestbreakleaseerror3cf934514a", + "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" : "792ced4f-3cc6-438b-90d0-a5cbcbcd5e56", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC92F4AD85\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba3ca-d01e-009e-3fe5-644931000000", + "x-ms-client-request-id" : "792ced4f-3cc6-438b-90d0-a5cbcbcd5e56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3cf88607fda7e/javablobbreakleaseerror2blobapitestbreakleaseerror3cf762143a?comp=lease", + "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" : "8bc76b8e-7b70-49e9-a5aa-04a026701169" + }, + "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" : "b92ba599-d01e-009e-3ee5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92ba599-d01e-009e-3ee5-644931000000\nTime:2019-09-06T19:01:07.8045678Z", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "8bc76b8e-7b70-49e9-a5aa-04a026701169", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "65e23732-59b9-4e47-a180-b12bc56264fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba5c5-d01e-009e-63e5-644931000000", + "Body" : "jtcbreakleaseerrorjtcbreakleaseerror0blobapitestbreakleaseerror3cf88607fda7eFri, 06 Sep 2019 19:01:07 GMT\"0x8D732FC92B442E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "65e23732-59b9-4e47-a180-b12bc56264fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3cf88607fda7e?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" : "2ad63d4d-9246-4fa2-83e0-3710b5eee861" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ba5e6-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "2ad63d4d-9246-4fa2-83e0-3710b5eee861" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseerror0blobapitestbreakleaseerror3cf88607fda7e", "javablobbreakleaseerror1blobapitestbreakleaseerror3cf934514a", "javablobbreakleaseerror2blobapitestbreakleaseerror3cf762143a" ] +} \ 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..0ecbb26b54a2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9fe?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" : "eafed008-7cbb-48d8-bef1-6370d591ef9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F184665\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8b2a-d01e-009e-74e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "eafed008-7cbb-48d8-bef1-6370d591ef9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9fe/javablobbreakleasemin1blobapitestbreakleasemin2e9245449d59", + "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" : "cb973742-cdc1-4fb6-9cf0-a5d7451318e1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8F1EC745\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8b4d-d01e-009e-13e5-644931000000", + "x-ms-client-request-id" : "cb973742-cdc1-4fb6-9cf0-a5d7451318e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9fe/javablobbreakleasemin1blobapitestbreakleasemin2e9245449d59?comp=lease", + "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" : "9f0702a9-12b8-4e9b-8d2f-a747d26398b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F1EC745\"", + "x-ms-lease-id" : "a5fcbcb4-7d00-4600-942a-a198bdb9e3a0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8b86-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "9f0702a9-12b8-4e9b-8d2f-a747d26398b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9fe/javablobbreakleasemin1blobapitestbreakleasemin2e9245449d59?comp=lease", + "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" : "4a19654e-dabd-4581-a759-b81b77dad801" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8F1EC745\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8bb2-d01e-009e-70e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "4a19654e-dabd-4581-a759-b81b77dad801" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8ac4518c-024b-4fcb-8529-4aa388a82cc2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8bdd-d01e-009e-18e5-644931000000", + "Body" : "jtcbreakleaseminjtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9feFri, 06 Sep 2019 19:01:01 GMT\"0x8D732FC8F184665\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "8ac4518c-024b-4fcb-8529-4aa388a82cc2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9fe?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" : "2e26404b-8763-48fa-b7d0-e65890faf639" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8c10-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:00 GMT", + "x-ms-client-request-id" : "2e26404b-8763-48fa-b7d0-e65890faf639" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleasemin0blobapitestbreakleasemin2e964207dd5c9fe", "javablobbreakleasemin1blobapitestbreakleasemin2e9245449d59" ] +} \ 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..dcd2d9780572 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json @@ -0,0 +1,155 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b?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" : "223bf3a1-625f-4efc-934f-d0cdf844305a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93368916\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba62b-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "223bf3a1-625f-4efc-934f-d0cdf844305a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b/javablobchangelease1blobapitestchangeleaseaa890055ace100", + "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" : "7b902b46-b89b-4041-b60b-7ab1a71857ff", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC933C9CFA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba650-d01e-009e-59e5-644931000000", + "x-ms-client-request-id" : "7b902b46-b89b-4041-b60b-7ab1a71857ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b/javablobchangelease1blobapitestchangeleaseaa890055ace100?comp=lease", + "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" : "70a8d0aa-1cc6-48cb-ac5c-8b404897a1a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC933C9CFA\"", + "x-ms-lease-id" : "2d870db6-1c8b-4533-bbcb-d0d884a2425d", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba66d-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "70a8d0aa-1cc6-48cb-ac5c-8b404897a1a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b/javablobchangelease1blobapitestchangeleaseaa890055ace100?comp=lease", + "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" : "84ef203a-a180-43a9-8367-aeaa773f6caf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC933C9CFA\"", + "x-ms-lease-id" : "f34d824e-c445-4338-8aaf-cdbe66a200cf", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba698-d01e-009e-17e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "84ef203a-a180-43a9-8367-aeaa773f6caf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b/javablobchangelease1blobapitestchangeleaseaa890055ace100?comp=lease", + "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" : "dab95b1e-21fb-4c48-8bad-cfb28a6d7ca6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC933C9CFA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba6e3-d01e-009e-4de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "dab95b1e-21fb-4c48-8bad-cfb28a6d7ca6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea27b04e-8270-4f73-849d-409ac8dd064c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba70b-d01e-009e-71e5-644931000000", + "Body" : "jtcchangeleasejtcchangelease0blobapitestchangeleaseaa886247e410ceb4bFri, 06 Sep 2019 19:01:07 GMT\"0x8D732FC93368916\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "ea27b04e-8270-4f73-849d-409ac8dd064c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b?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" : "87f101c3-358c-41fd-ac50-cfab2631c517" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ba730-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "87f101c3-358c-41fd-ac50-cfab2631c517" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangelease0blobapitestchangeleaseaa886247e410ceb4b", "javablobchangelease1blobapitestchangeleaseaa890055ace100", "2d870db6-1c8b-4533-bbcb-d0d884a2425d", "f34d824e-c445-4338-8aaf-cdbe66a200cf" ] +} \ 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..052a99ca4231 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56?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" : "b702b609-8b57-42ec-a5bf-686c578fdf0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC938901BE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba866-d01e-009e-23e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "b702b609-8b57-42ec-a5bf-686c578fdf0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56/javablobchangeleaseac1blobapitestchangeleaseacd1a672077d12", + "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" : "bc6b7feb-d8ef-4dc8-aa7e-607900cc09d8", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC938F8B9A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba899-d01e-009e-52e5-644931000000", + "x-ms-client-request-id" : "bc6b7feb-d8ef-4dc8-aa7e-607900cc09d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56/javablobchangeleaseac1blobapitestchangeleaseacd1a672077d12?comp=lease", + "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" : "cb9aa329-1cfd-4a4a-be14-2dbab46c7462" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC938F8B9A\"", + "x-ms-lease-id" : "a0cb0651-6c75-4f8a-8725-2b8221dd12eb", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba8c7-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "cb9aa329-1cfd-4a4a-be14-2dbab46c7462" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56/javablobchangeleaseac1blobapitestchangeleaseacd1a672077d12?comp=lease", + "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" : "eb2ea75e-eba1-4d08-a077-f26568454b99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC938F8B9A\"", + "x-ms-lease-id" : "0d54bcfc-fff0-4a7e-802f-02487c5aa1b5", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba8e6-d01e-009e-1be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "eb2ea75e-eba1-4d08-a077-f26568454b99" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "226f043c-f821-4189-a538-75a382b2dd9f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba909-d01e-009e-39e5-644931000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56Fri, 06 Sep 2019 19:01:08 GMT\"0x8D732FC938901BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "226f043c-f821-4189-a538-75a382b2dd9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56?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" : "47a5ebc5-b136-4b9a-b050-83c47175fc6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ba92b-d01e-009e-59e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "47a5ebc5-b136-4b9a-b050-83c47175fc6b" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacd1a0494200b3d56", "javablobchangeleaseac1blobapitestchangeleaseacd1a672077d12", "0d54bcfc-fff0-4a7e-802f-02487c5aa1b5" ] +} \ 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..6601c24feba9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138b?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" : "3e695445-d0e0-4271-a702-c9411cb6c184" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93ABFB2D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba970-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "3e695445-d0e0-4271-a702-c9411cb6c184" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138b/javablobchangeleaseac1blobapitestchangeleaseacb7a3931367e4", + "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" : "a90adfbd-0e11-4132-9663-42722b69b8c6", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC93B2D371\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba9a3-d01e-009e-47e5-644931000000", + "x-ms-client-request-id" : "a90adfbd-0e11-4132-9663-42722b69b8c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138b/javablobchangeleaseac1blobapitestchangeleaseacb7a3931367e4?comp=lease", + "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" : "5474e536-e622-4214-a8bd-5af794084c91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93B2D371\"", + "x-ms-lease-id" : "685fe51f-e195-4849-b398-af83c74f4388", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba9d0-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "5474e536-e622-4214-a8bd-5af794084c91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138b/javablobchangeleaseac1blobapitestchangeleaseacb7a3931367e4?comp=lease", + "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" : "244149d9-9c63-428e-b82e-64c219d6573c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93B2D371\"", + "x-ms-lease-id" : "e941a54f-f336-4d32-be0b-51b79e4367f4", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba9ed-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "244149d9-9c63-428e-b82e-64c219d6573c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a01ac732-a6a8-40d8-af56-c3e38a11d1ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92baa16-d01e-009e-29e5-644931000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138bFri, 06 Sep 2019 19:01:08 GMT\"0x8D732FC93ABFB2D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "a01ac732-a6a8-40d8-af56-c3e38a11d1ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138b?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" : "21985e52-a3f9-4f16-b81a-1ebbd208b8b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92baa3b-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "21985e52-a3f9-4f16-b81a-1ebbd208b8b5" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacb7a955647dd138b", "javablobchangeleaseac1blobapitestchangeleaseacb7a3931367e4", "e941a54f-f336-4d32-be0b-51b79e4367f4" ] +} \ 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..a671bc0171b4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4?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" : "30c78e39-512d-4dbd-aa16-0f97a4891c0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93CECD6A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92baa78-d01e-009e-7de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "30c78e39-512d-4dbd-aa16-0f97a4891c0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4/javablobchangeleaseac1blobapitestchangeleaseac84a06175bada", + "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" : "adfd3eb4-e776-4ef1-afb7-e24888f2e22e", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC93D46D36\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92baa9b-d01e-009e-1de5-644931000000", + "x-ms-client-request-id" : "adfd3eb4-e776-4ef1-afb7-e24888f2e22e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4/javablobchangeleaseac1blobapitestchangeleaseac84a06175bada?comp=lease", + "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" : "4e4acb64-cdff-4cbe-ba65-79242ebafcf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93D46D36\"", + "x-ms-lease-id" : "30fb18c8-be70-4f6f-ab38-49b249121985", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92baac0-d01e-009e-3ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "4e4acb64-cdff-4cbe-ba65-79242ebafcf3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4/javablobchangeleaseac1blobapitestchangeleaseac84a06175bada?comp=lease", + "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" : "e550146e-8853-44a9-8112-613f2a5efb21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93D46D36\"", + "x-ms-lease-id" : "f431446d-32a2-4e62-a885-2ac2f815f389", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92baadc-d01e-009e-55e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "e550146e-8853-44a9-8112-613f2a5efb21" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c915055e-ef5e-431d-bb81-66efcc61dd4e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92baaf8-d01e-009e-6ee5-644931000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4Fri, 06 Sep 2019 19:01:08 GMT\"0x8D732FC93CECD6A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "c915055e-ef5e-431d-bb81-66efcc61dd4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4?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" : "20d408d3-dbaf-4f2c-b137-91827020fc4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bab2c-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "20d408d3-dbaf-4f2c-b137-91827020fc4e" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseac84a064962a925e4", "javablobchangeleaseac1blobapitestchangeleaseac84a06175bada", "f431446d-32a2-4e62-a885-2ac2f815f389" ] +} \ 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..9c01feeedf25 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a?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" : "b7dbbd31-c6e0-4028-8df7-df36456f7079" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93EE6AA9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bab58-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "b7dbbd31-c6e0-4028-8df7-df36456f7079" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a/javablobchangeleaseac1blobapitestchangeleaseacf9907283f78e", + "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" : "ca283499-19a3-44fd-b2ff-2cb019561b17", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC93F431C1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bab88-d01e-009e-5fe5-644931000000", + "x-ms-client-request-id" : "ca283499-19a3-44fd-b2ff-2cb019561b17" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a/javablobchangeleaseac1blobapitestchangeleaseacf9907283f78e", + "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" : "8113a753-b8f2-49a2-83a1-989335b9b83c" + }, + "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" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:08 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" : "\"0x8D732FC93F431C1\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:09 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92babbc-d01e-009e-0be5-644931000000", + "x-ms-client-request-id" : "8113a753-b8f2-49a2-83a1-989335b9b83c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a/javablobchangeleaseac1blobapitestchangeleaseacf9907283f78e?comp=lease", + "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" : "13f66e2e-ccfa-4c4e-be5c-34e6de8b67e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93F431C1\"", + "x-ms-lease-id" : "ed730c0f-6357-4704-b300-555799e922b4", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92babdc-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "13f66e2e-ccfa-4c4e-be5c-34e6de8b67e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a/javablobchangeleaseac1blobapitestchangeleaseacf9907283f78e?comp=lease", + "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" : "bac26307-4ec1-4e48-bf53-d8c341891336" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93F431C1\"", + "x-ms-lease-id" : "9e13034a-edd1-4de9-80a1-828418a1e975", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92babff-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "bac26307-4ec1-4e48-bf53-d8c341891336" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7cb3556a-073c-4865-abda-b0ee6497afe5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bac35-d01e-009e-79e5-644931000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacf99250433922a5aFri, 06 Sep 2019 19:01:09 GMT\"0x8D732FC93EE6AA9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "7cb3556a-073c-4865-abda-b0ee6497afe5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a?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" : "c0360c30-68d5-41f2-90c9-d485465b54eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bac69-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "c0360c30-68d5-41f2-90c9-d485465b54eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacf99250433922a5a", "javablobchangeleaseac1blobapitestchangeleaseacf9907283f78e", "9e13034a-edd1-4de9-80a1-828418a1e975" ] +} \ 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..828699726b1c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4?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" : "a01d91c9-2cb1-417e-992f-b7ed4d7315b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94205B9C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bac97-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "a01d91c9-2cb1-417e-992f-b7ed4d7315b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4/javablobchangeleaseac1blobapitestchangeleaseac3ae22625b448", + "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" : "c3c3d939-aa6d-47da-9657-b226d04a0f1a", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC94325AED\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bad28-d01e-009e-57e5-644931000000", + "x-ms-client-request-id" : "c3c3d939-aa6d-47da-9657-b226d04a0f1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4/javablobchangeleaseac1blobapitestchangeleaseac3ae22625b448?comp=lease", + "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" : "62ff7474-a263-4a04-8d6a-aac749e49d93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94325AED\"", + "x-ms-lease-id" : "47fd4be3-3946-44ee-ab27-efdf9fcf4efc", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bad59-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "62ff7474-a263-4a04-8d6a-aac749e49d93" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4/javablobchangeleaseac1blobapitestchangeleaseac3ae22625b448?comp=lease", + "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" : "97ef83df-f468-42e8-9d9b-b8652ff29fc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94325AED\"", + "x-ms-lease-id" : "99898473-e7a6-44c5-af97-c163467333fd", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bad8b-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "97ef83df-f468-42e8-9d9b-b8652ff29fc7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "da8c07db-16b3-4212-b3cb-fd83f77c4bce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92badba-d01e-009e-59e5-644931000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4Fri, 06 Sep 2019 19:01:09 GMT\"0x8D732FC94205B9C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "da8c07db-16b3-4212-b3cb-fd83f77c4bce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4?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" : "50596192-d72f-4bf9-9c4a-3f7165d76134" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bade0-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "50596192-d72f-4bf9-9c4a-3f7165d76134" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseac3ae9002908d11e4", "javablobchangeleaseac1blobapitestchangeleaseac3ae22625b448", "99898473-e7a6-44c5-af97-c163467333fd" ] +} \ 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..02fc8e5b15dc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772f?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" : "18272372-abdd-41ef-a011-1c18434fdefc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC944F8CB7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bae0b-d01e-009e-25e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "18272372-abdd-41ef-a011-1c18434fdefc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772f/javablobchangeleaseacfail1blobapitestchangeleaseacfail14910280", + "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" : "986a01a8-40d6-4aa6-ab9f-6f92156a6f09", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC945729B9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bae43-d01e-009e-54e5-644931000000", + "x-ms-client-request-id" : "986a01a8-40d6-4aa6-ab9f-6f92156a6f09" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772f/javablobchangeleaseacfail1blobapitestchangeleaseacfail14910280?comp=lease", + "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" : "59491244-bd11-4945-85ab-31d20c0881f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC945729B9\"", + "x-ms-lease-id" : "cd30f061-7a47-414b-b5dd-a06571091ebd", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bae81-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "59491244-bd11-4945-85ab-31d20c0881f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772f/javablobchangeleaseacfail1blobapitestchangeleaseacfail14910280?comp=lease", + "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" : "c7a04f99-a675-44a9-8d0c-ea19132e7e61" + }, + "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" : "b92bae98-d01e-009e-25e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bae98-d01e-009e-25e5-644931000000\nTime:2019-09-06T19:01:09.9394866Z", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "c7a04f99-a675-44a9-8d0c-ea19132e7e61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f1e54f8f-b89c-4bc2-8e50-de7a6f3510af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92baf58-d01e-009e-4de5-644931000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772fFri, 06 Sep 2019 19:01:09 GMT\"0x8D732FC944F8CB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "f1e54f8f-b89c-4bc2-8e50-de7a6f3510af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772f?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" : "78bf4505-686d-4c72-9d4f-555bf20ff5ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92baf7c-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "78bf4505-686d-4c72-9d4f-555bf20ff5ec" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail1492927772f", "javablobchangeleaseacfail1blobapitestchangeleaseacfail14910280", "d708c13d-942a-4624-bc60-7df60cc688eb" ] +} \ 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..9c5bf948feea --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034a?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" : "91de63fd-9678-4b4e-86f0-7c0e777a7be7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94969116\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb014-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "x-ms-client-request-id" : "91de63fd-9678-4b4e-86f0-7c0e777a7be7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034a/javablobchangeleaseacfail1blobapitestchangeleaseacfaildfe66891", + "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" : "51cce24b-cc04-4fc6-912d-5acd2c26fff5", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC949CF5E3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb040-d01e-009e-13e5-644931000000", + "x-ms-client-request-id" : "51cce24b-cc04-4fc6-912d-5acd2c26fff5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034a/javablobchangeleaseacfail1blobapitestchangeleaseacfaildfe66891?comp=lease", + "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" : "9f95ff51-2ad4-4c5d-8b66-0576cf7f29de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC949CF5E3\"", + "x-ms-lease-id" : "85eb7625-089d-4e82-a5bc-478dba439963", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb065-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "9f95ff51-2ad4-4c5d-8b66-0576cf7f29de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034a/javablobchangeleaseacfail1blobapitestchangeleaseacfaildfe66891?comp=lease", + "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" : "8bb96bb4-a35e-4c68-be38-0c0029dc82c8" + }, + "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" : "b92bb091-d01e-009e-5ae5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bb091-d01e-009e-5ae5-644931000000\nTime:2019-09-06T19:01:10.3498542Z", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "8bb96bb4-a35e-4c68-be38-0c0029dc82c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15b96cad-8e29-4d96-8956-d3d0b26b4478" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb0a9-d01e-009e-71e5-644931000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034aFri, 06 Sep 2019 19:01:10 GMT\"0x8D732FC94969116\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "15b96cad-8e29-4d96-8956-d3d0b26b4478", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034a?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" : "a870de6b-91d1-42a8-b094-862cb084946d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb0cb-d01e-009e-0ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "a870de6b-91d1-42a8-b094-862cb084946d" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfaildfe6212034a", "javablobchangeleaseacfail1blobapitestchangeleaseacfaildfe66891", "49bfc23e-5807-448d-88b9-779182934f04" ] +} \ 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..6db751ee8037 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309?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" : "2f7b6bc1-21ab-41a9-81ed-04adb13f4fc3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94BB3882\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb0eb-d01e-009e-2be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "2f7b6bc1-21ab-41a9-81ed-04adb13f4fc3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309/javablobchangeleaseacfail1blobapitestchangeleaseacfailde301969", + "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" : "39d8f990-a25a-417b-be27-c1748e31d61f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC94C1C4AA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb115-d01e-009e-51e5-644931000000", + "x-ms-client-request-id" : "39d8f990-a25a-417b-be27-c1748e31d61f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309/javablobchangeleaseacfail1blobapitestchangeleaseacfailde301969?comp=lease", + "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" : "b070c23e-3a9d-49a0-b975-18c91554ebdc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94C1C4AA\"", + "x-ms-lease-id" : "a5754e48-faf4-4964-aa84-3e5a526306ee", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb159-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "b070c23e-3a9d-49a0-b975-18c91554ebdc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309/javablobchangeleaseacfail1blobapitestchangeleaseacfailde301969?comp=lease", + "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" : "05679c39-579c-4bb9-aed7-4b30c347d5c6" + }, + "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" : "b92bb17e-d01e-009e-30e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bb17e-d01e-009e-30e5-644931000000\nTime:2019-09-06T19:01:10.6020791Z", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "05679c39-579c-4bb9-aed7-4b30c347d5c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "93bba16c-1212-432c-9f4d-248b2391a94d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb19d-d01e-009e-4be5-644931000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309Fri, 06 Sep 2019 19:01:10 GMT\"0x8D732FC94BB3882\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "93bba16c-1212-432c-9f4d-248b2391a94d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309?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" : "c22ebc99-9638-4bb6-a4ef-46cae1fac18e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb1c0-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "c22ebc99-9638-4bb6-a4ef-46cae1fac18e" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfailde348534309", "javablobchangeleaseacfail1blobapitestchangeleaseacfailde301969", "14f9d3cb-84a1-460e-91e7-d71d7c53a328" ] +} \ 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..45e804168fef --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc?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" : "9170618c-6c8c-4191-abea-83eef2f9988f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94E02E12\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb1ee-d01e-009e-13e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "9170618c-6c8c-4191-abea-83eef2f9988f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc/javablobchangeleaseacfail1blobapitestchangeleaseacfail44098487", + "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" : "57510fc0-bebf-44e1-867b-330923d3d52d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC94E5CFF9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb21b-d01e-009e-3ce5-644931000000", + "x-ms-client-request-id" : "57510fc0-bebf-44e1-867b-330923d3d52d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc/javablobchangeleaseacfail1blobapitestchangeleaseacfail44098487", + "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" : "f7d3debc-0d9a-4ebd-9315-a10aafb56140" + }, + "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" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:10 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" : "\"0x8D732FC94E5CFF9\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:10 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bb244-d01e-009e-63e5-644931000000", + "x-ms-client-request-id" : "f7d3debc-0d9a-4ebd-9315-a10aafb56140", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc/javablobchangeleaseacfail1blobapitestchangeleaseacfail44098487?comp=lease", + "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" : "acb0d37b-06a4-4ba7-aea0-cf77bafe0d5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC94E5CFF9\"", + "x-ms-lease-id" : "99660716-0498-4c8b-b870-576b2885ff39", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb26b-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "acb0d37b-06a4-4ba7-aea0-cf77bafe0d5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc/javablobchangeleaseacfail1blobapitestchangeleaseacfail44098487?comp=lease", + "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" : "9dd06eee-0ef0-4548-b570-681f64f54909" + }, + "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" : "b92bb298-d01e-009e-2ee5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bb298-d01e-009e-2ee5-644931000000\nTime:2019-09-06T19:01:10.8472994Z", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "9dd06eee-0ef0-4548-b570-681f64f54909", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8d7b7006-89a9-433b-b1ed-ede8e505c283" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb2cc-d01e-009e-5ce5-644931000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bcFri, 06 Sep 2019 19:01:10 GMT\"0x8D732FC94E02E12\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "8d7b7006-89a9-433b-b1ed-ede8e505c283", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc?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" : "3a456363-80d1-4770-9502-0d670c5ac358" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb2fa-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "3a456363-80d1-4770-9502-0d670c5ac358" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail440742294bc", "javablobchangeleaseacfail1blobapitestchangeleaseacfail44098487", "15dbfc6c-3c91-4f0f-b8d0-bf1476c14828" ] +} \ 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..eb390b361d54 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror96f0477876c9?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" : "7e3f2cbe-7ebe-4909-9c5b-f1cbdf25474e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC950831A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb33a-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "7e3f2cbe-7ebe-4909-9c5b-f1cbdf25474e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror96f0477876c9/javablobchangeleaseerror1blobapitestchangeleaseerror96f286615", + "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" : "b5944675-9849-4e2d-80d4-28af2627d902", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC950FF738\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb373-d01e-009e-6be5-644931000000", + "x-ms-client-request-id" : "b5944675-9849-4e2d-80d4-28af2627d902" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror96f0477876c9/javablobchangeleaseerror2blobapitestchangeleaseerror96f426992?comp=lease", + "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" : "9bc8992a-5e95-46a4-a4ca-a85f7e585ecd" + }, + "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" : "b92bb3a0-d01e-009e-11e5-644931000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b92bb3a0-d01e-009e-11e5-644931000000\nTime:2019-09-06T19:01:11.0574877Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "9bc8992a-5e95-46a4-a4ca-a85f7e585ecd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e90ea91c-7c2f-498a-bc00-4af3319ae2ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb3d3-d01e-009e-40e5-644931000000", + "Body" : "jtcchangeleaseerrorjtcchangeleaseerror0blobapitestchangeleaseerror96f0477876c9Fri, 06 Sep 2019 19:01:10 GMT\"0x8D732FC950831A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "e90ea91c-7c2f-498a-bc00-4af3319ae2ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror96f0477876c9?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" : "23010ed0-c52b-4f93-a9da-688347f67244" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb3fe-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "23010ed0-c52b-4f93-a9da-688347f67244" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseerror0blobapitestchangeleaseerror96f0477876c9", "javablobchangeleaseerror1blobapitestchangeleaseerror96f286615", "javablobchangeleaseerror2blobapitestchangeleaseerror96f426992" ] +} \ 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..899b16458121 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60?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" : "756291a0-62a5-41e8-9a56-53ab2d0aebdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC93636FB8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba768-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:07 GMT", + "x-ms-client-request-id" : "756291a0-62a5-41e8-9a56-53ab2d0aebdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60/javablobchangeleasemin1blobapitestchangeleasemin7aa89181b59", + "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" : "4b26867d-e68d-4709-9aed-ab759e0dc609", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC936D557E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ba7ac-d01e-009e-79e5-644931000000", + "x-ms-client-request-id" : "4b26867d-e68d-4709-9aed-ab759e0dc609" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60/javablobchangeleasemin1blobapitestchangeleasemin7aa89181b59?comp=lease", + "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" : "e6182b25-4e9d-4d8f-b519-89b8b077d2b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC936D557E\"", + "x-ms-lease-id" : "753a2bc3-4125-4c40-a7ec-971d9254973d", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ba7d8-d01e-009e-1fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "e6182b25-4e9d-4d8f-b519-89b8b077d2b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60/javablobchangeleasemin1blobapitestchangeleasemin7aa89181b59?comp=lease", + "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" : "fe6e29c8-cf35-4516-b4a7-6b5fc93584f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC936D557E\"", + "x-ms-lease-id" : "85ca5c2d-c035-4fc9-8630-d2873ed63dd7", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba7f3-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "fe6e29c8-cf35-4516-b4a7-6b5fc93584f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c6edd1d7-585b-480a-bcdd-bf62eb182b4c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ba80e-d01e-009e-53e5-644931000000", + "Body" : "jtcchangeleaseminjtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60Fri, 06 Sep 2019 19:01:08 GMT\"0x8D732FC93636FB8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "c6edd1d7-585b-480a-bcdd-bf62eb182b4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60?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" : "171f34d1-3a68-4de7-a984-5251c54b2e0b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ba823-d01e-009e-68e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:08 GMT", + "x-ms-client-request-id" : "171f34d1-3a68-4de7-a984-5251c54b2e0b" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleasemin0blobapitestchangeleasemin7aa36589deed60", "javablobchangeleasemin1blobapitestchangeleasemin7aa89181b59", "85ca5c2d-c035-4fc9-8630-d2873ed63dd7" ] +} \ 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..c117c0b17142 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json @@ -0,0 +1,187 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2?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" : "8247391a-6f02-41da-a956-a5feb235d6b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC972636F8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc1d5-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "8247391a-6f02-41da-a956-a5feb235d6b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2/javablobcopy1blobapitestcopy49346914547e6b2ee4e24", + "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" : "6b6552df-c362-4fbd-a50f-b1c1122f3eb5", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC972E27E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc203-d01e-009e-11e5-644931000000", + "x-ms-client-request-id" : "6b6552df-c362-4fbd-a50f-b1c1122f3eb5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2/javablobcopy2blobapitestcopy4933083552f7434467304", + "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" : "6363009f-596a-44ba-8475-06c79f0adc6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "bb0894c7-8749-4be9-ba21-8f288326ff3d", + "ETag" : "\"0x8D732FC973DBBEE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc252-d01e-009e-5de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "6363009f-596a-44ba-8475-06c79f0adc6e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2/javablobcopy2blobapitestcopy4933083552f7434467304", + "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" : "431f36f9-8485-4d77-aac7-3cc57a09726b" + }, + "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" : "Fri, 06 Sep 2019 19:01:14 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" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bc2ae-d01e-009e-30e5-644931000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "bb0894c7-8749-4be9-ba21-8f288326ff3d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2/javablobcopy1blobapitestcopy49346914547e6b2ee4e24", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC973DBBEE\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "431f36f9-8485-4d77-aac7-3cc57a09726b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2/javablobcopy2blobapitestcopy4933083552f7434467304", + "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" : "40014416-6ada-4de1-8a65-e4367eb98e45" + }, + "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" : "Fri, 06 Sep 2019 19:01:14 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" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bc2d4-d01e-009e-52e5-644931000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "bb0894c7-8749-4be9-ba21-8f288326ff3d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2/javablobcopy1blobapitestcopy49346914547e6b2ee4e24", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC973DBBEE\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "40014416-6ada-4de1-8a65-e4367eb98e45" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "80f31c1a-a306-4c1d-87ca-fdd167016a56" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc2eb-d01e-009e-69e5-644931000000", + "Body" : "jtccopyjtccopy0blobapitestcopy49374227257360405a2546e2Fri, 06 Sep 2019 19:01:14 GMT\"0x8D732FC972636F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "80f31c1a-a306-4c1d-87ca-fdd167016a56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy49374227257360405a2546e2?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" : "92e60beb-b746-407c-a8e6-44734388c924" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc30b-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "92e60beb-b746-407c-a8e6-44734388c924" + }, + "Exception" : null + } ], + "variables" : [ "jtccopy0blobapitestcopy49374227257360405a2546e2", "javablobcopy1blobapitestcopy49346914547e6b2ee4e24", "javablobcopy2blobapitestcopy4933083552f7434467304" ] +} \ 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..13e433a85a85 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaccf43548427cdee66c5?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" : "28f76ee5-fbcd-4fc4-ba5b-1882cd016ce4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC993F8049\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bcf96-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "28f76ee5-fbcd-4fc4-ba5b-1882cd016ce4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaccf43548427cdee66c5/javablobcopydestac1blobapitestcopydestaccf41267976444f9", + "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" : "84db374f-3ce3-466d-a052-0f1abe607d51", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9947EADC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bcfea-d01e-009e-44e5-644931000000", + "x-ms-client-request-id" : "84db374f-3ce3-466d-a052-0f1abe607d51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaccf43548427cdee66c5/javablobcopydestac2blobapitestcopydestaccf463929002f533", + "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" : "51169a70-5b52-41b2-ab07-03e8df4731ec", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC994DDFBD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd028-d01e-009e-7be5-644931000000", + "x-ms-client-request-id" : "51169a70-5b52-41b2-ab07-03e8df4731ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaccf43548427cdee66c5/javablobcopydestac2blobapitestcopydestaccf463929002f533", + "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" : "05924b95-d7ba-4af8-b1d8-25f9ecdc4325" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4fef9547-a694-457d-9839-0bdb107940c6", + "ETag" : "\"0x8D732FC995470FA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd055-d01e-009e-25e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "05924b95-d7ba-4af8-b1d8-25f9ecdc4325" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a3aa66a9-2cfb-4d76-94d3-7efdfd33ed82" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd08c-d01e-009e-5be5-644931000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestaccf43548427cdee66c5Fri, 06 Sep 2019 19:01:18 GMT\"0x8D732FC993F8049\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "a3aa66a9-2cfb-4d76-94d3-7efdfd33ed82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaccf43548427cdee66c5?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" : "ce1571b8-77f8-4e39-9e41-d21f92d9afcf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd0ac-d01e-009e-79e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "ce1571b8-77f8-4e39-9e41-d21f92d9afcf" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestaccf43548427cdee66c5", "javablobcopydestac1blobapitestcopydestaccf41267976444f9", "javablobcopydestac2blobapitestcopydestaccf463929002f533" ] +} \ 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..8dc5277790f2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac160178008e2a7f794f?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" : "23b2c537-a1c0-4827-aa8d-5003c17169bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC99653961\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd0e0-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "23b2c537-a1c0-4827-aa8d-5003c17169bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac160178008e2a7f794f/javablobcopydestac1blobapitestcopydestac1600984326734b9", + "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" : "88c430ac-653d-47e5-a277-e0949dd93e20", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC996B32B4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd109-d01e-009e-4be5-644931000000", + "x-ms-client-request-id" : "88c430ac-653d-47e5-a277-e0949dd93e20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac160178008e2a7f794f/javablobcopydestac2blobapitestcopydestac1601706966c13ba", + "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" : "c3dab7b0-7b8c-43fb-99d3-cea020fa0d17", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99712790\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd131-d01e-009e-6fe5-644931000000", + "x-ms-client-request-id" : "c3dab7b0-7b8c-43fb-99d3-cea020fa0d17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac160178008e2a7f794f/javablobcopydestac2blobapitestcopydestac1601706966c13ba", + "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" : "29f4cbb7-0b81-4397-92a0-324a2af9068b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "a5d57f4b-cc65-4313-aed7-cf26312a9ff6", + "ETag" : "\"0x8D732FC9978A360\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd158-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "29f4cbb7-0b81-4397-92a0-324a2af9068b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c0c24023-af01-4179-bf49-86c2fa1a9831" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd182-d01e-009e-38e5-644931000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac160178008e2a7f794fFri, 06 Sep 2019 19:01:18 GMT\"0x8D732FC99653961\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "c0c24023-af01-4179-bf49-86c2fa1a9831", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac160178008e2a7f794f?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" : "d9d686b2-64ea-4ca5-ab3b-294c9e1fe726" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd19e-d01e-009e-54e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "d9d686b2-64ea-4ca5-ab3b-294c9e1fe726" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac160178008e2a7f794f", "javablobcopydestac1blobapitestcopydestac1600984326734b9", "javablobcopydestac2blobapitestcopydestac1601706966c13ba" ] +} \ 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..95d9f91ca274 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacc8a758610394e2764d?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" : "684ad19e-65a2-4682-96b4-7025b8fa764a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC99891D5B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd1c8-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "684ad19e-65a2-4682-96b4-7025b8fa764a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacc8a758610394e2764d/javablobcopydestac1blobapitestcopydestacc8a752582df02e3", + "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" : "beba6d1c-52d7-49b4-a5b4-274a5bb43f4a", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC998EEFCC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd1ef-d01e-009e-1fe5-644931000000", + "x-ms-client-request-id" : "beba6d1c-52d7-49b4-a5b4-274a5bb43f4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacc8a758610394e2764d/javablobcopydestac2blobapitestcopydestacc8a685915e078db", + "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" : "0effb6e9-f3b5-4525-b402-42fc5fffabff", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99988F10\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd236-d01e-009e-62e5-644931000000", + "x-ms-client-request-id" : "0effb6e9-f3b5-4525-b402-42fc5fffabff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacc8a758610394e2764d/javablobcopydestac2blobapitestcopydestacc8a685915e078db", + "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" : "69ca0b92-4f41-41f6-94a3-1d40cae0d63c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "12f94b93-729f-4e33-9715-40950a4c322f", + "ETag" : "\"0x8D732FC99A00AE0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd265-d01e-009e-0ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "69ca0b92-4f41-41f6-94a3-1d40cae0d63c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "05af57de-dee4-4784-aba9-3b1381d8fe61" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd294-d01e-009e-36e5-644931000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestacc8a758610394e2764dFri, 06 Sep 2019 19:01:18 GMT\"0x8D732FC99891D5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "05af57de-dee4-4784-aba9-3b1381d8fe61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacc8a758610394e2764d?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" : "55f3556b-47a1-4c91-9d94-d94289d2ce8e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd2b8-d01e-009e-58e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "55f3556b-47a1-4c91-9d94-d94289d2ce8e" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestacc8a758610394e2764d", "javablobcopydestac1blobapitestcopydestacc8a752582df02e3", "javablobcopydestac2blobapitestcopydestacc8a685915e078db" ] +} \ 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..513fa6b1cb07 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf98338694d07babd62?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" : "1c56fe9a-9487-4424-91d7-8737451d898c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC99B20B8E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd2e7-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "1c56fe9a-9487-4424-91d7-8737451d898c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf98338694d07babd62/javablobcopydestac1blobapitestcopydestacf9821765e70b4be", + "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" : "b9d04eb1-d2af-41e0-b3f1-f380a61eeaf1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99B8A1C5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd317-d01e-009e-30e5-644931000000", + "x-ms-client-request-id" : "b9d04eb1-d2af-41e0-b3f1-f380a61eeaf1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf98338694d07babd62/javablobcopydestac2blobapitestcopydestacf98602121795bcd", + "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" : "b5a500a6-582e-4fb0-a692-d6747a915c88", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99BF5A1E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd35e-d01e-009e-70e5-644931000000", + "x-ms-client-request-id" : "b5a500a6-582e-4fb0-a692-d6747a915c88" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf98338694d07babd62/javablobcopydestac2blobapitestcopydestacf98602121795bcd", + "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" : "2a1599ff-1ece-4be0-a7ad-581b07a2ad69" + }, + "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" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FC99BF5A1E\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bd385-d01e-009e-15e5-644931000000", + "x-ms-client-request-id" : "2a1599ff-1ece-4be0-a7ad-581b07a2ad69", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf98338694d07babd62/javablobcopydestac2blobapitestcopydestacf98602121795bcd", + "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" : "9c3d773a-2da4-478b-bce6-8b1505c0fdc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "2e87cc6b-fd8a-479d-8deb-72fcddd476f6", + "ETag" : "\"0x8D732FC99CC7C9C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd3af-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "9c3d773a-2da4-478b-bce6-8b1505c0fdc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c69864c1-cc84-42e6-bc0a-528aa3f50571" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd3d3-d01e-009e-5ae5-644931000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestacf98338694d07babd62Fri, 06 Sep 2019 19:01:18 GMT\"0x8D732FC99B20B8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "c69864c1-cc84-42e6-bc0a-528aa3f50571", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf98338694d07babd62?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" : "380e8812-f9c6-40f4-ac3b-1f09b29cfa95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd3ff-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "380e8812-f9c6-40f4-ac3b-1f09b29cfa95" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestacf98338694d07babd62", "javablobcopydestac1blobapitestcopydestacf9821765e70b4be", "javablobcopydestac2blobapitestcopydestacf98602121795bcd" ] +} \ 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..4fd9c454f736 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf7e34632d64595fa28?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" : "7d74c95f-5748-4be6-9cbf-21b56214f3ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC99E115A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd44a-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "x-ms-client-request-id" : "7d74c95f-5748-4be6-9cbf-21b56214f3ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf7e34632d64595fa28/javablobcopydestac1blobapitestcopydestacf7e25465b5cb513", + "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" : "0f5c0338-ce93-49ba-ac77-e911512bcc38", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99E78515\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd479-d01e-009e-72e5-644931000000", + "x-ms-client-request-id" : "0f5c0338-ce93-49ba-ac77-e911512bcc38" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf7e34632d64595fa28/javablobcopydestac2blobapitestcopydestacf7e6609134f50dc", + "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" : "0beac388-a85f-4852-bc2e-b36dbc59ba34", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99FEE334\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd4ef-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "0beac388-a85f-4852-bc2e-b36dbc59ba34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf7e34632d64595fa28/javablobcopydestac2blobapitestcopydestacf7e6609134f50dc", + "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" : "d2995c7e-3c02-4f83-a621-2a585c734058" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "cb88584b-9c1b-4558-ac73-db5b52f6cf25", + "ETag" : "\"0x8D732FC9A06D457\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd519-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "d2995c7e-3c02-4f83-a621-2a585c734058" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "abb8a995-a504-464c-8e12-d8aafd1a733c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd54a-d01e-009e-2fe5-644931000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestacf7e34632d64595fa28Fri, 06 Sep 2019 19:01:19 GMT\"0x8D732FC99E115A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "abb8a995-a504-464c-8e12-d8aafd1a733c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf7e34632d64595fa28?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" : "52787c6b-3e81-4993-a909-ba0f35ed37ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd56e-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "52787c6b-3e81-4993-a909-ba0f35ed37ab" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestacf7e34632d64595fa28", "javablobcopydestac1blobapitestcopydestacf7e25465b5cb513", "javablobcopydestac2blobapitestcopydestacf7e6609134f50dc" ] +} \ 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..cfc0487559c3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaca28579969eb5d70971?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" : "49a9ed10-4d38-42db-b0cd-93e858c43575" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9A1C3075\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd5a7-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "49a9ed10-4d38-42db-b0cd-93e858c43575" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaca28579969eb5d70971/javablobcopydestac1blobapitestcopydestaca280316225eb37a", + "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" : "7dc4b215-980d-4c38-8d82-d99db5124c59", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9A222B0C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd5c2-d01e-009e-1ee5-644931000000", + "x-ms-client-request-id" : "7dc4b215-980d-4c38-8d82-d99db5124c59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaca28579969eb5d70971/javablobcopydestac2blobapitestcopydestaca28029290e5cbcd", + "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" : "eb9fe462-5b5e-4dd6-ad97-b298a609dd49", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9A27D1AD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd5e3-d01e-009e-3ae5-644931000000", + "x-ms-client-request-id" : "eb9fe462-5b5e-4dd6-ad97-b298a609dd49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaca28579969eb5d70971/javablobcopydestac2blobapitestcopydestaca28029290e5cbcd?comp=lease", + "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" : "b3492433-39ae-437c-aabc-b1187b4863e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9A27D1AD\"", + "x-ms-lease-id" : "4cf6d876-aef0-47c0-a07a-d63f9e9d77b8", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd60f-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "b3492433-39ae-437c-aabc-b1187b4863e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaca28579969eb5d70971/javablobcopydestac2blobapitestcopydestaca28029290e5cbcd", + "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" : "dd73bffd-3d36-43e3-b796-3feb77856b77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c72ffbeb-e962-4d11-9bf2-5707e73cf447", + "ETag" : "\"0x8D732FC9A35DEC3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd63b-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "dd73bffd-3d36-43e3-b796-3feb77856b77" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8c5b1dae-2ca3-4e2b-8d73-391178511918" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd684-d01e-009e-49e5-644931000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestaca28579969eb5d70971Fri, 06 Sep 2019 19:01:19 GMT\"0x8D732FC9A1C3075\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "8c5b1dae-2ca3-4e2b-8d73-391178511918", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestaca28579969eb5d70971?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" : "b7877eb2-fb8a-470a-9ee7-35bf8cd437f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd6aa-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "b7877eb2-fb8a-470a-9ee7-35bf8cd437f0" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestaca28579969eb5d70971", "javablobcopydestac1blobapitestcopydestaca280316225eb37a", "javablobcopydestac2blobapitestcopydestaca28029290e5cbcd" ] +} \ 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..0888c9bad887 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail11389055b44177?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" : "b60fb8f3-6ebe-4217-88c7-1c0b3dc8ba85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9A46575F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd6e6-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "b60fb8f3-6ebe-4217-88c7-1c0b3dc8ba85" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail11389055b44177/javablobcopydestacfail1blobapitestcopydestacfail11302905a73", + "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" : "db215c53-0734-41d3-861b-6f7a941dc6d0", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9A4C7961\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd70e-d01e-009e-4ce5-644931000000", + "x-ms-client-request-id" : "db215c53-0734-41d3-861b-6f7a941dc6d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail11389055b44177/javablobcopydestacfail2blobapitestcopydestacfail11391379feb", + "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" : "c54381dd-5608-47a2-8152-1b9764802a7d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9A526E39\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd72e-d01e-009e-6ae5-644931000000", + "x-ms-client-request-id" : "c54381dd-5608-47a2-8152-1b9764802a7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail11389055b44177/javablobcopydestacfail2blobapitestcopydestacfail11391379feb", + "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" : "36c3239c-aeab-434d-9633-e489fc39d8e8" + }, + "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" : "b92bd752-d01e-009e-0be5-644931000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bd752-d01e-009e-0be5-644931000000\nTime:2019-09-06T19:01:19.8884165Z", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "36c3239c-aeab-434d-9633-e489fc39d8e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3beb2d90-53d9-4b76-a356-ff0571d1b6a4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd77e-d01e-009e-32e5-644931000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail11389055b44177Fri, 06 Sep 2019 19:01:19 GMT\"0x8D732FC9A46575F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "3beb2d90-53d9-4b76-a356-ff0571d1b6a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail11389055b44177?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" : "533f00a0-f50f-43b4-a50a-f1f222094a17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd7a2-d01e-009e-56e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "533f00a0-f50f-43b4-a50a-f1f222094a17" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail11389055b44177", "javablobcopydestacfail1blobapitestcopydestacfail11302905a73", "javablobcopydestacfail2blobapitestcopydestacfail11391379feb" ] +} \ 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..49187f6ba4b4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaile1265906c337ff?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" : "b58fe135-c689-4286-915b-a2ef98d1e975" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9A7C19AE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd85d-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "b58fe135-c689-4286-915b-a2ef98d1e975" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaile1265906c337ff/javablobcopydestacfail1blobapitestcopydestacfaile1205500e69", + "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" : "67eda30f-7246-4f62-8e17-3b776bdc94c2", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9A82D886\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd891-d01e-009e-2ce5-644931000000", + "x-ms-client-request-id" : "67eda30f-7246-4f62-8e17-3b776bdc94c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaile1265906c337ff/javablobcopydestacfail2blobapitestcopydestacfaile1255065d20", + "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" : "0d4ca317-d3a4-4edc-867e-6ddb6b8bd012", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9A88A651\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bd8c5-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "0d4ca317-d3a4-4edc-867e-6ddb6b8bd012" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaile1265906c337ff/javablobcopydestacfail2blobapitestcopydestacfaile1255065d20", + "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" : "82ba158d-3361-41d0-9cbd-e6d8944a3e97" + }, + "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" : "b92bd901-d01e-009e-16e5-644931000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bd901-d01e-009e-16e5-644931000000\nTime:2019-09-06T19:01:20.2507410Z", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "82ba158d-3361-41d0-9cbd-e6d8944a3e97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8794b29a-f755-45b3-b995-d2ffec5b4b8d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bd945-d01e-009e-55e5-644931000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfaile1265906c337ffFri, 06 Sep 2019 19:01:20 GMT\"0x8D732FC9A7C19AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:19 GMT", + "x-ms-client-request-id" : "8794b29a-f755-45b3-b995-d2ffec5b4b8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaile1265906c337ff?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" : "00dbf38b-df8c-4cce-9c8d-74b3774435dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bd96a-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "00dbf38b-df8c-4cce-9c8d-74b3774435dd" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfaile1265906c337ff", "javablobcopydestacfail1blobapitestcopydestacfaile1205500e69", "javablobcopydestacfail2blobapitestcopydestacfaile1255065d20" ] +} \ 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..b04df3cdaa9c --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1a136110da126a?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" : "706e1eb5-4082-4c62-8566-843d82632fef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9AA2BD58\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bd9b6-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "706e1eb5-4082-4c62-8566-843d82632fef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1a136110da126a/javablobcopydestacfail1blobapitestcopydestacfail1a1258873af", + "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" : "5057d348-b4d6-4f25-bde3-f7030b80d947", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9ABBD065\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bda81-d01e-009e-78e5-644931000000", + "x-ms-client-request-id" : "5057d348-b4d6-4f25-bde3-f7030b80d947" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1a136110da126a/javablobcopydestacfail2blobapitestcopydestacfail1a1520603ea", + "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" : "01565716-28f6-4644-b103-08356afc9970", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9AD095CF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bdb0b-d01e-009e-75e5-644931000000", + "x-ms-client-request-id" : "01565716-28f6-4644-b103-08356afc9970" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1a136110da126a/javablobcopydestacfail2blobapitestcopydestacfail1a1520603ea", + "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" : "ffd9c892-be94-430b-9bd6-8ee01fcad1c7" + }, + "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" : "b92bdb5f-d01e-009e-40e5-644931000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bdb5f-d01e-009e-40e5-644931000000\nTime:2019-09-06T19:01:20.7091511Z", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "ffd9c892-be94-430b-9bd6-8ee01fcad1c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "99f79af3-c202-45c6-8177-77c52a70eb2d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bdb7e-d01e-009e-5de5-644931000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail1a136110da126aFri, 06 Sep 2019 19:01:20 GMT\"0x8D732FC9AA2BD58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "99f79af3-c202-45c6-8177-77c52a70eb2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1a136110da126a?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" : "29cc8c48-a41a-4560-9a80-5504d35ed8fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bdba7-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "29cc8c48-a41a-4560-9a80-5504d35ed8fd" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail1a136110da126a", "javablobcopydestacfail1blobapitestcopydestacfail1a1258873af", "javablobcopydestacfail2blobapitestcopydestacfail1a1520603ea" ] +} \ 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..20a43321a30a --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5?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" : "420ec955-a339-49c8-b2cf-d99da579f02e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9AE66592\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bdbdb-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "420ec955-a339-49c8-b2cf-d99da579f02e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5/javablobcopydestacfail1blobapitestcopydestacfail15017226b5f", + "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" : "a22c181d-4b89-4c49-822e-96ed824a1a79", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9AEC88E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bdc18-d01e-009e-6be5-644931000000", + "x-ms-client-request-id" : "a22c181d-4b89-4c49-822e-96ed824a1a79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5/javablobcopydestacfail2blobapitestcopydestacfail150611470c8", + "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" : "576a7eae-1cc8-4e41-8fbe-887ee333cc7e", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9AF64F37\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bdc69-d01e-009e-38e5-644931000000", + "x-ms-client-request-id" : "576a7eae-1cc8-4e41-8fbe-887ee333cc7e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5/javablobcopydestacfail2blobapitestcopydestacfail150611470c8", + "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" : "23011118-a0fd-4e2c-9be3-35ec9a139513" + }, + "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" : "Fri, 06 Sep 2019 19:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:20 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" : "\"0x8D732FC9AF64F37\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bdca3-d01e-009e-6ee5-644931000000", + "x-ms-client-request-id" : "23011118-a0fd-4e2c-9be3-35ec9a139513", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5/javablobcopydestacfail2blobapitestcopydestacfail150611470c8", + "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" : "2d50eca9-5b33-47b2-a7d7-cf7a5ca27c29" + }, + "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" : "b92bdcce-d01e-009e-16e5-644931000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bdcce-d01e-009e-16e5-644931000000\nTime:2019-09-06T19:01:20.9984104Z", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "2d50eca9-5b33-47b2-a7d7-cf7a5ca27c29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "42f5aa7d-141a-4695-b8cb-0f5cd18c319c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bdcfd-d01e-009e-45e5-644931000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail15064444c48eb5Fri, 06 Sep 2019 19:01:20 GMT\"0x8D732FC9AE66592\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "42f5aa7d-141a-4695-b8cb-0f5cd18c319c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5?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" : "0f7ae48c-520d-4aee-9fdf-a0285c74b5b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bdd20-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "0f7ae48c-520d-4aee-9fdf-a0285c74b5b2" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail15064444c48eb5", "javablobcopydestacfail1blobapitestcopydestacfail15017226b5f", "javablobcopydestacfail2blobapitestcopydestacfail150611470c8" ] +} \ 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..06fd7ffb7fba --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d?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" : "f6fdab5d-0bd5-46df-8fdb-8d75d71964ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9B1E997E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bdd65-d01e-009e-29e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "f6fdab5d-0bd5-46df-8fdb-8d75d71964ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d/javablobcopydestacfail1blobapitestcopydestacfail2be150347e6", + "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" : "cb205fac-f0c7-4315-9fab-cc366e7d6543", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9B246F07\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bddcb-d01e-009e-04e5-644931000000", + "x-ms-client-request-id" : "cb205fac-f0c7-4315-9fab-cc366e7d6543" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d/javablobcopydestacfail2blobapitestcopydestacfail2be6048760b", + "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" : "c5487d15-4271-493f-b229-a3e0ed7f59f5", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9B2B004D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bde01-d01e-009e-36e5-644931000000", + "x-ms-client-request-id" : "c5487d15-4271-493f-b229-a3e0ed7f59f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d/javablobcopydestacfail2blobapitestcopydestacfail2be6048760b?comp=lease", + "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" : "99476c86-2530-44a7-b746-90dbc6368585" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9B2B004D\"", + "x-ms-lease-id" : "24d885d9-7a6a-48c0-80c8-229bf13dcba9", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bde2a-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:20 GMT", + "x-ms-client-request-id" : "99476c86-2530-44a7-b746-90dbc6368585" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d/javablobcopydestacfail2blobapitestcopydestacfail2be6048760b", + "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" : "fd3fb7da-8d7e-470e-8994-8e8ccc1948f8" + }, + "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" : "b92bde48-d01e-009e-79e5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92bde48-d01e-009e-79e5-644931000000\nTime:2019-09-06T19:01:21.3427183Z", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "x-ms-client-request-id" : "fd3fb7da-8d7e-470e-8994-8e8ccc1948f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc8d72de-749c-4b6b-9280-76770feaa52a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bde75-d01e-009e-22e5-644931000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail2be89481e0515dFri, 06 Sep 2019 19:01:21 GMT\"0x8D732FC9B1E997E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "x-ms-client-request-id" : "bc8d72de-749c-4b6b-9280-76770feaa52a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d?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" : "babd2a5a-804b-4e65-a795-75cd34df9f8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bde9b-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:21 GMT", + "x-ms-client-request-id" : "babd2a5a-804b-4e65-a795-75cd34df9f8a" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail2be89481e0515d", "javablobcopydestacfail1blobapitestcopydestacfail2be150347e6", "javablobcopydestacfail2blobapitestcopydestacfail2be6048760b" ] +} \ 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..ce15cad4a0aa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerror14b35500fa85a369388?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" : "2e5050e2-b2e9-4e69-9b08-4970b61a9569" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9F7621B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bfb9f-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "2e5050e2-b2e9-4e69-9b08-4970b61a9569" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerror14b35500fa85a369388/javablobcopyerror1blobapitestcopyerror14b8688829bc943c", + "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" : "767041f6-b8ae-4860-a923-54808e140176", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9F7C2744\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bfbbf-d01e-009e-50e5-644931000000", + "x-ms-client-request-id" : "767041f6-b8ae-4860-a923-54808e140176" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerror14b35500fa85a369388/javablobcopyerror2blobapitestcopyerror14b332054efb3f0e", + "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" : "6995fe7e-909f-4625-8e3e-1fbdc81512d3" + }, + "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" : "b92bfbe7-d01e-009e-75e5-644931000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:b92bfbe7-d01e-009e-75e5-644931000000\nTime:2019-09-06T19:01:28.7133349Z", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "6995fe7e-909f-4625-8e3e-1fbdc81512d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dc045427-b4e0-485a-9044-56facb7a39d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bfcab-d01e-009e-25e5-644931000000", + "Body" : "jtccopyerrorjtccopyerror0blobapitestcopyerror14b35500fa85a369388Fri, 06 Sep 2019 19:01:28 GMT\"0x8D732FC9F7621B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "dc045427-b4e0-485a-9044-56facb7a39d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerror14b35500fa85a369388?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" : "e311bcc2-2c59-4760-b0d2-7b31e7d244da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bfcc7-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "e311bcc2-2c59-4760-b0d2-7b31e7d244da" + }, + "Exception" : null + } ], + "variables" : [ "jtccopyerror0blobapitestcopyerror14b35500fa85a369388", "javablobcopyerror1blobapitestcopyerror14b8688829bc943c", "javablobcopyerror2blobapitestcopyerror14b332054efb3f0e" ] +} \ 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..8ee46e49d28f --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata292392856db23470?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" : "48362cff-e40a-4aeb-9dca-8e5caea5357c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC97892E2D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc488-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "48362cff-e40a-4aeb-9dca-8e5caea5357c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata292392856db23470/javablobcopymetadata1blobapitestcopymetadata29206795cb12a", + "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" : "9b67f9b3-d412-414a-b07d-9b1c2e0c1d61", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC978F98E4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc4bf-d01e-009e-15e5-644931000000", + "x-ms-client-request-id" : "9b67f9b3-d412-414a-b07d-9b1c2e0c1d61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata292392856db23470/javablobcopymetadata2blobapitestcopymetadata292209193cb14", + "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" : "b2c5c9f1-5af8-43c1-adae-5db6b4e02ec5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d0e7aa96-1ada-4a02-b40a-b58674f9132f", + "ETag" : "\"0x8D732FC9797FF50\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc4f0-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "b2c5c9f1-5af8-43c1-adae-5db6b4e02ec5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata292392856db23470/javablobcopymetadata2blobapitestcopymetadata292209193cb14", + "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" : "0e9de009-94b4-4238-b604-e0616bc3272e" + }, + "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" : "Fri, 06 Sep 2019 19:01:15 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" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bc520-d01e-009e-6be5-644931000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "d0e7aa96-1ada-4a02-b40a-b58674f9132f", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata292392856db23470/javablobcopymetadata1blobapitestcopymetadata29206795cb12a", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC9797FF50\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "0e9de009-94b4-4238-b604-e0616bc3272e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "619fa2ac-055e-4210-bd6f-bdbc8b42e815" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc557-d01e-009e-1ce5-644931000000", + "Body" : "jtccopymetadatajtccopymetadata0blobapitestcopymetadata292392856db23470Fri, 06 Sep 2019 19:01:15 GMT\"0x8D732FC97892E2D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "619fa2ac-055e-4210-bd6f-bdbc8b42e815", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata292392856db23470?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" : "4289e736-e3c0-46c1-91af-467615904a47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc57e-d01e-009e-40e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "4289e736-e3c0-46c1-91af-467615904a47" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymetadata0blobapitestcopymetadata292392856db23470", "javablobcopymetadata1blobapitestcopymetadata29206795cb12a", "javablobcopymetadata2blobapitestcopymetadata292209193cb14" ] +} \ 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..ba61606060e5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata9b33683418b32cba?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" : "c4dc5447-99cc-4497-9662-d92ac196a597" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC97AF83AB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc5aa-d01e-009e-6be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "c4dc5447-99cc-4497-9662-d92ac196a597" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata9b33683418b32cba/javablobcopymetadata1blobapitestcopymetadata9b322771c7e25", + "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" : "26ceb99a-2992-412d-a292-ff5a76c08126", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC97B63CDA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc5ce-d01e-009e-0be5-644931000000", + "x-ms-client-request-id" : "26ceb99a-2992-412d-a292-ff5a76c08126" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata9b33683418b32cba/javablobcopymetadata2blobapitestcopymetadata9b333041def80", + "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" : "aa0a0add-a7a3-4d08-8488-c8b50be5b9e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "a28268b9-e335-4465-9a59-cd05ada7f341", + "ETag" : "\"0x8D732FC97BD919B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc5ed-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "aa0a0add-a7a3-4d08-8488-c8b50be5b9e3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata9b33683418b32cba/javablobcopymetadata2blobapitestcopymetadata9b333041def80", + "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" : "7571a5ee-ff1c-4ebf-880d-a2f6e4382a0b" + }, + "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" : "Fri, 06 Sep 2019 19:01:15 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" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bc619-d01e-009e-50e5-644931000000", + "x-ms-meta-fizz" : "buzz", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "a28268b9-e335-4465-9a59-cd05ada7f341", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata9b33683418b32cba/javablobcopymetadata1blobapitestcopymetadata9b322771c7e25", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-meta-foo" : "bar", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC97BD919B\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "7571a5ee-ff1c-4ebf-880d-a2f6e4382a0b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6890142f-ea3a-4399-b0a5-beead9227522" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc638-d01e-009e-6fe5-644931000000", + "Body" : "jtccopymetadatajtccopymetadata0blobapitestcopymetadata9b33683418b32cbaFri, 06 Sep 2019 19:01:15 GMT\"0x8D732FC97AF83AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "6890142f-ea3a-4399-b0a5-beead9227522", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata9b33683418b32cba?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" : "9508ecc9-648a-47f6-bb1b-a9d6b0736f39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc65c-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "9508ecc9-648a-47f6-bb1b-a9d6b0736f39" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymetadata0blobapitestcopymetadata9b33683418b32cba", "javablobcopymetadata1blobapitestcopymetadata9b322771c7e25", "javablobcopymetadata2blobapitestcopymetadata9b333041def80" ] +} \ 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..bf46be2482b9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopyminecc39099ab39d92a4f3d4?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" : "580e5202-89df-4bdb-a0bf-9826f7d534b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC975B8403\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc345-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "580e5202-89df-4bdb-a0bf-9826f7d534b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopyminecc39099ab39d92a4f3d4/javablobcopymin1blobapitestcopyminecc360515d0d40ec23", + "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" : "eece6057-8745-44b3-b2fa-fce8e220b64d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC97634E44\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc370-d01e-009e-61e5-644931000000", + "x-ms-client-request-id" : "eece6057-8745-44b3-b2fa-fce8e220b64d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopyminecc39099ab39d92a4f3d4/javablobcopymin1blobapitestcopyminecc360515d0d40ec23", + "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" : "e59284f0-d798-40c0-b88e-d10c90f67f6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f6823baf-1a73-4dba-9cf4-1fe7a588c13d", + "ETag" : "\"0x8D732FC9769431C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc39b-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "e59284f0-d798-40c0-b88e-d10c90f67f6d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bf797c35-a856-41c7-8d48-bda8a15f0693" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc41e-d01e-009e-80e5-644931000000", + "Body" : "jtccopyminjtccopymin0blobapitestcopyminecc39099ab39d92a4f3d4Fri, 06 Sep 2019 19:01:14 GMT\"0x8D732FC975B8403\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "bf797c35-a856-41c7-8d48-bda8a15f0693", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopyminecc39099ab39d92a4f3d4?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" : "657f0bce-5be3-4a90-aba9-e5a14adc1c7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc44e-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "657f0bce-5be3-4a90-aba9-e5a14adc1c7f" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymin0blobapitestcopyminecc39099ab39d92a4f3d4", "javablobcopymin1blobapitestcopyminecc360515d0d40ec23" ] +} \ 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..32c366137241 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac358235407b5ac027?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" : "46de2340-66bb-4157-86f5-0320ae2a3d49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC97D53CD3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc68c-d01e-009e-3ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "46de2340-66bb-4157-86f5-0320ae2a3d49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac358235407b5ac027/javablobcopysourceac1blobapitestcopysourceac35875726797f5", + "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" : "d8dbbd87-e0f6-49cc-abcf-871f9713d0eb", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC97E56E79\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc6ef-d01e-009e-12e5-644931000000", + "x-ms-client-request-id" : "d8dbbd87-e0f6-49cc-abcf-871f9713d0eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac358235407b5ac027/javablobcopysourceac2blobapitestcopysourceac35832616a5729", + "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" : "37d98879-d6e0-4671-8a92-78a9c87feb0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ba023f71-633b-4352-895e-21aaf5b4070f", + "ETag" : "\"0x8D732FC97ECC335\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc715-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "37d98879-d6e0-4671-8a92-78a9c87feb0c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d6af5f51-4224-40c3-8469-412e725db0dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc741-d01e-009e-5de5-644931000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac358235407b5ac027Fri, 06 Sep 2019 19:01:15 GMT\"0x8D732FC97D53CD3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "d6af5f51-4224-40c3-8469-412e725db0dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac358235407b5ac027?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" : "84448eb0-2ab5-4cc3-9532-cf6bbf6cb02f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc761-d01e-009e-7ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "84448eb0-2ab5-4cc3-9532-cf6bbf6cb02f" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac358235407b5ac027", "javablobcopysourceac1blobapitestcopysourceac35875726797f5", "javablobcopysourceac2blobapitestcopysourceac35832616a5729" ] +} \ 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..758efaa89fe9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceace4a259350e45b019?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" : "aca2205c-324a-4e0f-9c5b-d6384b9d0acc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9803836C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc79a-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "aca2205c-324a-4e0f-9c5b-d6384b9d0acc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceace4a259350e45b019/javablobcopysourceac1blobapitestcopysourceace4a631665e785", + "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" : "872dd9dd-ef11-426b-aeb1-a0ebb9feec05", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC981AE325\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc841-d01e-009e-4de5-644931000000", + "x-ms-client-request-id" : "872dd9dd-ef11-426b-aeb1-a0ebb9feec05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceace4a259350e45b019/javablobcopysourceac2blobapitestcopysourceace4a6352312f97", + "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" : "e9f7f2b8-f9b9-439d-b38e-01d17820050b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "587c7178-edfc-43e1-b61f-762ef8e53ffc", + "ETag" : "\"0x8D732FC982210CA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc876-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "e9f7f2b8-f9b9-439d-b38e-01d17820050b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6e7008b1-d552-4bb0-8984-2176a6ba82f6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc8a0-d01e-009e-24e5-644931000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceace4a259350e45b019Fri, 06 Sep 2019 19:01:15 GMT\"0x8D732FC9803836C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "6e7008b1-d552-4bb0-8984-2176a6ba82f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceace4a259350e45b019?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" : "c6420275-b588-4759-ad22-ca199b0b9888" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc8c3-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:15 GMT", + "x-ms-client-request-id" : "c6420275-b588-4759-ad22-ca199b0b9888" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceace4a259350e45b019", "javablobcopysourceac1blobapitestcopysourceace4a631665e785", "javablobcopysourceac2blobapitestcopysourceace4a6352312f97" ] +} \ 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..6bd56e4c6b6a --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6d7884375b4465d2?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" : "0bd77697-8d5a-4c51-a22d-748f81501c2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9833C652\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc8e7-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "0bd77697-8d5a-4c51-a22d-748f81501c2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6d7884375b4465d2/javablobcopysourceac1blobapitestcopysourceac6d767081cd38d", + "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" : "637f08df-e505-448e-8591-874e5cc87c5e", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC983C7CE4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc918-d01e-009e-11e5-644931000000", + "x-ms-client-request-id" : "637f08df-e505-448e-8591-874e5cc87c5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6d7884375b4465d2/javablobcopysourceac2blobapitestcopysourceac6d730616dcc79", + "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" : "6ad59a63-5a88-421e-a884-145f1a7628e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "2bedc44f-8fbc-4117-a318-42f8f6cb979b", + "ETag" : "\"0x8D732FC9843D1A9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc93b-d01e-009e-30e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "6ad59a63-5a88-421e-a884-145f1a7628e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6b4d7cea-3e94-45f3-b443-797d5bd4e4be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc958-d01e-009e-4ae5-644931000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac6d7884375b4465d2Fri, 06 Sep 2019 19:01:16 GMT\"0x8D732FC9833C652\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "6b4d7cea-3e94-45f3-b443-797d5bd4e4be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6d7884375b4465d2?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" : "cd62230b-b165-460a-ba07-40f996c1d440" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc997-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "cd62230b-b165-460a-ba07-40f996c1d440" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac6d7884375b4465d2", "javablobcopysourceac1blobapitestcopysourceac6d767081cd38d", "javablobcopysourceac2blobapitestcopysourceac6d730616dcc79" ] +} \ 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..80edd13304bb --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacb3820163461d2437?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" : "dbfa8dc3-21a2-4eb8-89c3-a54549a3fff1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC985E89A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc9cb-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "dbfa8dc3-21a2-4eb8-89c3-a54549a3fff1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacb3820163461d2437/javablobcopysourceac1blobapitestcopysourceacb387804353be6", + "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" : "30bc53ff-9ce4-424f-85dd-ee4804c73128", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9865927B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bca07-d01e-009e-72e5-644931000000", + "x-ms-client-request-id" : "30bc53ff-9ce4-424f-85dd-ee4804c73128" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacb3820163461d2437/javablobcopysourceac1blobapitestcopysourceacb387804353be6", + "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" : "e8e6521e-04f3-4e2d-9c6f-30ff065eb163" + }, + "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" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FC9865927B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:16 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bca31-d01e-009e-19e5-644931000000", + "x-ms-client-request-id" : "e8e6521e-04f3-4e2d-9c6f-30ff065eb163", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacb3820163461d2437/javablobcopysourceac2blobapitestcopysourceacb3843005219f6", + "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" : "44ea7dca-f2e1-476e-9614-81f5ef573e72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b84c362e-5813-4ed0-93fb-3f7df7dc5ece", + "ETag" : "\"0x8D732FC9871F182\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bca4d-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "44ea7dca-f2e1-476e-9614-81f5ef573e72" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e5400e56-77ad-413e-bb44-ad27b3031303" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bca74-d01e-009e-5ce5-644931000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceacb3820163461d2437Fri, 06 Sep 2019 19:01:16 GMT\"0x8D732FC985E89A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "e5400e56-77ad-413e-bb44-ad27b3031303", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacb3820163461d2437?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" : "4eb053d2-9f53-4e0b-830a-87f8d6805bf9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bca8d-d01e-009e-74e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "4eb053d2-9f53-4e0b-830a-87f8d6805bf9" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceacb3820163461d2437", "javablobcopysourceac1blobapitestcopysourceacb387804353be6", "javablobcopysourceac2blobapitestcopysourceacb3843005219f6" ] +} \ 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..8a25be1389d1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca5000923df367835?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" : "9817edba-6bb6-425a-b2c9-77ce6d82a3b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC98872997\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bcab8-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "9817edba-6bb6-425a-b2c9-77ce6d82a3b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca5000923df367835/javablobcopysourceac1blobapitestcopysourceaca50311176c072", + "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" : "c0355077-2dc5-4de5-a3b4-355dd9ed4ba9", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC988E59E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bcae7-d01e-009e-45e5-644931000000", + "x-ms-client-request-id" : "c0355077-2dc5-4de5-a3b4-355dd9ed4ba9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca5000923df367835/javablobcopysourceac2blobapitestcopysourceaca50413950547f", + "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" : "e0a1cca4-55e2-45ad-9612-d1a27c2c75eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "e5397d12-c805-44f4-b32e-86a61bf19e47", + "ETag" : "\"0x8D732FC9895FCD1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b92bcb0f-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "e0a1cca4-55e2-45ad-9612-d1a27c2c75eb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8cd1522e-0ed9-4cbb-bb07-8ea200c668c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bcb49-d01e-009e-18e5-644931000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceaca5000923df367835Fri, 06 Sep 2019 19:01:16 GMT\"0x8D732FC98872997\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "8cd1522e-0ed9-4cbb-bb07-8ea200c668c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca5000923df367835?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" : "ac9b439f-1357-4365-b0cc-e8ee5ed57e79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bcb67-d01e-009e-34e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "ac9b439f-1357-4365-b0cc-e8ee5ed57e79" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceaca5000923df367835", "javablobcopysourceac1blobapitestcopysourceaca50311176c072", "javablobcopysourceac2blobapitestcopysourceaca50413950547f" ] +} \ 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..c234f882e916 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail42a73318d1a5?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" : "3c51c504-93e9-4210-a34f-b0f30ce34f4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC98AA4A00\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bcb9e-d01e-009e-63e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "3c51c504-93e9-4210-a34f-b0f30ce34f4d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail42a73318d1a5/javablobcopysourceacfail1blobapitestcopysourceacfail42a453436", + "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" : "0d02f944-8406-4557-b96f-dbce7f40ae2b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC98BEC42E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bcc27-d01e-009e-59e5-644931000000", + "x-ms-client-request-id" : "0d02f944-8406-4557-b96f-dbce7f40ae2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail42a73318d1a5/javablobcopysourceacfail2blobapitestcopysourceacfail42a556604", + "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" : "f705b89f-36e0-476d-86ca-dd71e1674718" + }, + "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" : "b92bcc4d-d01e-009e-7ae5-644931000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bcc4d-d01e-009e-7ae5-644931000000\nTime:2019-09-06T19:01:17.2400376Z", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "f705b89f-36e0-476d-86ca-dd71e1674718", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b94f2fc1-2a38-4d20-996b-da6840b889ec" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bcc6e-d01e-009e-19e5-644931000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail42a73318d1a5Fri, 06 Sep 2019 19:01:17 GMT\"0x8D732FC98AA4A00\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:16 GMT", + "x-ms-client-request-id" : "b94f2fc1-2a38-4d20-996b-da6840b889ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail42a73318d1a5?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" : "ef7cf637-d96f-4bff-8289-d900348b3fc5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bcc95-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "ef7cf637-d96f-4bff-8289-d900348b3fc5" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail42a73318d1a5", "javablobcopysourceacfail1blobapitestcopysourceacfail42a453436", "javablobcopysourceacfail2blobapitestcopysourceacfail42a556604" ] +} \ 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..d0f8fda316e5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail43e261895274?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" : "abe4c0de-0300-4863-ad70-d7d823c8d4c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC98D8DEC1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bcce3-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "abe4c0de-0300-4863-ad70-d7d823c8d4c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail43e261895274/javablobcopysourceacfail1blobapitestcopysourceacfail43e57801f", + "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" : "0f063795-eea8-4f5d-82aa-f6400f49d3dc", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC98DEAFD5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bcd05-d01e-009e-1fe5-644931000000", + "x-ms-client-request-id" : "0f063795-eea8-4f5d-82aa-f6400f49d3dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail43e261895274/javablobcopysourceacfail2blobapitestcopysourceacfail43e206493", + "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" : "f68f709b-3257-46c2-9b8b-1b9dfd9b182c" + }, + "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" : "b92bcd25-d01e-009e-3de5-644931000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bcd25-d01e-009e-3de5-644931000000\nTime:2019-09-06T19:01:17.4512265Z", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "f68f709b-3257-46c2-9b8b-1b9dfd9b182c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d8d21361-9ef6-4433-9fa6-6b5dff279d71" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bcd41-d01e-009e-54e5-644931000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail43e261895274Fri, 06 Sep 2019 19:01:17 GMT\"0x8D732FC98D8DEC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "d8d21361-9ef6-4433-9fa6-6b5dff279d71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail43e261895274?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" : "f9d800ff-e3e2-4c8f-8978-c237600c8d8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bcd62-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "f9d800ff-e3e2-4c8f-8978-c237600c8d8b" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail43e261895274", "javablobcopysourceacfail1blobapitestcopysourceacfail43e57801f", "javablobcopysourceacfail2blobapitestcopysourceacfail43e206493" ] +} \ 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..65e20d321d85 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailfb62471883d4?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" : "10847e44-6a39-4d75-8a60-3aa956569173" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC98FC4D60\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bcd93-d01e-009e-1fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "10847e44-6a39-4d75-8a60-3aa956569173" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailfb62471883d4/javablobcopysourceacfail1blobapitestcopysourceacfailfb693500c", + "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" : "0b304975-8854-4bf4-9b5c-9205ada0d858", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC99046938\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bcdf3-d01e-009e-75e5-644931000000", + "x-ms-client-request-id" : "0b304975-8854-4bf4-9b5c-9205ada0d858" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailfb62471883d4/javablobcopysourceacfail2blobapitestcopysourceacfailfb6979410", + "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" : "865bac61-142a-43cf-95ce-896026b76b10" + }, + "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" : "b92bce17-d01e-009e-15e5-644931000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bce17-d01e-009e-15e5-644931000000\nTime:2019-09-06T19:01:17.6914421Z", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "865bac61-142a-43cf-95ce-896026b76b10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "faefa0f6-052e-46c7-b0a6-e3a4b8bd69b3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bce36-d01e-009e-32e5-644931000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfailfb62471883d4Fri, 06 Sep 2019 19:01:17 GMT\"0x8D732FC98FC4D60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "faefa0f6-052e-46c7-b0a6-e3a4b8bd69b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailfb62471883d4?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" : "5ff06d49-7e3c-40ba-a90b-26518776a2d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bce5c-d01e-009e-54e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "5ff06d49-7e3c-40ba-a90b-26518776a2d1" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfailfb62471883d4", "javablobcopysourceacfail1blobapitestcopysourceacfailfb693500c", "javablobcopysourceacfail2blobapitestcopysourceacfailfb6979410" ] +} \ 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..9b53f702735c --- /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://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7e?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" : "9ef8f387-7d98-4d6b-b37d-5eeec9d5d4c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC991B7545\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bce92-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "9ef8f387-7d98-4d6b-b37d-5eeec9d5d4c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7e/javablobcopysourceacfail1blobapitestcopysourceacfail76f474876", + "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" : "409f0236-91de-4643-9002-7ab495a092ba", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9921BC2F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bcebf-d01e-009e-33e5-644931000000", + "x-ms-client-request-id" : "409f0236-91de-4643-9002-7ab495a092ba" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7e/javablobcopysourceacfail1blobapitestcopysourceacfail76f474876", + "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" : "9fa09614-decd-4fdb-bb65-d31d2ed06873" + }, + "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" : "Fri, 06 Sep 2019 19:01:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FC9921BC2F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bcee9-d01e-009e-59e5-644931000000", + "x-ms-client-request-id" : "9fa09614-decd-4fdb-bb65-d31d2ed06873", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7e/javablobcopysourceacfail2blobapitestcopysourceacfail76f65766a", + "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" : "6eb48a32-4e9b-46fd-ada1-44fecc64a1b8" + }, + "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" : "b92bcf1c-d01e-009e-06e5-644931000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bcf1c-d01e-009e-06e5-644931000000\nTime:2019-09-06T19:01:17.9236496Z", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "6eb48a32-4e9b-46fd-ada1-44fecc64a1b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "20a10d55-5e77-46e1-a274-a369c9ec50ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bcf40-d01e-009e-28e5-644931000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7eFri, 06 Sep 2019 19:01:17 GMT\"0x8D732FC991B7545\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "20a10d55-5e77-46e1-a274-a369c9ec50ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7e?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" : "1183fd18-de7e-42a9-b8b6-059b26a3879d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bcf5a-d01e-009e-41e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:17 GMT", + "x-ms-client-request-id" : "1183fd18-de7e-42a9-b8b6-059b26a3879d" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail76f18001ab7e", "javablobcopysourceacfail1blobapitestcopysourceacfail76f474876", "javablobcopysourceacfail2blobapitestcopysourceacfail76f65766a" ] +} \ 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..1c4a3780e8f1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete721059480d9c215c5bb44f?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" : "22b85e9c-287e-4088-bad3-dfe7f9d0618e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA62FF415\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2bab-d01e-009e-22e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "22b85e9c-287e-4088-bad3-dfe7f9d0618e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete721059480d9c215c5bb44f/javablobdelete1blobapitestdelete72148228042adecde05", + "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" : "3e0bfa45-6e54-4f13-8295-790012023e7a", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA6385187\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2bf2-d01e-009e-64e5-644931000000", + "x-ms-client-request-id" : "3e0bfa45-6e54-4f13-8295-790012023e7a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete721059480d9c215c5bb44f/javablobdelete1blobapitestdelete72148228042adecde05", + "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" : "99bd40a7-8910-4f35-90b7-4aeea82b97f4" + }, + "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" : "b92c2c3f-d01e-009e-2fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "99bd40a7-8910-4f35-90b7-4aeea82b97f4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5abec123-45e4-4ade-86aa-6a8aaa8eb487" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2c7b-d01e-009e-68e5-644931000000", + "Body" : "jtcdeletejtcdelete0blobapitestdelete721059480d9c215c5bb44fFri, 06 Sep 2019 19:01:39 GMT\"0x8D732FCA62FF415\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "5abec123-45e4-4ade-86aa-6a8aaa8eb487", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete721059480d9c215c5bb44f?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" : "24dbba77-6846-4f82-82ea-df30ea1495de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c2c97-d01e-009e-03e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "24dbba77-6846-4f82-82ea-df30ea1495de" + }, + "Exception" : null + } ], + "variables" : [ "jtcdelete0blobapitestdelete721059480d9c215c5bb44f", "javablobdelete1blobapitestdelete72148228042adecde05" ] +} \ 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..a20a3b40c29c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac9aa3663839a917d52ee1?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" : "8b1c72fd-f300-4a66-8960-2925982e6a3d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA70CCB17\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3232-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "8b1c72fd-f300-4a66-8960-2925982e6a3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac9aa3663839a917d52ee1/javablobdeleteac1blobapitestdeleteac9aa38538c06667226", + "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" : "d67d7182-54f5-492a-ae46-9765f13e2f77", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA7132E0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3260-d01e-009e-28e5-644931000000", + "x-ms-client-request-id" : "d67d7182-54f5-492a-ae46-9765f13e2f77" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac9aa3663839a917d52ee1/javablobdeleteac1blobapitestdeleteac9aa38538c06667226", + "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" : "bac4152f-73b1-4980-9031-ad33fce5c4aa" + }, + "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" : "b92c3280-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "bac4152f-73b1-4980-9031-ad33fce5c4aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c1c70dfc-b861-4a3e-ad71-d56a6b5f4f93" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c32a1-d01e-009e-61e5-644931000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac9aa3663839a917d52ee1Fri, 06 Sep 2019 19:01:41 GMT\"0x8D732FCA70CCB17\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "c1c70dfc-b861-4a3e-ad71-d56a6b5f4f93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac9aa3663839a917d52ee1?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" : "e7bab2ff-70c6-44d7-a09c-8a08e79dc011" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c32c3-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "e7bab2ff-70c6-44d7-a09c-8a08e79dc011" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac9aa3663839a917d52ee1", "javablobdeleteac1blobapitestdeleteac9aa38538c06667226" ] +} \ 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..e17d5a603b7c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfba86779d5d8c983ae5b?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" : "a03b8a79-7aab-481d-a9b3-8e503de4f8c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA72A44EB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c32f2-d01e-009e-2be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "a03b8a79-7aab-481d-a9b3-8e503de4f8c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfba86779d5d8c983ae5b/javablobdeleteac1blobapitestdeleteacfba012155cd77ad14", + "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" : "cda70a59-ee9d-425f-90a5-955423ab2976", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA7320802\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3327-d01e-009e-5ae5-644931000000", + "x-ms-client-request-id" : "cda70a59-ee9d-425f-90a5-955423ab2976" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfba86779d5d8c983ae5b/javablobdeleteac1blobapitestdeleteacfba012155cd77ad14", + "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" : "f3d33721-06c8-409f-9b69-a1dade43d891" + }, + "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" : "b92c335a-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "f3d33721-06c8-409f-9b69-a1dade43d891" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96b9d387-db0e-4c43-a6a8-4390ccd9e9aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c337c-d01e-009e-27e5-644931000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteacfba86779d5d8c983ae5bFri, 06 Sep 2019 19:01:41 GMT\"0x8D732FCA72A44EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "96b9d387-db0e-4c43-a6a8-4390ccd9e9aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfba86779d5d8c983ae5b?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" : "07e20aa8-60ea-4198-9f05-bb318ebfa78c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c339f-d01e-009e-47e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "07e20aa8-60ea-4198-9f05-bb318ebfa78c" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteacfba86779d5d8c983ae5b", "javablobdeleteac1blobapitestdeleteacfba012155cd77ad14" ] +} \ 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..7ca9d8a101a2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac17055099ceaf34405daa?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" : "6e55a14a-0768-4ff0-a239-af72ae984b2d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA7552F50\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c33de-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "6e55a14a-0768-4ff0-a239-af72ae984b2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac17055099ceaf34405daa/javablobdeleteac1blobapitestdeleteac17065374d550ca106", + "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" : "118b9c0f-bab5-45e2-af1c-0c39c7b340a7", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA75C565C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3456-d01e-009e-74e5-644931000000", + "x-ms-client-request-id" : "118b9c0f-bab5-45e2-af1c-0c39c7b340a7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac17055099ceaf34405daa/javablobdeleteac1blobapitestdeleteac17065374d550ca106", + "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" : "6fc0f585-2622-4b9c-afdb-cce538410dce" + }, + "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" : "b92c347f-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "6fc0f585-2622-4b9c-afdb-cce538410dce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ad95f024-2a07-4a49-8452-5648d4814486" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c3497-d01e-009e-2ee5-644931000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac17055099ceaf34405daaFri, 06 Sep 2019 19:01:41 GMT\"0x8D732FCA7552F50\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "ad95f024-2a07-4a49-8452-5648d4814486", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac17055099ceaf34405daa?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" : "4977d218-b8fa-4ca8-8925-49974ac8a0db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c34c3-d01e-009e-57e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "4977d218-b8fa-4ca8-8925-49974ac8a0db" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac17055099ceaf34405daa", "javablobdeleteac1blobapitestdeleteac17065374d550ca106" ] +} \ 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..07ee04121228 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac0c259788c5add6327de8?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" : "298586c9-5331-4fd8-9000-3a60228957cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA772F75B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c34ff-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "298586c9-5331-4fd8-9000-3a60228957cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac0c259788c5add6327de8/javablobdeleteac1blobapitestdeleteac0c2950472584a8142", + "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" : "9383d472-eb3a-4965-9e6a-09a63c3a2f46", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA7795B25\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3530-d01e-009e-33e5-644931000000", + "x-ms-client-request-id" : "9383d472-eb3a-4965-9e6a-09a63c3a2f46" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac0c259788c5add6327de8/javablobdeleteac1blobapitestdeleteac0c2950472584a8142", + "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" : "1c27a141-2491-48c7-89ef-5e8e1381a74f" + }, + "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" : "Fri, 06 Sep 2019 19:01:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:41 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" : "\"0x8D732FCA7795B25\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c3560-d01e-009e-5ce5-644931000000", + "x-ms-client-request-id" : "1c27a141-2491-48c7-89ef-5e8e1381a74f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac0c259788c5add6327de8/javablobdeleteac1blobapitestdeleteac0c2950472584a8142", + "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" : "40b8f3fd-94c1-4234-b5a6-2e9e94a66d86" + }, + "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" : "b92c3593-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "40b8f3fd-94c1-4234-b5a6-2e9e94a66d86" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea2b838b-fbb0-4996-8eaa-6e7eaa6f8a59" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c35bd-d01e-009e-30e5-644931000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac0c259788c5add6327de8Fri, 06 Sep 2019 19:01:41 GMT\"0x8D732FCA772F75B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "ea2b838b-fbb0-4996-8eaa-6e7eaa6f8a59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac0c259788c5add6327de8?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" : "22732cad-c2a9-4dab-98de-eb26beab8bb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c35d6-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "22732cad-c2a9-4dab-98de-eb26beab8bb2" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac0c259788c5add6327de8", "javablobdeleteac1blobapitestdeleteac0c2950472584a8142" ] +} \ 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..dea963fecd8a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacae166071d7ea28f4e83c?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" : "e396d083-57fa-4d1b-a48c-d39a6ddab653" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA7963EDF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3610-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "e396d083-57fa-4d1b-a48c-d39a6ddab653" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacae166071d7ea28f4e83c/javablobdeleteac1blobapitestdeleteacae167694742f45231", + "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" : "75a60c3b-139d-4d12-9015-30da4f05c030", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA79CA2EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c364b-d01e-009e-30e5-644931000000", + "x-ms-client-request-id" : "75a60c3b-139d-4d12-9015-30da4f05c030" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacae166071d7ea28f4e83c/javablobdeleteac1blobapitestdeleteacae167694742f45231", + "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" : "279b9e67-5ea5-46b6-87c3-ba0ea84036ac" + }, + "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" : "b92c367f-d01e-009e-60e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "279b9e67-5ea5-46b6-87c3-ba0ea84036ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "59c7449b-6717-4255-a75d-0be0b9f3305a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c36b9-d01e-009e-17e5-644931000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteacae166071d7ea28f4e83cFri, 06 Sep 2019 19:01:42 GMT\"0x8D732FCA7963EDF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "59c7449b-6717-4255-a75d-0be0b9f3305a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacae166071d7ea28f4e83c?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" : "5ef098e5-a73f-4153-8f94-816515821c9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c36e0-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "5ef098e5-a73f-4153-8f94-816515821c9b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteacae166071d7ea28f4e83c", "javablobdeleteac1blobapitestdeleteacae167694742f45231" ] +} \ 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..3e6556322bce --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61f?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" : "b33a758b-9ee4-4f0a-b346-60a2ab421656" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA7B8E9FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3738-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:41 GMT", + "x-ms-client-request-id" : "b33a758b-9ee4-4f0a-b346-60a2ab421656" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61f/javablobdeleteac1blobapitestdeleteacc954145728e8c73ad", + "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" : "c4394e0f-7b53-475d-86a2-b67a1731dfac", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA7C08727\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3770-d01e-009e-3ee5-644931000000", + "x-ms-client-request-id" : "c4394e0f-7b53-475d-86a2-b67a1731dfac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61f/javablobdeleteac1blobapitestdeleteacc954145728e8c73ad?comp=lease", + "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" : "8a17a40f-155d-4452-8d6c-6bd897f62806" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA7C08727\"", + "x-ms-lease-id" : "fd1f1831-ad33-4fb3-9bd3-2813291167d8", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c37a2-d01e-009e-6ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "8a17a40f-155d-4452-8d6c-6bd897f62806" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61f/javablobdeleteac1blobapitestdeleteacc954145728e8c73ad", + "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" : "dabfeed3-b598-4dcf-a4c2-ee207ef085a6" + }, + "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" : "b92c37d7-d01e-009e-17e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "dabfeed3-b598-4dcf-a4c2-ee207ef085a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "16b98717-5f5b-4d2e-8703-8b61686ac05f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c3804-d01e-009e-41e5-644931000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61fFri, 06 Sep 2019 19:01:42 GMT\"0x8D732FCA7B8E9FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "16b98717-5f5b-4d2e-8703-8b61686ac05f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61f?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" : "48050179-7ba1-4901-86a6-637bdaa8f6ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c382e-d01e-009e-6ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "48050179-7ba1-4901-86a6-637bdaa8f6ec" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteacc95182289fb1a18fb61f", "javablobdeleteac1blobapitestdeleteacc954145728e8c73ad" ] +} \ 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..211bac9e3ad5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail3c177152b2259c5d?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" : "4ebe46a1-2035-45c2-ac97-d5784bc2ab61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA7E1FF4C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3867-d01e-009e-21e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "4ebe46a1-2035-45c2-ac97-d5784bc2ab61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail3c177152b2259c5d/javablobdeleteacfail1blobapitestdeleteacfail3c108371f2b62", + "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" : "6209a77d-ffd1-4c4c-b4a4-9b6cc37f989d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA7EB23B4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c38ad-d01e-009e-5ee5-644931000000", + "x-ms-client-request-id" : "6209a77d-ffd1-4c4c-b4a4-9b6cc37f989d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail3c177152b2259c5d/javablobdeleteacfail1blobapitestdeleteacfail3c108371f2b62", + "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" : "01536b1d-86f1-4958-ac9a-eb02998e16bb" + }, + "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" : "b92c38e7-d01e-009e-15e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c38e7-d01e-009e-15e5-644931000000\nTime:2019-09-06T19:01:42.7018889Z", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "01536b1d-86f1-4958-ac9a-eb02998e16bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "99b551b7-e978-4630-8bce-595391d725dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c3921-d01e-009e-46e5-644931000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail3c177152b2259c5dFri, 06 Sep 2019 19:01:42 GMT\"0x8D732FCA7E1FF4C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "99b551b7-e978-4630-8bce-595391d725dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail3c177152b2259c5d?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" : "fca624eb-b283-4c61-9d9f-56d60ba451cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c3972-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "fca624eb-b283-4c61-9d9f-56d60ba451cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail3c177152b2259c5d", "javablobdeleteacfail1blobapitestdeleteacfail3c108371f2b62" ] +} \ 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..53d01cbf7eb2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildbb4060113330a24?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" : "d4ba348e-b6b2-4330-a684-f76e68b2b864" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA818FA7E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c39f7-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "d4ba348e-b6b2-4330-a684-f76e68b2b864" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildbb4060113330a24/javablobdeleteacfail1blobapitestdeleteacfaildbb70161e46ef", + "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" : "100a73f4-6784-4cdc-9d48-2000035b5b40", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA8270270\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3a37-d01e-009e-42e5-644931000000", + "x-ms-client-request-id" : "100a73f4-6784-4cdc-9d48-2000035b5b40" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildbb4060113330a24/javablobdeleteacfail1blobapitestdeleteacfaildbb70161e46ef", + "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" : "afe727ce-f2cc-43c9-92d4-7e13b06bf443" + }, + "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" : "b92c3b03-d01e-009e-7de5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c3b03-d01e-009e-7de5-644931000000\nTime:2019-09-06T19:01:43.1963354Z", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "afe727ce-f2cc-43c9-92d4-7e13b06bf443", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dfc0af8b-ba7d-4b34-b781-16ca5f14215c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c3b54-d01e-009e-4ae5-644931000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfaildbb4060113330a24Fri, 06 Sep 2019 19:01:42 GMT\"0x8D732FCA818FA7E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:42 GMT", + "x-ms-client-request-id" : "dfc0af8b-ba7d-4b34-b781-16ca5f14215c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildbb4060113330a24?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" : "19d002b1-ae80-4513-ac31-a2aa4b253edb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c3ccf-d01e-009e-26e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "19d002b1-ae80-4513-ac31-a2aa4b253edb" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfaildbb4060113330a24", "javablobdeleteacfail1blobapitestdeleteacfaildbb70161e46ef" ] +} \ 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..5e10038882a7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail8bc8608182683872?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" : "8a5c9321-ef95-4b7b-bcce-4b02526a54e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA8960F75\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3db6-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "8a5c9321-ef95-4b7b-bcce-4b02526a54e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail8bc8608182683872/javablobdeleteacfail1blobapitestdeleteacfail8bc91507c78cd", + "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" : "67b28195-068c-4b4a-bf95-7128d346792b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA89E2376\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3dfc-d01e-009e-38e5-644931000000", + "x-ms-client-request-id" : "67b28195-068c-4b4a-bf95-7128d346792b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail8bc8608182683872/javablobdeleteacfail1blobapitestdeleteacfail8bc91507c78cd", + "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" : "68dd1cc3-2b7b-4fce-9a09-6618f4d23c23" + }, + "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" : "b92c3e23-d01e-009e-5ee5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c3e23-d01e-009e-5ee5-644931000000\nTime:2019-09-06T19:01:43.8669381Z", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "68dd1cc3-2b7b-4fce-9a09-6618f4d23c23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5f6d7108-c6a8-4ec8-ad45-cdd50b7e9ccd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c3e4a-d01e-009e-04e5-644931000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail8bc8608182683872Fri, 06 Sep 2019 19:01:43 GMT\"0x8D732FCA8960F75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "5f6d7108-c6a8-4ec8-ad45-cdd50b7e9ccd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail8bc8608182683872?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" : "cc03ca31-6855-4836-a5b4-23f8338c4c64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c3e8b-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "cc03ca31-6855-4836-a5b4-23f8338c4c64" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail8bc8608182683872", "javablobdeleteacfail1blobapitestdeleteacfail8bc91507c78cd" ] +} \ 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..c2b26869e66e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6c?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" : "2df3ee75-9fc0-4ba7-ad58-ef7e9cb7c4e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA8B7F720\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3ed4-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "2df3ee75-9fc0-4ba7-ad58-ef7e9cb7c4e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6c/javablobdeleteacfail1blobapitestdeleteacfaile5e3296393566", + "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" : "6d67fe70-4ba4-4554-a451-bb5f348b52b3", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA8BF961A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3f13-d01e-009e-35e5-644931000000", + "x-ms-client-request-id" : "6d67fe70-4ba4-4554-a451-bb5f348b52b3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6c/javablobdeleteacfail1blobapitestdeleteacfaile5e3296393566", + "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" : "0a81862f-a08a-4d0f-871a-1d1bf8f970fc" + }, + "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" : "Fri, 06 Sep 2019 19:01:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FCA8BF961A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:44 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c3f58-d01e-009e-72e5-644931000000", + "x-ms-client-request-id" : "0a81862f-a08a-4d0f-871a-1d1bf8f970fc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6c/javablobdeleteacfail1blobapitestdeleteacfaile5e3296393566", + "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" : "308df539-5d8c-4ebb-9a87-e0936f04a5e1" + }, + "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" : "b92c3f8b-d01e-009e-21e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c3f8b-d01e-009e-21e5-644931000000\nTime:2019-09-06T19:01:44.1351774Z", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "308df539-5d8c-4ebb-9a87-e0936f04a5e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1f2cd1ac-e079-4503-8030-92e90bacc976" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c3fbd-d01e-009e-4fe5-644931000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6cFri, 06 Sep 2019 19:01:43 GMT\"0x8D732FCA8B7F720\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "1f2cd1ac-e079-4503-8030-92e90bacc976", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6c?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" : "542cf630-baa0-42db-b4ac-65448ee4c2e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c3ff5-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:43 GMT", + "x-ms-client-request-id" : "542cf630-baa0-42db-b4ac-65448ee4c2e2" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfaile5e544274db7df6c", "javablobdeleteacfail1blobapitestdeleteacfaile5e3296393566" ] +} \ 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..f63ccae18f20 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail76638602abae76ee?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" : "4201046b-1a6f-42a7-b92e-f437d0484c2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA8F8B874\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c40f1-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "4201046b-1a6f-42a7-b92e-f437d0484c2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail76638602abae76ee/javablobdeleteacfail1blobapitestdeleteacfail766235750d716", + "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" : "048971fa-24f4-47b4-95b6-01b3457f7269", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA900A629\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c411c-d01e-009e-13e5-644931000000", + "x-ms-client-request-id" : "048971fa-24f4-47b4-95b6-01b3457f7269" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail76638602abae76ee/javablobdeleteacfail1blobapitestdeleteacfail766235750d716?comp=lease", + "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" : "15fb37e5-a1e3-4aa9-9616-61f098e17ef4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA900A629\"", + "x-ms-lease-id" : "59cd6170-8445-49ca-8e8e-546c0a0cc912", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c4162-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "15fb37e5-a1e3-4aa9-9616-61f098e17ef4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail76638602abae76ee/javablobdeleteacfail1blobapitestdeleteacfail766235750d716", + "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" : "eb8c775e-dde9-4491-999c-8eca0e5e2988" + }, + "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" : "b92c419c-d01e-009e-05e5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92c419c-d01e-009e-05e5-644931000000\nTime:2019-09-06T19:01:44.5645617Z", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "eb8c775e-dde9-4491-999c-8eca0e5e2988", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c5dbc834-9e28-4034-a158-6409c16c9528" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c41c8-d01e-009e-2fe5-644931000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail76638602abae76eeFri, 06 Sep 2019 19:01:44 GMT\"0x8D732FCA8F8B874\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "c5dbc834-9e28-4034-a158-6409c16c9528", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail76638602abae76ee?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" : "ccf4e906-730a-4c8a-9222-b39f1075ba80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c420e-d01e-009e-70e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "ccf4e906-730a-4c8a-9222-b39f1075ba80" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail76638602abae76ee", "javablobdeleteacfail1blobapitestdeleteacfail766235750d716" ] +} \ 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..e983db12c2ab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeletemin3032053138d90d79b06?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" : "53d45c68-aba1-4741-9948-1b2c3590f9f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA658E23C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2cc6-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "53d45c68-aba1-4741-9948-1b2c3590f9f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeletemin3032053138d90d79b06/javablobdeletemin1blobapitestdeletemin3031981027d5243e", + "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" : "709c6b31-2eae-4ad3-b421-696a4fc526f4", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA6613FFB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2d18-d01e-009e-74e5-644931000000", + "x-ms-client-request-id" : "709c6b31-2eae-4ad3-b421-696a4fc526f4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeletemin3032053138d90d79b06/javablobdeletemin1blobapitestdeletemin3031981027d5243e", + "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" : "acaa7617-6671-4224-ac1f-030bfcb4f255" + }, + "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" : "b92c2d64-d01e-009e-3ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "acaa7617-6671-4224-ac1f-030bfcb4f255" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aea4b254-6178-4962-933f-4ddb1c06b087" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2d9a-d01e-009e-6fe5-644931000000", + "Body" : "jtcdeleteminjtcdeletemin0blobapitestdeletemin3032053138d90d79b06Fri, 06 Sep 2019 19:01:40 GMT\"0x8D732FCA658E23C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "aea4b254-6178-4962-933f-4ddb1c06b087", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeletemin3032053138d90d79b06?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" : "5e09410b-dc42-4f54-8292-0f5347d35f8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c2dcb-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "5e09410b-dc42-4f54-8292-0f5347d35f8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeletemin0blobapitestdeletemin3032053138d90d79b06", "javablobdeletemin1blobapitestdeletemin3031981027d5243e" ] +} \ 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..1504df2496bc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9?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" : "780613bc-7921-449a-977b-2c177ea74584" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA684DE52\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2e01-d01e-009e-41e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "780613bc-7921-449a-977b-2c177ea74584" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9/javablobdeleteoptions1blobapitestdeleteoptions13f8282041a4", + "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" : "c8c1d3c6-3921-4b72-8dfc-8c7aa2a9927d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA6921F96\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2eba-d01e-009e-62e5-644931000000", + "x-ms-client-request-id" : "c8c1d3c6-3921-4b72-8dfc-8c7aa2a9927d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9/javablobdeleteoptions1blobapitestdeleteoptions13f8282041a4?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", + "x-ms-client-request-id" : "294f7998-7f8c-4d2f-b71e-d4671d5b0237" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:40.4356489Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA6921F96\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2ef1-d01e-009e-13e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "294f7998-7f8c-4d2f-b71e-d4671d5b0237" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9/javablobdeleteoptions2blobapitestdeleteoptions13f42280341b", + "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" : "02f92bd6-c542-40b2-9b99-5cb43fa74068", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA6A1B3AE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2f2a-d01e-009e-49e5-644931000000", + "x-ms-client-request-id" : "02f92bd6-c542-40b2-9b99-5cb43fa74068" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9/javablobdeleteoptions1blobapitestdeleteoptions13f8282041a4", + "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" : "3c59260c-1910-4c9a-978f-d1406c445c2d" + }, + "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" : "b92c2f53-d01e-009e-71e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "3c59260c-1910-4c9a-978f-d1406c445c2d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d19d520a-b3f1-4cb8-9e53-60b5f419381a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2f8d-d01e-009e-26e5-644931000000", + "Body" : "javablobdeleteoptions2blobapitestdeleteoptions13f42280341bFri, 06 Sep 2019 19:01:40 GMTFri, 06 Sep 2019 19:01:40 GMT0x8D732FCA6A1B3AE7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "d19d520a-b3f1-4cb8-9e53-60b5f419381a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "854da9d4-5733-442a-8a53-214939326275" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2fd7-d01e-009e-70e5-644931000000", + "Body" : "jtcdeleteoptionsjtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9Fri, 06 Sep 2019 19:01:40 GMT\"0x8D732FCA684DE52\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "854da9d4-5733-442a-8a53-214939326275", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9?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" : "ac6b6002-3a35-4e54-928c-58961238b7a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c3007-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "ac6b6002-3a35-4e54-928c-58961238b7a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteoptions0blobapitestdeleteoptions13f08686a0980a9", "javablobdeleteoptions1blobapitestdeleteoptions13f8282041a4", "javablobdeleteoptions2blobapitestdeleteoptions13f42280341b" ] +} \ 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..1fbbac4c48cc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661?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" : "9d30b4a9-903c-4298-b7b3-277c21c0f48a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA6C35532\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c3033-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "9d30b4a9-903c-4298-b7b3-277c21c0f48a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661/javablobdeleteoptions1blobapitestdeleteoptions3ee237543019", + "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" : "bcae22f3-f06b-4c32-995b-15d79679e95b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA6C94240\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3057-d01e-009e-5ee5-644931000000", + "x-ms-client-request-id" : "bcae22f3-f06b-4c32-995b-15d79679e95b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661/javablobdeleteoptions1blobapitestdeleteoptions3ee237543019?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", + "x-ms-client-request-id" : "82c2eb8e-d430-496a-bb2e-70d72f1ea77a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:40.7979851Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA6C94240\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c307f-d01e-009e-02e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "82c2eb8e-d430-496a-bb2e-70d72f1ea77a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661/javablobdeleteoptions2blobapitestdeleteoptions3ee30823e918", + "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" : "6e7a0a13-5d37-431c-91f2-c8e4ec663338", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA6EFE63B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c3145-d01e-009e-32e5-644931000000", + "x-ms-client-request-id" : "6e7a0a13-5d37-431c-91f2-c8e4ec663338" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661/javablobdeleteoptions1blobapitestdeleteoptions3ee237543019", + "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" : "cc26c2c9-6eea-4c2d-8013-e69e5fe44350" + }, + "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" : "b92c3170-d01e-009e-58e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "cc26c2c9-6eea-4c2d-8013-e69e5fe44350" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "746fa595-a84f-45f8-8291-9f92c4e21a70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c31ad-d01e-009e-0fe5-644931000000", + "Body" : "javablobdeleteoptions1blobapitestdeleteoptions3ee237543019Fri, 06 Sep 2019 19:01:40 GMTFri, 06 Sep 2019 19:01:40 GMT0x8D732FCA6C942407application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javablobdeleteoptions2blobapitestdeleteoptions3ee30823e918Fri, 06 Sep 2019 19:01:41 GMTFri, 06 Sep 2019 19:01:41 GMT0x8D732FCA6EFE63B7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "746fa595-a84f-45f8-8291-9f92c4e21a70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0af47c69-77b5-44f9-a68c-47f2c836975f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c31d5-d01e-009e-33e5-644931000000", + "Body" : "jtcdeleteoptionsjtcdeleteoptions0blobapitestdeleteoptions3ee115509003661Fri, 06 Sep 2019 19:01:40 GMT\"0x8D732FCA6C35532\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "0af47c69-77b5-44f9-a68c-47f2c836975f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661?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" : "b86dcfc3-0888-482b-a5b0-93476c91fe73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c3203-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:40 GMT", + "x-ms-client-request-id" : "b86dcfc3-0888-482b-a5b0-93476c91fe73" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteoptions0blobapitestdeleteoptions3ee115509003661", "javablobdeleteoptions1blobapitestdeleteoptions3ee237543019", "javablobdeleteoptions2blobapitestdeleteoptions3ee30823e918" ] +} \ 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..3f4457dc2b19 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac51627241c29526e41a?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" : "b8e677da-d196-4d83-a97f-e69dabd5aeb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC73D47023\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae0fe-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "b8e677da-d196-4d83-a97f-e69dabd5aeb7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac51627241c29526e41a/javablobdownloadac1blobapitestdownloadac516950770c45f6b", + "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" : "ce470697-ae91-4f3f-a7d1-17f1646eb8b1", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC73DAE151\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae125-d01e-009e-72e5-644931000000", + "x-ms-client-request-id" : "ce470697-ae91-4f3f-a7d1-17f1646eb8b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac51627241c29526e41a/javablobdownloadac1blobapitestdownloadac516950770c45f6b", + "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" : "051f4342-4e0b-467b-857f-d979b29bf8b2" + }, + "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" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73DAE151\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae13f-d01e-009e-0be5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "051f4342-4e0b-467b-857f-d979b29bf8b2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e0214f41-94a9-4a61-a172-5ea6ae3a3a6f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae151-d01e-009e-1ce5-644931000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac51627241c29526e41aFri, 06 Sep 2019 19:00:15 GMT\"0x8D732FC73D47023\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "e0214f41-94a9-4a61-a172-5ea6ae3a3a6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac51627241c29526e41a?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" : "4c224c48-2e44-470f-b79b-31e6b778f71c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae17f-d01e-009e-40e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "4c224c48-2e44-470f-b79b-31e6b778f71c" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac51627241c29526e41a", "javablobdownloadac1blobapitestdownloadac516950770c45f6b" ] +} \ 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..64df84be8cb1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacfbf925169df2c084a6?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" : "c5b8be9f-febd-439d-8620-76968e823301" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC73F4A9C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae1a9-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "c5b8be9f-febd-439d-8620-76968e823301" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacfbf925169df2c084a6/javablobdownloadac1blobapitestdownloadacfbf54258e3119d9", + "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" : "78611326-afda-4bc4-a5fc-5d4723e79841", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC73FC2CDA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae1d3-d01e-009e-0be5-644931000000", + "x-ms-client-request-id" : "78611326-afda-4bc4-a5fc-5d4723e79841" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacfbf925169df2c084a6/javablobdownloadac1blobapitestdownloadacfbf54258e3119d9", + "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" : "882a254d-8dad-4933-9a92-b084d310472f" + }, + "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" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73FC2CDA\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae1f4-d01e-009e-2ce5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "882a254d-8dad-4933-9a92-b084d310472f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2519431b-f1b8-4666-8be0-1b6aa4c65659" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae21b-d01e-009e-4de5-644931000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacfbf925169df2c084a6Fri, 06 Sep 2019 19:00:15 GMT\"0x8D732FC73F4A9C6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "2519431b-f1b8-4666-8be0-1b6aa4c65659", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacfbf925169df2c084a6?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" : "4c7d3500-ad6f-4ccf-b42d-36e171a18c39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae232-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "4c7d3500-ad6f-4ccf-b42d-36e171a18c39" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacfbf925169df2c084a6", "javablobdownloadac1blobapitestdownloadacfbf54258e3119d9" ] +} \ 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..be36dcf7ada5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac5ab66492135463b69d?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" : "b1131c83-97ab-43bd-96cc-d20b811bc5b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7416434D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae254-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "b1131c83-97ab-43bd-96cc-d20b811bc5b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac5ab66492135463b69d/javablobdownloadac1blobapitestdownloadac5ab20913d45e8fd", + "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" : "03555b51-72df-4433-9d43-554197599e3f", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC741D2A2B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae274-d01e-009e-24e5-644931000000", + "x-ms-client-request-id" : "03555b51-72df-4433-9d43-554197599e3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac5ab66492135463b69d/javablobdownloadac1blobapitestdownloadac5ab20913d45e8fd", + "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" : "fe370a7d-f598-4a5d-9feb-48affde2d509" + }, + "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" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC741D2A2B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae29d-d01e-009e-4be5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "fe370a7d-f598-4a5d-9feb-48affde2d509", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "94302027-cc65-4cc8-b32c-4db8c702af21" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae2c0-d01e-009e-6be5-644931000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac5ab66492135463b69dFri, 06 Sep 2019 19:00:15 GMT\"0x8D732FC7416434D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "94302027-cc65-4cc8-b32c-4db8c702af21", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac5ab66492135463b69d?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" : "7425b014-bb61-4b6e-bfc3-cd9df76736c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae2e4-d01e-009e-0ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "7425b014-bb61-4b6e-bfc3-cd9df76736c7" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac5ab66492135463b69d", "javablobdownloadac1blobapitestdownloadac5ab20913d45e8fd" ] +} \ 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..3946a626d845 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac9ca0232848deba7cbd?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" : "81e08874-8d0e-4bd8-b27c-3eefdd5996bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC74362EB5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae310-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "81e08874-8d0e-4bd8-b27c-3eefdd5996bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac9ca0232848deba7cbd/javablobdownloadac1blobapitestdownloadac9ca640863da57ca", + "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" : "4dd75f66-0d6f-4cb7-a290-9a5e5e61ed78", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC743D15DB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae33a-d01e-009e-5be5-644931000000", + "x-ms-client-request-id" : "4dd75f66-0d6f-4cb7-a290-9a5e5e61ed78" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac9ca0232848deba7cbd/javablobdownloadac1blobapitestdownloadac9ca640863da57ca", + "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" : "1887fd36-0c37-407a-b11a-d86ccb16e1c1" + }, + "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" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:15 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" : "\"0x8D732FC743D15DB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae36a-d01e-009e-08e5-644931000000", + "x-ms-client-request-id" : "1887fd36-0c37-407a-b11a-d86ccb16e1c1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac9ca0232848deba7cbd/javablobdownloadac1blobapitestdownloadac9ca640863da57ca", + "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" : "95b979b2-e209-4dd1-8bac-ed562c5184db" + }, + "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" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC743D15DB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae394-d01e-009e-2de5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "95b979b2-e209-4dd1-8bac-ed562c5184db", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c406f55-532e-474d-8db6-17c571e5e3bb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae3b9-d01e-009e-4fe5-644931000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac9ca0232848deba7cbdFri, 06 Sep 2019 19:00:15 GMT\"0x8D732FC74362EB5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "4c406f55-532e-474d-8db6-17c571e5e3bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac9ca0232848deba7cbd?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" : "b08be0a9-ef1a-4ab2-bbdc-3f8b7fb53ec0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae3de-d01e-009e-70e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "b08be0a9-ef1a-4ab2-bbdc-3f8b7fb53ec0" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac9ca0232848deba7cbd", "javablobdownloadac1blobapitestdownloadac9ca640863da57ca" ] +} \ 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..eba504edc5c5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac61516871d26d3abc90?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" : "5e2cb779-0219-47f0-b41c-cdbd60173f30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC746C666D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae47f-d01e-009e-7de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "5e2cb779-0219-47f0-b41c-cdbd60173f30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac61516871d26d3abc90/javablobdownloadac1blobapitestdownloadac615927318cad875", + "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" : "137dc8e9-3cf2-4b15-9409-448ab5ec6dbb", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC74760DB0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae4af-d01e-009e-2ae5-644931000000", + "x-ms-client-request-id" : "137dc8e9-3cf2-4b15-9409-448ab5ec6dbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac61516871d26d3abc90/javablobdownloadac1blobapitestdownloadac615927318cad875", + "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" : "8d00b4d8-b651-44f0-b095-33eb575d7250" + }, + "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" : "Fri, 06 Sep 2019 19:00:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC74760DB0\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:16 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae4dd-d01e-009e-53e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "8d00b4d8-b651-44f0-b095-33eb575d7250", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ee376621-51de-4355-9233-49cb2a8dafb4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae509-d01e-009e-7ae5-644931000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac61516871d26d3abc90Fri, 06 Sep 2019 19:00:16 GMT\"0x8D732FC746C666D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "ee376621-51de-4355-9233-49cb2a8dafb4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac61516871d26d3abc90?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" : "b39a8082-7d1d-46fd-a707-c62091173600" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae51f-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "b39a8082-7d1d-46fd-a707-c62091173600" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac61516871d26d3abc90", "javablobdownloadac1blobapitestdownloadac615927318cad875" ] +} \ 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..684166a73c28 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac2ce484077334bf28f5?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" : "b9f68ee9-1728-45db-89a7-97df1ae0ef20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC74AD4EDD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae5d0-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "b9f68ee9-1728-45db-89a7-97df1ae0ef20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac2ce484077334bf28f5/javablobdownloadac1blobapitestdownloadac2ce81100f943b22", + "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" : "50bdc254-e509-4aa0-b032-e98d4d4bc52c", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC74C1CEA9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae649-d01e-009e-1fe5-644931000000", + "x-ms-client-request-id" : "50bdc254-e509-4aa0-b032-e98d4d4bc52c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac2ce484077334bf28f5/javablobdownloadac1blobapitestdownloadac2ce81100f943b22?comp=lease", + "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" : "1d4bbda4-1244-4961-9d70-859f1bce0fd6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC74C1CEA9\"", + "x-ms-lease-id" : "4c0ac0da-a170-4b0f-859a-b8c256e83e05", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae693-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "1d4bbda4-1244-4961-9d70-859f1bce0fd6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac2ce484077334bf28f5/javablobdownloadac1blobapitestdownloadac2ce81100f943b22", + "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" : "d06fb6eb-7ad0-441c-bf70-e8d14b1511d9" + }, + "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" : "Fri, 06 Sep 2019 19:00:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC74C1CEA9\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "b92ae6b0-d01e-009e-79e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d06fb6eb-7ad0-441c-bf70-e8d14b1511d9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a5dcb25c-b3da-4ba1-80d3-19101473b762" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae6cb-d01e-009e-10e5-644931000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac2ce484077334bf28f5Fri, 06 Sep 2019 19:00:16 GMT\"0x8D732FC74AD4EDD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "a5dcb25c-b3da-4ba1-80d3-19101473b762", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac2ce484077334bf28f5?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" : "500e3367-d8be-4a79-a119-227b1aea2535" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae6e2-d01e-009e-25e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "500e3367-d8be-4a79-a119-227b1aea2535" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac2ce484077334bf28f5", "javablobdownloadac1blobapitestdownloadac2ce81100f943b22" ] +} \ 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..5007404c6220 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb130296955053d?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" : "8511c9c2-bd8d-404f-b787-1934c31f0a3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC74F6C4C2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae76a-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "x-ms-client-request-id" : "8511c9c2-bd8d-404f-b787-1934c31f0a3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb130296955053d/javablobdownloadacfail1blobapitestdownloadacfailb1360986981", + "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" : "9e834bbb-2184-45b1-be0f-c1fbceaa05ce", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC74FCC2C9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae796-d01e-009e-45e5-644931000000", + "x-ms-client-request-id" : "9e834bbb-2184-45b1-be0f-c1fbceaa05ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb130296955053d/javablobdownloadacfail1blobapitestdownloadacfailb1360986981", + "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" : "31802aa2-394d-42b2-852e-1a9591b8fd5c" + }, + "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" : "b92ae7bb-d01e-009e-68e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "31802aa2-394d-42b2-852e-1a9591b8fd5c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15c44c45-0973-4aa3-b476-769d8ed185fb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae7d7-d01e-009e-02e5-644931000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailb130296955053dFri, 06 Sep 2019 19:00:17 GMT\"0x8D732FC74F6C4C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "15c44c45-0973-4aa3-b476-769d8ed185fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb130296955053d?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" : "c6bce898-3f47-4542-a9c5-2308f28eec55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae7f2-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "c6bce898-3f47-4542-a9c5-2308f28eec55" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailb130296955053d", "javablobdownloadacfail1blobapitestdownloadacfailb1360986981" ] +} \ 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..753bdd4cd16d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailf8210369e6ad2b?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" : "5013320f-3dc2-49f9-aea0-a0f661cd5566" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7514B3ED\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae81a-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "5013320f-3dc2-49f9-aea0-a0f661cd5566" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailf8210369e6ad2b/javablobdownloadacfail1blobapitestdownloadacfailf823257437b", + "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" : "665563b2-8faa-4c0a-8234-6b9bb3e7794a", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC751B2778\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae843-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "665563b2-8faa-4c0a-8234-6b9bb3e7794a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailf8210369e6ad2b/javablobdownloadacfail1blobapitestdownloadacfailf823257437b", + "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" : "62ea1ce7-76c5-4387-91ca-2ee8188587ad" + }, + "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" : "b92ae855-d01e-009e-77e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ae855-d01e-009e-77e5-644931000000\nTime:2019-09-06T19:00:17.4493717Z", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "62ea1ce7-76c5-4387-91ca-2ee8188587ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "30487175-dd99-4e17-af0d-e774f7eb7e6e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae86c-d01e-009e-0ee5-644931000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailf8210369e6ad2bFri, 06 Sep 2019 19:00:17 GMT\"0x8D732FC7514B3ED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "30487175-dd99-4e17-af0d-e774f7eb7e6e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailf8210369e6ad2b?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" : "014555a2-2e65-4479-96b5-bf8d9b303200" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae88b-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "014555a2-2e65-4479-96b5-bf8d9b303200" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailf8210369e6ad2b", "javablobdownloadacfail1blobapitestdownloadacfailf823257437b" ] +} \ 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..95995d73a96e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb14492672c14e5?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" : "2e42202c-6087-416f-be60-5da74c78ce1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC75338D97\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae8b7-d01e-009e-55e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "2e42202c-6087-416f-be60-5da74c78ce1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb14492672c14e5/javablobdownloadacfail1blobapitestdownloadacfailb141422224e", + "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" : "dc73fb4a-e464-429e-9116-87d78d4b769e", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7539DA4C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae8d8-d01e-009e-74e5-644931000000", + "x-ms-client-request-id" : "dc73fb4a-e464-429e-9116-87d78d4b769e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb14492672c14e5/javablobdownloadacfail1blobapitestdownloadacfailb141422224e", + "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" : "8d649d9f-4fba-434d-af3d-08b206cbf420" + }, + "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" : "b92ae8fc-d01e-009e-15e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92ae8fc-d01e-009e-15e5-644931000000\nTime:2019-09-06T19:00:17.6495510Z", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "8d649d9f-4fba-434d-af3d-08b206cbf420", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "682feaff-5a34-4813-a64c-32b1fc13de42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae914-d01e-009e-2ce5-644931000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailb14492672c14e5Fri, 06 Sep 2019 19:00:17 GMT\"0x8D732FC75338D97\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "682feaff-5a34-4813-a64c-32b1fc13de42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailb14492672c14e5?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" : "cc5fabe1-c799-41dc-bd05-1975de0afec7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae92a-d01e-009e-41e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "cc5fabe1-c799-41dc-bd05-1975de0afec7" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailb14492672c14e5", "javablobdownloadacfail1blobapitestdownloadacfailb141422224e" ] +} \ 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..2b3ab29e9614 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail48370947246aa7?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" : "22a54034-dcd6-48dd-ab3c-52ebcecdc30a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC75655761\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae9ad-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "22a54034-dcd6-48dd-ab3c-52ebcecdc30a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail48370947246aa7/javablobdownloadacfail1blobapitestdownloadacfail48372416ca3", + "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" : "809f7333-c920-4afb-a383-7e91b1a09b4f", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC756C67FB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae9f6-d01e-009e-01e5-644931000000", + "x-ms-client-request-id" : "809f7333-c920-4afb-a383-7e91b1a09b4f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail48370947246aa7/javablobdownloadacfail1blobapitestdownloadacfail48372416ca3", + "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" : "66399bb9-4441-490a-aa24-ab321c9951a5" + }, + "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" : "Fri, 06 Sep 2019 19:00:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC756C67FB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92aea09-d01e-009e-12e5-644931000000", + "x-ms-client-request-id" : "66399bb9-4441-490a-aa24-ab321c9951a5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail48370947246aa7/javablobdownloadacfail1blobapitestdownloadacfail48372416ca3", + "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" : "5de65719-cf42-43fb-a176-cfe9f37499b9" + }, + "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" : "b92aea23-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "5de65719-cf42-43fb-a176-cfe9f37499b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "88a6a4ef-1da3-4ff5-9ad7-9a211e663af7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aea44-d01e-009e-46e5-644931000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfail48370947246aa7Fri, 06 Sep 2019 19:00:17 GMT\"0x8D732FC75655761\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "88a6a4ef-1da3-4ff5-9ad7-9a211e663af7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail48370947246aa7?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" : "752121d3-2f85-421f-8832-0876583b7e73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aea5a-d01e-009e-5ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "752121d3-2f85-421f-8832-0876583b7e73" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfail48370947246aa7", "javablobdownloadacfail1blobapitestdownloadacfail48372416ca3" ] +} \ 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..d342adf19f44 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailfc926355691a06?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" : "6f6aebb6-f101-4974-85fb-0ca7553cbb7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC758CE5A5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aea90-d01e-009e-0de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:17 GMT", + "x-ms-client-request-id" : "6f6aebb6-f101-4974-85fb-0ca7553cbb7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailfc926355691a06/javablobdownloadacfail1blobapitestdownloadacfailfc986441feb", + "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" : "ab55e053-b74f-4758-90dd-c7189af9b8d2", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC759C8428\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aeaee-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "ab55e053-b74f-4758-90dd-c7189af9b8d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailfc926355691a06/javablobdownloadacfail1blobapitestdownloadacfailfc986441feb?comp=lease", + "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" : "608dc38b-7b61-4ccc-839e-ee4bd271011f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC759C8428\"", + "x-ms-lease-id" : "80120355-6988-4f21-bbb8-725a68ea4a91", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aeb03-d01e-009e-78e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "608dc38b-7b61-4ccc-839e-ee4bd271011f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailfc926355691a06/javablobdownloadacfail1blobapitestdownloadacfailfc986441feb", + "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" : "44549851-644d-4e08-b233-4d1b4bd1850f" + }, + "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" : "b92aeb1b-d01e-009e-0fe5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92aeb1b-d01e-009e-0fe5-644931000000\nTime:2019-09-06T19:00:18.3281591Z", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "44549851-644d-4e08-b233-4d1b4bd1850f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e021619-6e94-4963-8495-e67038e77479" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aeb3c-d01e-009e-2de5-644931000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailfc926355691a06Fri, 06 Sep 2019 19:00:18 GMT\"0x8D732FC758CE5A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "3e021619-6e94-4963-8495-e67038e77479", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailfc926355691a06?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" : "3f19554d-9575-4e78-ac2c-48a341f32ddd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aeb5b-d01e-009e-47e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "3f19554d-9575-4e78-ac2c-48a341f32ddd" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailfc926355691a06", "javablobdownloadacfail1blobapitestdownloadacfailfc986441feb" ] +} \ 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..e90fcc55ada1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnull09a460013ec0a?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" : "54eefbe9-fda3-4fed-8d74-5fe0dbb953b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC726E7394\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ad865-d01e-009e-2de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-client-request-id" : "54eefbe9-fda3-4fed-8d74-5fe0dbb953b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnull09a460013ec0a/javablobdownloadallnull1blobapitestdownloadallnull09a569145a", + "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" : "d1d53ef7-46a2-4040-ac0d-3f936971d685", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC729234C3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ad964-d01e-009e-11e5-644931000000", + "x-ms-client-request-id" : "d1d53ef7-46a2-4040-ac0d-3f936971d685" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnull09a460013ec0a/javablobdownloadallnull1blobapitestdownloadallnull09a569145a", + "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" : "43e239a7-59f7-41f6-bc01-4b7c2b58b19b" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:12 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC729234C3\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ad98e-d01e-009e-34e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "43e239a7-59f7-41f6-bc01-4b7c2b58b19b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0f55150d-639f-4321-8162-a07dd414cfa3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ad9b2-d01e-009e-55e5-644931000000", + "Body" : "jtcdownloadallnulljtcdownloadallnull0blobapitestdownloadallnull09a460013ec0aFri, 06 Sep 2019 19:00:12 GMT\"0x8D732FC726E7394\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "0f55150d-639f-4321-8162-a07dd414cfa3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnull09a460013ec0a?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" : "2c858938-9c44-47fe-ab10-07573f68db02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ad9d1-d01e-009e-6fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "2c858938-9c44-47fe-ab10-07573f68db02" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadallnull0blobapitestdownloadallnull09a460013ec0a", "javablobdownloadallnull1blobapitestdownloadallnull09a569145a" ] +} \ 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..02eef42cde2a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json @@ -0,0 +1,142 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfilea045679497b?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" : "ca5ea839-50a5-4fc1-8043-5b49264f58b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC72C50BE1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ada74-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "ca5ea839-50a5-4fc1-8043-5b49264f58b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfilea045679497b/javablobdownloademptyfile1blobapitestdownloademptyfilea0417355", + "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" : "2959d65e-41c9-408d-9080-ba697272bf59", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC72D00FC6\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92adad8-d01e-009e-58e5-644931000000", + "x-ms-client-request-id" : "2959d65e-41c9-408d-9080-ba697272bf59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfilea045679497b/emptyAppendBlob", + "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" : "2f75a31d-ca94-4e61-b98e-db6c406484b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC72DA4B62\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92adb10-d01e-009e-0de5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "2f75a31d-ca94-4e61-b98e-db6c406484b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfilea045679497b/emptyAppendBlob", + "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" : "a755e1a6-9150-4d04-b482-36e4572a29d3" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC72DA4B62\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "b92adb75-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "a755e1a6-9150-4d04-b482-36e4572a29d3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cc25a58c-5eb3-430e-a894-1d15fc98dbdc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92adb99-d01e-009e-07e5-644931000000", + "Body" : "jtcdownloademptyfilejtcdownloademptyfile0blobapitestdownloademptyfilea045679497bFri, 06 Sep 2019 19:00:13 GMT\"0x8D732FC72C50BE1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "cc25a58c-5eb3-430e-a894-1d15fc98dbdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfilea045679497b?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" : "28e03d40-ba84-46a8-a7cd-e98d26a0ba4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92adbb2-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "28e03d40-ba84-46a8-a7cd-e98d26a0ba4a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloademptyfile0blobapitestdownloademptyfilea045679497b", "javablobdownloademptyfile1blobapitestdownloademptyfilea0417355" ] +} \ 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..bead7f3601f3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorf3b04069f5f1144?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" : "a427858d-52e4-4381-b1e6-fdb289b3abda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC75D8A61C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aec4b-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "a427858d-52e4-4381-b1e6-fdb289b3abda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorf3b04069f5f1144/javablobdownloaderror1blobapitestdownloaderrorf3b612593b37", + "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" : "1141c2de-b602-4440-9f5c-35e78064349d", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC75E005D4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aec81-d01e-009e-54e5-644931000000", + "x-ms-client-request-id" : "1141c2de-b602-4440-9f5c-35e78064349d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorf3b04069f5f1144/javablobdownloaderror2blobapitestdownloaderrorf3b266863652", + "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" : "da992451-6954-46e5-9b7a-83b74a8954a2" + }, + "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" : "b92aec9d-d01e-009e-6fe5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92aec9d-d01e-009e-6fe5-644931000000\nTime:2019-09-06T19:00:18.7375286Z", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "da992451-6954-46e5-9b7a-83b74a8954a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18a9089a-5aaf-4656-bb19-d64a2a7bfb02" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aecc4-d01e-009e-12e5-644931000000", + "Body" : "jtcdownloaderrorjtcdownloaderror0blobapitestdownloaderrorf3b04069f5f1144Fri, 06 Sep 2019 19:00:18 GMT\"0x8D732FC75D8A61C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "18a9089a-5aaf-4656-bb19-d64a2a7bfb02", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorf3b04069f5f1144?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" : "9cc4577a-c74b-427c-b7c8-940a3c700ee5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aece2-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "9cc4577a-c74b-427c-b7c8-940a3c700ee5" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloaderror0blobapitestdownloaderrorf3b04069f5f1144", "javablobdownloaderror1blobapitestdownloaderrorf3b612593b37", "javablobdownloaderror2blobapitestdownloaderrorf3b266863652" ] +} \ 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..eced75eadb78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json @@ -0,0 +1,123 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd536d985710ddfa0062?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" : "5c475e38-0402-4488-b5f8-4854cb962045" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC75B9CC5C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aeb8e-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "5c475e38-0402-4488-b5f8-4854cb962045" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd536d985710ddfa0062/javablobdownloadmd51blobapitestdownloadmd536d969190f9f59", + "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" : "bb7eac7f-95fc-4b94-835b-7fd2ad96a187", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC75C04140\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aebb5-d01e-009e-1ae5-644931000000", + "x-ms-client-request-id" : "bb7eac7f-95fc-4b94-835b-7fd2ad96a187" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd536d985710ddfa0062/javablobdownloadmd51blobapitestdownloadmd536d969190f9f59", + "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" : "5c0bf797-98d2-4a97-98db-ec6cc2e05626" + }, + "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" : "Fri, 06 Sep 2019 19:00:18 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "TtlAdjDrEADA9rY4Qt76fQ==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC75C04140\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:18 GMT", + "Content-Length" : "3", + "x-ms-request-id" : "b92aebd5-d01e-009e-39e5-644931000000", + "Body" : "[100, 101, 102]", + "x-ms-client-request-id" : "5c0bf797-98d2-4a97-98db-ec6cc2e05626", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cbe338de-40a4-4c9f-b518-c33d80f7b75e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aebf6-d01e-009e-5ae5-644931000000", + "Body" : "jtcdownloadmd5jtcdownloadmd50blobapitestdownloadmd536d985710ddfa0062Fri, 06 Sep 2019 19:00:18 GMT\"0x8D732FC75B9CC5C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "cbe338de-40a4-4c9f-b518-c33d80f7b75e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd536d985710ddfa0062?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" : "f4dfddb1-63b1-4c25-b4d5-bf9b8dfe8ddb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aec1c-d01e-009e-7ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "f4dfddb1-63b1-4c25-b4d5-bf9b8dfe8ddb" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadmd50blobapitestdownloadmd536d985710ddfa0062", "javablobdownloadmd51blobapitestdownloadmd536d969190f9f59" ] +} \ 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..7b65890a9aa3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin08386368f428a64dd?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" : "eac6bb5c-3828-440e-a4b2-44d5a2baf8c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC733F12C4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92add78-d01e-009e-31e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "eac6bb5c-3828-440e-a4b2-44d5a2baf8c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin08386368f428a64dd/javablobdownloadmin1blobapitestdownloadmin083225305adabb", + "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" : "bcadb1e6-3a34-4200-a242-6f747286793c", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC73466D54\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92addae-d01e-009e-60e5-644931000000", + "x-ms-client-request-id" : "bcadb1e6-3a34-4200-a242-6f747286793c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin08386368f428a64dd/javablobdownloadmin1blobapitestdownloadmin083225305adabb", + "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" : "81852669-9ebb-49c1-bb1f-c0c225eb65e1" + }, + "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" : "Fri, 06 Sep 2019 19:00:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73466D54\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92addd2-d01e-009e-80e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "81852669-9ebb-49c1-bb1f-c0c225eb65e1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b9c35f2a-e9f3-4525-811a-786d62d74a13" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ade00-d01e-009e-27e5-644931000000", + "Body" : "jtcdownloadminjtcdownloadmin0blobapitestdownloadmin08386368f428a64ddFri, 06 Sep 2019 19:00:14 GMT\"0x8D732FC733F12C4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "b9c35f2a-e9f3-4525-811a-786d62d74a13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin08386368f428a64dd?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" : "4ba2fdee-51db-475d-9200-5e08f454b723" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ade19-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "4ba2fdee-51db-475d-9200-5e08f454b723" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadmin0blobapitestdownloadmin08386368f428a64dd", "javablobdownloadmin1blobapitestdownloadmin083225305adabb" ] +} \ 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..6f17c1a34b20 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange0bc70873d7e8d4e?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" : "fa434e9e-61bf-437d-94b9-d9c1d9a0f250" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC735FE8C2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ade46-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "fa434e9e-61bf-437d-94b9-d9c1d9a0f250" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange0bc70873d7e8d4e/javablobdownloadrange1blobapitestdownloadrange0bc27014c24d", + "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" : "75e2017d-b1ed-4e36-8af4-ceff77407f6d", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC736A789F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ade7c-d01e-009e-19e5-644931000000", + "x-ms-client-request-id" : "75e2017d-b1ed-4e36-8af4-ceff77407f6d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange0bc70873d7e8d4e/javablobdownloadrange1blobapitestdownloadrange0bc27014c24d", + "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" : "a66e5c87-f3d6-4b8c-9459-02260bed127e" + }, + "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" : "Fri, 06 Sep 2019 19:00:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC736A789F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92ade9f-d01e-009e-39e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "a66e5c87-f3d6-4b8c-9459-02260bed127e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a71126f8-d990-4e08-8797-dd89a7723414" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92adf3b-d01e-009e-3de5-644931000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange0bc70873d7e8d4eFri, 06 Sep 2019 19:00:14 GMT\"0x8D732FC735FE8C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "a71126f8-d990-4e08-8797-dd89a7723414", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange0bc70873d7e8d4e?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" : "b6c281f9-bd3a-4df3-a43e-437cf49b7e4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92adf5a-d01e-009e-5ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "b6c281f9-bd3a-4df3-a43e-437cf49b7e4b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange0bc70873d7e8d4e", "javablobdownloadrange1blobapitestdownloadrange0bc27014c24d" ] +} \ 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..d8b459a5008b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrangec231245736b689a?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" : "56e8d672-82b6-4931-bbfd-92df71702144" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC739535C8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92adf85-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "56e8d672-82b6-4931-bbfd-92df71702144" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrangec231245736b689a/javablobdownloadrange1blobapitestdownloadrangec2358585b8b4", + "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" : "fde11bca-07a4-4cd5-9334-2804d512205e", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC739BA66D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92adfab-d01e-009e-27e5-644931000000", + "x-ms-client-request-id" : "fde11bca-07a4-4cd5-9334-2804d512205e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrangec231245736b689a/javablobdownloadrange1blobapitestdownloadrangec2358585b8b4", + "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" : "db93c1db-69ce-4035-af9f-87c214edc435" + }, + "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" : "Fri, 06 Sep 2019 19:00:14 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC739BA66D\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "b92adfd7-d01e-009e-4fe5-644931000000", + "Body" : "[100, 101, 102, 97, 117]", + "x-ms-client-request-id" : "db93c1db-69ce-4035-af9f-87c214edc435", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3ed7487c-2c98-4c73-af3a-9aeab8efef15" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92adffa-d01e-009e-6ee5-644931000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrangec231245736b689aFri, 06 Sep 2019 19:00:14 GMT\"0x8D732FC739535C8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "3ed7487c-2c98-4c73-af3a-9aeab8efef15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrangec231245736b689a?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" : "c33eb655-ca22-4a2a-9044-350c867767ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae021-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "c33eb655-ca22-4a2a-9044-350c867767ce" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrangec231245736b689a", "javablobdownloadrange1blobapitestdownloadrangec2358585b8b4" ] +} \ 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..27250bcd939d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadranged3936106c7e29c3?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" : "9132e9bf-44e0-4259-b38b-1f2f2e9ef745" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC73B52128\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92ae045-d01e-009e-30e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "9132e9bf-44e0-4259-b38b-1f2f2e9ef745" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadranged3936106c7e29c3/javablobdownloadrange1blobapitestdownloadranged3947343aaff", + "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" : "cd017272-ab63-450d-9522-1b93023fe36e", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC73BC075E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92ae076-d01e-009e-5ae5-644931000000", + "x-ms-client-request-id" : "cd017272-ab63-450d-9522-1b93023fe36e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadranged3936106c7e29c3/javablobdownloadrange1blobapitestdownloadranged3947343aaff", + "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" : "cfb448bb-1eda-4cd0-a641-257eaf4cc71f" + }, + "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" : "Fri, 06 Sep 2019 19:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73BC075E\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:15 GMT", + "Content-Length" : "2", + "x-ms-request-id" : "b92ae0a4-d01e-009e-7ee5-644931000000", + "Body" : "[97, 117]", + "x-ms-client-request-id" : "cfb448bb-1eda-4cd0-a641-257eaf4cc71f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f33cc38c-5c1d-415f-8eb9-67230f7a00b1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92ae0cb-d01e-009e-23e5-644931000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadranged3936106c7e29c3Fri, 06 Sep 2019 19:00:15 GMT\"0x8D732FC73B52128\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "f33cc38c-5c1d-415f-8eb9-67230f7a00b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadranged3936106c7e29c3?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" : "4623f0ee-0a8c-407b-a1e6-da8fbc27137e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92ae0d9-d01e-009e-2fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:15 GMT", + "x-ms-client-request-id" : "4623f0ee-0a8c-407b-a1e6-da8fbc27137e" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadranged3936106c7e29c3", "javablobdownloadrange1blobapitestdownloadranged3947343aaff" ] +} \ 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..f769ae67dec5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json @@ -0,0 +1,199 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2?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" : "d913e215-8b94-46a9-bd6f-8ad81a041c28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC76045412\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aed08-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "d913e215-8b94-46a9-bd6f-8ad81a041c28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2/javablobdownloadsnapshot1blobapitestdownloadsnapshot0d319925b", + "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" : "5d891ef6-8b78-4097-84aa-a5eb1df5a02c", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC760FD3D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aed72-d01e-009e-2ee5-644931000000", + "x-ms-client-request-id" : "5d891ef6-8b78-4097-84aa-a5eb1df5a02c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2/javablobdownloadsnapshot1blobapitestdownloadsnapshot0d319925b", + "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" : "04dced92-ab5c-412a-ad0e-1e3f56b8815f" + }, + "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" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC760FD3D3\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92aed9c-d01e-009e-57e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "04dced92-ab5c-412a-ad0e-1e3f56b8815f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2/javablobdownloadsnapshot1blobapitestdownloadsnapshot0d319925b?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", + "x-ms-client-request-id" : "afdaa9d6-20ba-4957-80f7-206360b92623" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:00:19.1021524Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC760FD3D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aedc1-d01e-009e-78e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "afdaa9d6-20ba-4957-80f7-206360b92623" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2/javablobdownloadsnapshot1blobapitestdownloadsnapshot0d319925b", + "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" : "70ec9995-b429-4e23-8adb-df22460f8a9c", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "Content-MD5" : "kC+90rHfDE9wtKXSNSXpMg==", + "ETag" : "\"0x8D732FC7624E779\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aedf5-d01e-009e-25e5-644931000000", + "x-ms-client-request-id" : "70ec9995-b429-4e23-8adb-df22460f8a9c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2/javablobdownloadsnapshot1blobapitestdownloadsnapshot0d319925b?snapshot=2019-09-06T19%3a00%3a19.1021524Z", + "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" : "a9a70730-38de-424a-8880-a987b97c897a" + }, + "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, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-09-06T19:00:19.1021524Z", + "ETag" : "\"0x8D732FC760FD3D3\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92aee15-d01e-009e-40e5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "a9a70730-38de-424a-8880-a987b97c897a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d7c69195-d560-4bf4-a7ab-8a2491a0f496" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aee40-d01e-009e-68e5-644931000000", + "Body" : "jtcdownloadsnapshotjtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2Fri, 06 Sep 2019 19:00:18 GMT\"0x8D732FC76045412\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:18 GMT", + "x-ms-client-request-id" : "d7c69195-d560-4bf4-a7ab-8a2491a0f496", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2?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" : "6b79b36b-9558-4efd-867a-24c655ce668c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aee64-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "6b79b36b-9558-4efd-867a-24c655ce668c" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadsnapshot0blobapitestdownloadsnapshot0d37962645c2", "javablobdownloadsnapshot1blobapitestdownloadsnapshot0d319925b" ] +} \ 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..01dace1beaaa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist087310f12748f5b72641?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" : "f14cdfa3-5f07-416c-beac-386f146b4c48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC765AEC71\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aef6c-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "f14cdfa3-5f07-416c-beac-386f146b4c48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist087310f12748f5b72641/javablobdownloadtofiledoesnotexist12291296aa2803746", + "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" : "3c40e5b8-ce90-4439-9e24-23e37a368e72", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC76611473\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aef96-d01e-009e-13e5-644931000000", + "x-ms-client-request-id" : "3c40e5b8-ce90-4439-9e24-23e37a368e72" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist087310f12748f5b72641/javablobdownloadtofiledoesnotexist12291296aa2803746", + "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" : "f23f68aa-9924-4968-b958-868f32d6bc09" + }, + "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" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC76611473\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92aefcd-d01e-009e-47e5-644931000000", + "x-ms-client-request-id" : "f23f68aa-9924-4968-b958-868f32d6bc09", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist087310f12748f5b72641/javablobdownloadtofiledoesnotexist12291296aa2803746", + "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" : "81aff30f-5f6e-42d5-a68b-a55811f1ba4f" + }, + "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" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC76611473\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92aeffe-d01e-009e-6fe5-644931000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "81aff30f-5f6e-42d5-a68b-a55811f1ba4f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "97f43fee-467c-4ec7-91a8-494c91f95a98" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af028-d01e-009e-14e5-644931000000", + "Body" : "jtcdownloadtofiledoesnotexistjtcdownloadtofiledoesnotexist087310f12748f5b72641Fri, 06 Sep 2019 19:00:19 GMT\"0x8D732FC765AEC71\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "97f43fee-467c-4ec7-91a8-494c91f95a98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist087310f12748f5b72641?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" : "cc4e4398-f2ff-4fc7-92f6-a8b1356bd15a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af041-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "cc4e4398-f2ff-4fc7-92f6-a8b1356bd15a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadtofiledoesnotexist087310f12748f5b72641", "javablobdownloadtofiledoesnotexist12291296aa2803746" ] +} \ 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..6538e94a6fcb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists001378d12204491b834bc5b?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" : "911cab61-b621-4937-9de6-d97d1cdc6a40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC763BC487\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aee90-d01e-009e-31e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "911cab61-b621-4937-9de6-d97d1cdc6a40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists001378d12204491b834bc5b/javablobdownloadtofileexists152893fa0915d19af54b", + "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" : "995c99a0-69b9-4b84-849b-5990bbf3fa41", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC76423A7B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aeeb3-d01e-009e-4fe5-644931000000", + "x-ms-client-request-id" : "995c99a0-69b9-4b84-849b-5990bbf3fa41" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1b8ce680-506a-4f40-b3d7-5bb8cabfcd87" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92aef12-d01e-009e-1fe5-644931000000", + "Body" : "jtcdownloadtofileexistsjtcdownloadtofileexists001378d12204491b834bc5bFri, 06 Sep 2019 19:00:19 GMT\"0x8D732FC763BC487\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "1b8ce680-506a-4f40-b3d7-5bb8cabfcd87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists001378d12204491b834bc5b?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" : "a22b257c-45dc-4f08-9365-db8d48bbb166" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aef38-d01e-009e-40e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "a22b257c-45dc-4f08-9365-db8d48bbb166" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadtofileexists001378d12204491b834bc5b", "javablobdownloadtofileexists152893fa0915d19af54b" ] +} \ 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..f9518c26f94e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json @@ -0,0 +1,250 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018?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" : "ca61a11c-6d8f-4cdb-a71a-dc53330eb78b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC730074C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92adbdc-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "ca61a11c-6d8f-4cdb-a71a-dc53330eb78b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018/javablobdownloadwithretryrange151146f84e326ed4224", + "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" : "148f9655-5b5f-42fe-b43a-cdd9926c743f", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC73075987\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92adc02-d01e-009e-61e5-644931000000", + "x-ms-client-request-id" : "148f9655-5b5f-42fe-b43a-cdd9926c743f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018/javablobdownloadwithretryrange151146f84e326ed4224", + "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" : "d32e5c74-692e-4c22-a57f-645fe378b525" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73075987\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "b92adc55-d01e-009e-2de5-644931000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d32e5c74-692e-4c22-a57f-645fe378b525", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018/javablobdownloadwithretryrange151146f84e326ed4224", + "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" : "1b3fc762-4ccd-44a8-a326-c9d5cbd182f6" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73075987\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "b92adc9f-d01e-009e-6be5-644931000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "1b3fc762-4ccd-44a8-a326-c9d5cbd182f6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018/javablobdownloadwithretryrange151146f84e326ed4224", + "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" : "8babda96-45ad-4811-a151-2391cfb2d522" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73075987\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "b92adcc2-d01e-009e-0ce5-644931000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "8babda96-45ad-4811-a151-2391cfb2d522", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018/javablobdownloadwithretryrange151146f84e326ed4224", + "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" : "8f437b31-ebe6-452b-bf36-0cab586abee4" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73075987\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "b92adcdc-d01e-009e-25e5-644931000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "8f437b31-ebe6-452b-bf36-0cab586abee4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018/javablobdownloadwithretryrange151146f84e326ed4224", + "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" : "1510e114-6865-419b-895b-5e2865df8bae" + }, + "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" : "Fri, 06 Sep 2019 19:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FC73075987\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:13 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "b92add06-d01e-009e-47e5-644931000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "1510e114-6865-419b-895b-5e2865df8bae", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a4af3bec-5573-464c-8358-e5e939d65b8e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92add31-d01e-009e-71e5-644931000000", + "Body" : "jtcdownloadwithretryrangejtcdownloadwithretryrange0532763663259d04b54018Fri, 06 Sep 2019 19:00:13 GMT\"0x8D732FC730074C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:13 GMT", + "x-ms-client-request-id" : "a4af3bec-5573-464c-8358-e5e939d65b8e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange0532763663259d04b54018?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" : "960e9210-332a-4f73-804e-1552d3d55112" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92add46-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:14 GMT", + "x-ms-client-request-id" : "960e9210-332a-4f73-804e-1552d3d55112" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadwithretryrange0532763663259d04b54018", "javablobdownloadwithretryrange151146f84e326ed4224" ] +} \ 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..81cfbee60360 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfod76826539f8b1d?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" : "97062860-82a3-42d0-8417-d89c8c2bb759" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE5B0EA2A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e045b-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "97062860-82a3-42d0-8417-d89c8c2bb759" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfod76826539f8b1d/javablobgetaccountinfo1blobapitestgetaccountinfod7691666030", + "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" : "3103c38f-e05d-4206-b3fd-dec6e3e9d9fb", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE5B82CA1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0490-d01e-009e-32e5-644931000000", + "x-ms-client-request-id" : "3103c38f-e05d-4206-b3fd-dec6e3e9d9fb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c81a4e5d-a06b-480c-8af8-0cef85c5aa6e" + }, + "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" : "b92e04bb-d01e-009e-59e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "c81a4e5d-a06b-480c-8af8-0cef85c5aa6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a1201bbb-4228-45a2-bc4e-84568c1e4398" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e051d-d01e-009e-35e5-644931000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0blobapitestgetaccountinfod76826539f8b1dFri, 06 Sep 2019 19:03:26 GMT\"0x8D732FCE5B0EA2A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "a1201bbb-4228-45a2-bc4e-84568c1e4398", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfod76826539f8b1d?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" : "de391052-f21c-4f58-9124-e468bfab3c84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e0558-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "de391052-f21c-4f58-9124-e468bfab3c84" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0blobapitestgetaccountinfod76826539f8b1d", "javablobgetaccountinfo1blobapitestgetaccountinfod7691666030" ] +} \ 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..f479ea7edefd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerror11f287276?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" : "03e10cb1-684f-4670-98fd-7e2e1f9144d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE6090989\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e071b-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "03e10cb1-684f-4670-98fd-7e2e1f9144d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerror11f287276/javablobgetaccountinfoerror1760576212c77d43ea4ed", + "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" : "6bafea7b-5e8b-4e32-8295-2d430d5da7ab", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE6109ACF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0754-d01e-009e-36e5-644931000000", + "x-ms-client-request-id" : "6bafea7b-5e8b-4e32-8295-2d430d5da7ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror2blobapitestgetaccountinfoerror11f301243/javablobgetaccountinfoerror38109890164856e0814c7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7666a91b-e19e-4c9b-b2da-06a954bda96b" + }, + "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" : "b92e078d-d01e-009e-67e5-644931000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b92e078d-d01e-009e-67e5-644931000000\nTime:2019-09-06T19:03:26.9604666Z", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "7666a91b-e19e-4c9b-b2da-06a954bda96b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e20cb1ec-da79-4728-9b63-7a375d21e870" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e07b1-d01e-009e-09e5-644931000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror0blobapitestgetaccountinfoerror11f287276Fri, 06 Sep 2019 19:03:26 GMT\"0x8D732FCE6090989\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "e20cb1ec-da79-4728-9b63-7a375d21e870", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerror11f287276?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" : "ebc17264-fac6-481c-bc38-9a013fd61888" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e07df-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "ebc17264-fac6-481c-bc38-9a013fd61888" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror0blobapitestgetaccountinfoerror11f287276", "javablobgetaccountinfoerror1760576212c77d43ea4ed", "jtcgetaccountinfoerror2blobapitestgetaccountinfoerror11f301243", "javablobgetaccountinfoerror38109890164856e0814c7" ] +} \ 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..3bd207d065f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin39c47149f4b?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" : "7c2921fb-48af-4000-8d5f-1b6fe514ee66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE5DDA9C5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e058d-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "7c2921fb-48af-4000-8d5f-1b6fe514ee66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin39c47149f4b/javablobgetaccountinfomin1blobapitestgetaccountinfomin39c83666", + "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" : "584c1878-0962-4cdb-ada7-10817e1fc08f", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE5EC8F84\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0655-d01e-009e-4ce5-644931000000", + "x-ms-client-request-id" : "584c1878-0962-4cdb-ada7-10817e1fc08f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin39c47149f4b/javablobgetaccountinfomin1blobapitestgetaccountinfomin39c83666?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "77d00009-f81a-4e57-9735-8e070bd199cc" + }, + "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" : "b92e068c-d01e-009e-03e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "77d00009-f81a-4e57-9735-8e070bd199cc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b8fe40ed-5d5b-4c85-82aa-487b6fbc0ec7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e06cc-d01e-009e-39e5-644931000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0blobapitestgetaccountinfomin39c47149f4bFri, 06 Sep 2019 19:03:26 GMT\"0x8D732FCE5DDA9C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "b8fe40ed-5d5b-4c85-82aa-487b6fbc0ec7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin39c47149f4b?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" : "cc994a0d-6632-4644-bd24-bc309895db84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e06ea-d01e-009e-54e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "cc994a0d-6632-4644-bd24-bc309895db84" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0blobapitestgetaccountinfomin39c47149f4b", "javablobgetaccountinfomin1blobapitestgetaccountinfomin39c83666" ] +} \ 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..94ba7d7155c1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac1eb02443cd32f?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" : "ed3b9df4-5af1-473e-88d5-dfde31960286" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC76DB8491\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af273-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "ed3b9df4-5af1-473e-88d5-dfde31960286" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac1eb02443cd32f/javablobgetpropertiesac1blobapitestgetpropertiesac1eb17290a5", + "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" : "f82c64b8-ae4d-465e-bb8b-38ea25709622", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC76E29835\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af2a4-d01e-009e-58e5-644931000000", + "x-ms-client-request-id" : "f82c64b8-ae4d-465e-bb8b-38ea25709622" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac1eb02443cd32f/javablobgetpropertiesac1blobapitestgetpropertiesac1eb17290a5", + "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" : "b3839a76-aa59-436a-8fe6-b27a39ec9337" + }, + "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" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:20 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" : "\"0x8D732FC76E29835\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af2e5-d01e-009e-12e5-644931000000", + "x-ms-client-request-id" : "b3839a76-aa59-436a-8fe6-b27a39ec9337", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "53671a13-356d-4390-b489-ebaca42857f4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af307-d01e-009e-31e5-644931000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac1eb02443cd32fFri, 06 Sep 2019 19:00:20 GMT\"0x8D732FC76DB8491\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "53671a13-356d-4390-b489-ebaca42857f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac1eb02443cd32f?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" : "809dc0a2-4ba2-4098-8ffd-bd0c349a5a9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af322-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "809dc0a2-4ba2-4098-8ffd-bd0c349a5a9e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac1eb02443cd32f", "javablobgetpropertiesac1blobapitestgetpropertiesac1eb17290a5" ] +} \ 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..f4c603b489f6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac61b68561ad41d?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" : "2ac21591-8da7-4604-a8ae-4bed1311cfab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC76FBE539\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af360-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "2ac21591-8da7-4604-a8ae-4bed1311cfab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac61b68561ad41d/javablobgetpropertiesac1blobapitestgetpropertiesac61b52168ba", + "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" : "50ea8469-dcbd-43b2-b77f-6a061248d5fc", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7701E789\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af37f-d01e-009e-21e5-644931000000", + "x-ms-client-request-id" : "50ea8469-dcbd-43b2-b77f-6a061248d5fc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac61b68561ad41d/javablobgetpropertiesac1blobapitestgetpropertiesac61b52168ba", + "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" : "dba9863a-6905-4800-aada-c495eb5c5cd3" + }, + "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" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:20 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" : "\"0x8D732FC7701E789\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af3a0-d01e-009e-41e5-644931000000", + "x-ms-client-request-id" : "dba9863a-6905-4800-aada-c495eb5c5cd3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "23899a30-5614-4e25-a14d-5358b49a478b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af3c1-d01e-009e-5ee5-644931000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac61b68561ad41dFri, 06 Sep 2019 19:00:20 GMT\"0x8D732FC76FBE539\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "23899a30-5614-4e25-a14d-5358b49a478b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac61b68561ad41d?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" : "a13e77ef-3104-4ac0-a40b-36b8c7f027cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af3e0-d01e-009e-7ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "a13e77ef-3104-4ac0-a40b-36b8c7f027cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac61b68561ad41d", "javablobgetpropertiesac1blobapitestgetpropertiesac61b52168ba" ] +} \ 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..1e7b7cedf1e9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac9fe7178858d04?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" : "1ae421cd-a87b-4a47-ab01-7fda7dcd7bc2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7718E9BB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af400-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "1ae421cd-a87b-4a47-ab01-7fda7dcd7bc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac9fe7178858d04/javablobgetpropertiesac1blobapitestgetpropertiesac9fe612474f", + "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" : "1810eef4-e904-4555-9c40-379f6f4a2622", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC77209A53\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af42b-d01e-009e-40e5-644931000000", + "x-ms-client-request-id" : "1810eef4-e904-4555-9c40-379f6f4a2622" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac9fe7178858d04/javablobgetpropertiesac1blobapitestgetpropertiesac9fe612474f", + "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" : "fdfcaf5a-3f70-4276-a9f4-f193f32a447a" + }, + "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" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:20 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" : "\"0x8D732FC77209A53\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af455-d01e-009e-6ae5-644931000000", + "x-ms-client-request-id" : "fdfcaf5a-3f70-4276-a9f4-f193f32a447a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3a87cf91-fb3c-4053-99df-e01c70b23c60" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af47d-d01e-009e-0be5-644931000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac9fe7178858d04Fri, 06 Sep 2019 19:00:20 GMT\"0x8D732FC7718E9BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "3a87cf91-fb3c-4053-99df-e01c70b23c60", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac9fe7178858d04?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" : "7a054f19-4b01-47ec-8b00-27a0c2b598a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af49d-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "7a054f19-4b01-47ec-8b00-27a0c2b598a5" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac9fe7178858d04", "javablobgetpropertiesac1blobapitestgetpropertiesac9fe612474f" ] +} \ 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..48dbf1314ed3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95b?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" : "b9d135af-e4a6-4a78-847b-75feebf11223" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC773EF10F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af4d3-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "b9d135af-e4a6-4a78-847b-75feebf11223" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95b/javablobgetpropertiesac1blobapitestgetpropertiesac3e68696275", + "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" : "ca4f495a-46bd-4171-bee7-3bac6e40c0be", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7752648B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af55d-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "ca4f495a-46bd-4171-bee7-3bac6e40c0be" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95b/javablobgetpropertiesac1blobapitestgetpropertiesac3e68696275", + "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" : "4c3768e5-c785-4664-a267-70ff0b6619ea" + }, + "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" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:20 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" : "\"0x8D732FC7752648B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af58b-d01e-009e-05e5-644931000000", + "x-ms-client-request-id" : "4c3768e5-c785-4664-a267-70ff0b6619ea", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95b/javablobgetpropertiesac1blobapitestgetpropertiesac3e68696275", + "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" : "e04fc2da-69a7-422e-bf94-dd761b8fe829" + }, + "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" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:20 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" : "\"0x8D732FC7752648B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af5b2-d01e-009e-29e5-644931000000", + "x-ms-client-request-id" : "e04fc2da-69a7-422e-bf94-dd761b8fe829", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "50ec1b6e-5150-4a9c-a6e8-971f2f833929" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af5e3-d01e-009e-56e5-644931000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95bFri, 06 Sep 2019 19:00:20 GMT\"0x8D732FC773EF10F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "50ec1b6e-5150-4a9c-a6e8-971f2f833929", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95b?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" : "66f9c6c9-462f-49fb-88d8-651d6c780efa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af60d-d01e-009e-79e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "66f9c6c9-462f-49fb-88d8-651d6c780efa" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac3e629056ff95b", "javablobgetpropertiesac1blobapitestgetpropertiesac3e68696275" ] +} \ 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..eb8fcac0f022 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac2159373607fcf?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" : "7ad3c269-3fc6-4e28-9de9-bcff438b2f66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC77713020\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af63c-d01e-009e-26e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "7ad3c269-3fc6-4e28-9de9-bcff438b2f66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac2159373607fcf/javablobgetpropertiesac1blobapitestgetpropertiesac215687095e", + "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" : "214278ef-c50f-4c72-a508-4fea7d244c07", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7777CFBC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af660-d01e-009e-45e5-644931000000", + "x-ms-client-request-id" : "214278ef-c50f-4c72-a508-4fea7d244c07" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac2159373607fcf/javablobgetpropertiesac1blobapitestgetpropertiesac215687095e", + "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" : "79cee2d4-aebb-4e32-af52-b0d08cb3e7e3" + }, + "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" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:21 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" : "\"0x8D732FC7777CFBC\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af6a4-d01e-009e-03e5-644931000000", + "x-ms-client-request-id" : "79cee2d4-aebb-4e32-af52-b0d08cb3e7e3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8eef2024-238d-4ed9-95e5-c31ba078581f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af6c3-d01e-009e-21e5-644931000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac2159373607fcfFri, 06 Sep 2019 19:00:21 GMT\"0x8D732FC77713020\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "8eef2024-238d-4ed9-95e5-c31ba078581f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac2159373607fcf?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" : "25270611-f7a9-43ef-ad71-7a71ce389505" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af6f1-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "25270611-f7a9-43ef-ad71-7a71ce389505" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac2159373607fcf", "javablobgetpropertiesac1blobapitestgetpropertiesac215687095e" ] +} \ 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..1eef3692086f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622?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" : "6af1a329-d612-48ec-a4c0-a3d3985a0f4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC77975E92\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af714-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "6af1a329-d612-48ec-a4c0-a3d3985a0f4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622/javablobgetpropertiesac1blobapitestgetpropertiesac4f00881245", + "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" : "ae4f7aab-c59f-4c9a-b1a0-f250ec0df589", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC779DB031\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af751-d01e-009e-20e5-644931000000", + "x-ms-client-request-id" : "ae4f7aab-c59f-4c9a-b1a0-f250ec0df589" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622/javablobgetpropertiesac1blobapitestgetpropertiesac4f00881245?comp=lease", + "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" : "0923719a-3d32-4bee-871a-01674bec6d33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC779DB031\"", + "x-ms-lease-id" : "65c80e2f-aef3-4ac4-93a6-0638eb8af049", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af77b-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "0923719a-3d32-4bee-871a-01674bec6d33" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622/javablobgetpropertiesac1blobapitestgetpropertiesac4f00881245", + "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" : "6373220c-fd7d-40a5-96f8-f7f5ecfb2e9d" + }, + "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" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:21 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" : "\"0x8D732FC779DB031\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "b92af7b3-d01e-009e-7ae5-644931000000", + "x-ms-client-request-id" : "6373220c-fd7d-40a5-96f8-f7f5ecfb2e9d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2eadf5a6-e33d-4de8-ad72-b636b45d7b87" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af7cc-d01e-009e-10e5-644931000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622Fri, 06 Sep 2019 19:00:21 GMT\"0x8D732FC77975E92\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "2eadf5a6-e33d-4de8-ad72-b636b45d7b87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622?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" : "5fd606c5-5c04-4c0b-a0ec-e9af76fb60cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af7e6-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "5fd606c5-5c04-4c0b-a0ec-e9af76fb60cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac4f07356398622", "javablobgetpropertiesac1blobapitestgetpropertiesac4f00881245" ] +} \ 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..0344ebbee10d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail1dc219182?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" : "721be52a-1b38-4273-9ed2-88229d5ce5eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC77BF6234\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af817-d01e-009e-57e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "721be52a-1b38-4273-9ed2-88229d5ce5eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail1dc219182/javablobgetpropertiesacfail12487138be8d33d62647d", + "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" : "939a1131-1ff6-4645-a0a4-565d21d3802c", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC77C60245\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af836-d01e-009e-73e5-644931000000", + "x-ms-client-request-id" : "939a1131-1ff6-4645-a0a4-565d21d3802c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail1dc219182/javablobgetpropertiesacfail12487138be8d33d62647d", + "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" : "0aa4065f-1fa2-45a9-8b75-5769dc77f0ff" + }, + "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" : "b92af858-d01e-009e-12e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "0aa4065f-1fa2-45a9-8b75-5769dc77f0ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "68dde822-4929-44c9-b8af-774f9c88be3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af886-d01e-009e-3ce5-644931000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail1dc219182Fri, 06 Sep 2019 19:00:21 GMT\"0x8D732FC77BF6234\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "68dde822-4929-44c9-b8af-774f9c88be3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail1dc219182?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" : "856895f6-ade7-42be-b4b1-cfb1c6bcf22e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af8a1-d01e-009e-55e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "856895f6-ade7-42be-b4b1-cfb1c6bcf22e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail1dc219182", "javablobgetpropertiesacfail12487138be8d33d62647d" ] +} \ 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..34b50b448ef6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile93086522?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" : "b6726f01-8830-4369-8720-7b96a2cd5c8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC77E4CD2B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af8c7-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "b6726f01-8830-4369-8720-7b96a2cd5c8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile93086522/javablobgetpropertiesacfail120977cfc68b929be040c", + "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" : "be15ec3b-9e8c-47e1-a233-75b5e435d483", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC77EC09DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af93a-d01e-009e-63e5-644931000000", + "x-ms-client-request-id" : "be15ec3b-9e8c-47e1-a233-75b5e435d483" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile93086522/javablobgetpropertiesacfail120977cfc68b929be040c", + "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" : "ac5df324-76e1-4f1d-b33d-c6520100e720" + }, + "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" : "b92af964-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "ac5df324-76e1-4f1d-b33d-c6520100e720" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5bd9dab1-1579-41a9-a16d-08481fc6f90c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af98a-d01e-009e-25e5-644931000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfaile93086522Fri, 06 Sep 2019 19:00:22 GMT\"0x8D732FC77E4CD2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:21 GMT", + "x-ms-client-request-id" : "5bd9dab1-1579-41a9-a16d-08481fc6f90c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile93086522?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" : "392b2a72-fc0a-4271-afda-b986a2c7f287" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af9c4-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "392b2a72-fc0a-4271-afda-b986a2c7f287" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile93086522", "javablobgetpropertiesacfail120977cfc68b929be040c" ] +} \ 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..3a8fb7e63c3e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile3195828b?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" : "f620a19e-befe-4620-84be-c4108b75e4c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7809749A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92afa27-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "f620a19e-befe-4620-84be-c4108b75e4c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile3195828b/javablobgetpropertiesacfail12548362e20134626b434", + "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" : "9ff13645-9780-4113-8e7f-65fb462c9904", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7810B198\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92afa5e-d01e-009e-39e5-644931000000", + "x-ms-client-request-id" : "9ff13645-9780-4113-8e7f-65fb462c9904" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile3195828b/javablobgetpropertiesacfail12548362e20134626b434", + "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" : "f6ea7531-3907-4aec-8f32-7d3fdbffddfa" + }, + "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" : "b92afa8a-d01e-009e-5fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "f6ea7531-3907-4aec-8f32-7d3fdbffddfa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18440da2-25e4-4303-8737-217a638ef1e9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92afaac-d01e-009e-7de5-644931000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfaile3195828bFri, 06 Sep 2019 19:00:22 GMT\"0x8D732FC7809749A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "18440da2-25e4-4303-8737-217a638ef1e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile3195828b?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" : "2589ccaa-4178-4932-a12a-2d76b7092533" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92afae6-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "2589ccaa-4178-4932-a12a-2d76b7092533" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfaile3195828b", "javablobgetpropertiesacfail12548362e20134626b434" ] +} \ 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..af49255c7209 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766e?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" : "bcadb82c-d66e-485d-be3e-d6f88c32045c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC782B5C40\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92afb1d-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "bcadb82c-d66e-485d-be3e-d6f88c32045c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766e/javablobgetpropertiesacfail1627798e671dcd84c24fc", + "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" : "ddcf9cc6-7bac-4197-8ce3-8c7895f1c8b6", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7832E7B4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92afb5c-d01e-009e-02e5-644931000000", + "x-ms-client-request-id" : "ddcf9cc6-7bac-4197-8ce3-8c7895f1c8b6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766e/javablobgetpropertiesacfail1627798e671dcd84c24fc", + "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" : "5b46f55b-3cee-406e-87c4-afe2ce881af4" + }, + "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" : "Fri, 06 Sep 2019 19:00:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7832E7B4\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92afb9b-d01e-009e-38e5-644931000000", + "x-ms-client-request-id" : "5b46f55b-3cee-406e-87c4-afe2ce881af4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766e/javablobgetpropertiesacfail1627798e671dcd84c24fc", + "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" : "b45457d1-e33f-4da6-9ee7-fd0f38c1c14e" + }, + "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" : "b92afbc2-d01e-009e-59e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "b45457d1-e33f-4da6-9ee7-fd0f38c1c14e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "706caf03-9c54-46ca-abf4-3c35cb54f365" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92afbeb-d01e-009e-7be5-644931000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766eFri, 06 Sep 2019 19:00:22 GMT\"0x8D732FC782B5C40\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "706caf03-9c54-46ca-abf4-3c35cb54f365", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766e?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" : "52a3bad1-a4cc-4237-a628-8e57243d6e5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92afc14-d01e-009e-1fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "52a3bad1-a4cc-4237-a628-8e57243d6e5f" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail5c796766e", "javablobgetpropertiesacfail1627798e671dcd84c24fc" ] +} \ 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..5a6903574c92 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514?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" : "d6e6e47e-db26-4666-878b-44eb3bc35519" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC785338B6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92afc40-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "d6e6e47e-db26-4666-878b-44eb3bc35519" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514/javablobgetpropertiesacfail1497638e5847efdd5f458", + "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" : "8fb5b45f-e9fb-420d-9ae8-212c67e0993b", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC785B12AB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92afc81-d01e-009e-77e5-644931000000", + "x-ms-client-request-id" : "8fb5b45f-e9fb-420d-9ae8-212c67e0993b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514/javablobgetpropertiesacfail1497638e5847efdd5f458?comp=lease", + "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" : "9f0f0e0b-1610-4bb7-b12b-67bf587afaaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC785B12AB\"", + "x-ms-lease-id" : "397bdef9-1eb9-4e44-b6e4-99af953d0c77", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92afca1-d01e-009e-12e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "9f0f0e0b-1610-4bb7-b12b-67bf587afaaf" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514/javablobgetpropertiesacfail1497638e5847efdd5f458", + "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" : "e9186729-878c-43b6-89f9-336ef4248874" + }, + "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" : "b92afcd4-d01e-009e-3ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "e9186729-878c-43b6-89f9-336ef4248874" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "08da330f-4dc5-483e-998d-cda5cbe6322a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92afd09-d01e-009e-69e5-644931000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514Fri, 06 Sep 2019 19:00:22 GMT\"0x8D732FC785338B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "08da330f-4dc5-483e-998d-cda5cbe6322a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514?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" : "c59caf48-50bc-4fcf-abf9-ea209c1ad863" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92afd23-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "c59caf48-50bc-4fcf-abf9-ea209c1ad863" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail237121514", "javablobgetpropertiesacfail1497638e5847efdd5f458" ] +} \ 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..74ced49961ac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault00431654cebca43bd2434eb?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" : "94f4e9a8-22f0-4ea0-bcd0-39eab4d294d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7685AFBA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af06a-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "94f4e9a8-22f0-4ea0-bcd0-39eab4d294d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault00431654cebca43bd2434eb/javablobgetpropertiesdefault1640193678d7cc4d154e", + "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" : "aafa408c-6180-4a98-b956-ae6896bb48f7", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC768FD0BA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af090-d01e-009e-73e5-644931000000", + "x-ms-client-request-id" : "aafa408c-6180-4a98-b956-ae6896bb48f7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault00431654cebca43bd2434eb/javablobgetpropertiesdefault1640193678d7cc4d154e", + "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" : "d21c38d8-8752-4542-b2b9-31de89cddc4d" + }, + "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" : "Fri, 06 Sep 2019 19:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC768FD0BA\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af0ac-d01e-009e-0de5-644931000000", + "x-ms-client-request-id" : "d21c38d8-8752-4542-b2b9-31de89cddc4d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7634b249-5549-42f7-af40-f4f0e913b977" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af0cc-d01e-009e-28e5-644931000000", + "Body" : "jtcgetpropertiesdefaultjtcgetpropertiesdefault00431654cebca43bd2434ebFri, 06 Sep 2019 19:00:19 GMT\"0x8D732FC7685AFBA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "7634b249-5549-42f7-af40-f4f0e913b977", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault00431654cebca43bd2434eb?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" : "590d0520-1c64-4bd0-87f2-965dd9f79518" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af0f1-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "590d0520-1c64-4bd0-87f2-965dd9f79518" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesdefault00431654cebca43bd2434eb", "javablobgetpropertiesdefault1640193678d7cc4d154e" ] +} \ 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..51973e1aff27 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror8ab740680a?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" : "eb0155ec-9c5f-4cec-bf8d-e550a02f97c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC788550AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92afd6f-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "eb0155ec-9c5f-4cec-bf8d-e550a02f97c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror8ab740680a/javablobgetpropertieserror174946edcd21d09e9c442", + "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" : "6a184785-c704-42d6-a3ac-6605f39ed9c8", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC788BA419\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92afde0-d01e-009e-20e5-644931000000", + "x-ms-client-request-id" : "6a184785-c704-42d6-a3ac-6605f39ed9c8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror8ab740680a/javablobgetpropertieserror291504d23ec1291d76479", + "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" : "66b26ce9-d67b-4ccb-a976-ca5e5712346c" + }, + "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" : "b92afe04-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:22 GMT", + "x-ms-client-request-id" : "66b26ce9-d67b-4ccb-a976-ca5e5712346c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "296d2f23-4b62-4473-912f-369fe1a039f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92afe29-d01e-009e-5ae5-644931000000", + "Body" : "jtcgetpropertieserrorjtcgetpropertieserror0blobapitestgetpropertieserror8ab740680aFri, 06 Sep 2019 19:00:23 GMT\"0x8D732FC788550AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "296d2f23-4b62-4473-912f-369fe1a039f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror8ab740680a?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" : "5832f0a1-db11-4e8d-991a-f62f7d4d8eb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92afe4e-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "5832f0a1-db11-4e8d-991a-f62f7d4d8eb7" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieserror0blobapitestgetpropertieserror8ab740680a", "javablobgetpropertieserror174946edcd21d09e9c442", "javablobgetpropertieserror291504d23ec1291d76479" ] +} \ 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..5d31300cfc42 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesminc4393283d381?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" : "2387ec1b-ac35-4af9-ae0e-aad31b2a2fa8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC76B8641A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92af198-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "x-ms-client-request-id" : "2387ec1b-ac35-4af9-ae0e-aad31b2a2fa8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesminc4393283d381/javablobgetpropertiesmin1blobapitestgetpropertiesminc43156851", + "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" : "bea84821-9087-4035-bdd2-896f3f6a7005", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC76BF5066\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92af1c9-d01e-009e-0ce5-644931000000", + "x-ms-client-request-id" : "bea84821-9087-4035-bdd2-896f3f6a7005" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesminc4393283d381/javablobgetpropertiesmin1blobapitestgetpropertiesminc43156851", + "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" : "2aa5185b-7011-4c57-a70e-a16b1e83c1f9" + }, + "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" : "Fri, 06 Sep 2019 19:00:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC76BF5066\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92af1f1-d01e-009e-31e5-644931000000", + "x-ms-client-request-id" : "2aa5185b-7011-4c57-a70e-a16b1e83c1f9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "82700fc5-c1b0-43ae-96c9-e43a7cd13a73" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92af20a-d01e-009e-48e5-644931000000", + "Body" : "jtcgetpropertiesminjtcgetpropertiesmin0blobapitestgetpropertiesminc4393283d381Fri, 06 Sep 2019 19:00:20 GMT\"0x8D732FC76B8641A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "82700fc5-c1b0-43ae-96c9-e43a7cd13a73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesminc4393283d381?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" : "e2227acf-22f2-445f-a1db-91eec11738cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92af239-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:20 GMT", + "x-ms-client-request-id" : "e2227acf-22f2-445f-a1db-91eec11738cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesmin0blobapitestgetpropertiesminc4393283d381", "javablobgetpropertiesmin1blobapitestgetpropertiesminc43156851" ] +} \ 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..f119c342acbb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json @@ -0,0 +1,165 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease348292920d5676d8?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" : "192eedf1-257f-434e-ac06-b241111f9006" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C56133A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7946-d01e-009e-6be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "192eedf1-257f-434e-ac06-b241111f9006" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease348292920d5676d8/javablobreleaselease1blobapitestreleaselease34893280e51f1", + "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" : "de0593d3-eba0-4982-9182-f65f2681721c", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8C5CB59A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7962-d01e-009e-05e5-644931000000", + "x-ms-client-request-id" : "de0593d3-eba0-4982-9182-f65f2681721c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease348292920d5676d8/javablobreleaselease1blobapitestreleaselease34893280e51f1?comp=lease", + "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" : "a7c62250-0ce4-48c9-b67c-3291f21887f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C5CB59A\"", + "x-ms-lease-id" : "15db6802-f7f0-4bb4-9259-7fd4a5fb0b13", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7985-d01e-009e-26e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "a7c62250-0ce4-48c9-b67c-3291f21887f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease348292920d5676d8/javablobreleaselease1blobapitestreleaselease34893280e51f1?comp=lease", + "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" : "64126956-d286-4ec7-a7b8-c710c41a3d9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C5CB59A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b79b8-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "64126956-d286-4ec7-a7b8-c710c41a3d9e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease348292920d5676d8/javablobreleaselease1blobapitestreleaselease34893280e51f1", + "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" : "55cee8d4-faca-4aa6-93d6-56930d3f75a6" + }, + "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" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:56 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" : "\"0x8D732FC8C5CB59A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:56 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b7a35-d01e-009e-41e5-644931000000", + "x-ms-client-request-id" : "55cee8d4-faca-4aa6-93d6-56930d3f75a6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d303b42-7e47-4688-b10c-cc4c5b33427e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7a51-d01e-009e-5ae5-644931000000", + "Body" : "jtcreleaseleasejtcreleaselease0blobapitestreleaselease348292920d5676d8Fri, 06 Sep 2019 19:00:56 GMT\"0x8D732FC8C56133A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "9d303b42-7e47-4688-b10c-cc4c5b33427e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease348292920d5676d8?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" : "d90c78ee-3c32-4a8a-8ff1-bf60e809fbfc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7a6b-d01e-009e-70e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "d90c78ee-3c32-4a8a-8ff1-bf60e809fbfc" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaselease0blobapitestreleaselease348292920d5676d8", "javablobreleaselease1blobapitestreleaselease34893280e51f1" ] +} \ 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..98973dc643e3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6?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" : "84c252cd-bd56-4cb8-84b2-19ceaa23215a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8CBD02EF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7b57-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "84c252cd-bd56-4cb8-84b2-19ceaa23215a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6/javablobreleaseleaseac1blobapitestreleaseleaseace3548827963", + "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" : "1a95e7df-6a71-420e-b408-7600e01ee8fc", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8CCE2FFB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7c08-d01e-009e-54e5-644931000000", + "x-ms-client-request-id" : "1a95e7df-6a71-420e-b408-7600e01ee8fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6/javablobreleaseleaseac1blobapitestreleaseleaseace3548827963?comp=lease", + "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" : "fe1e67a2-7785-4758-ac5b-938fbb9a7a5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8CCE2FFB\"", + "x-ms-lease-id" : "89aebf1e-0c4b-4b8d-b82c-65171d485d03", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7c2c-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "fe1e67a2-7785-4758-ac5b-938fbb9a7a5d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6/javablobreleaseleaseac1blobapitestreleaseleaseace3548827963?comp=lease", + "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" : "12097434-6b29-4536-8c37-50eb12700ede" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8CCE2FFB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7c48-d01e-009e-0be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "12097434-6b29-4536-8c37-50eb12700ede" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "94a4fa5d-d542-4f96-83d2-0b86ee397b79" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7c64-d01e-009e-25e5-644931000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6Fri, 06 Sep 2019 19:00:57 GMT\"0x8D732FC8CBD02EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "94a4fa5d-d542-4f96-83d2-0b86ee397b79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6?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" : "9f19a1fc-a60c-43d2-93b1-9572ac9ddd97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7c87-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "9f19a1fc-a60c-43d2-93b1-9572ac9ddd97" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseace3505121b00ee6", "javablobreleaseleaseac1blobapitestreleaseleaseace3548827963" ] +} \ 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..3d1f06567837 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841?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" : "40cf5a3f-7123-487d-87ac-2d92f8b3c570" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8CEA5EEC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7cac-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "40cf5a3f-7123-487d-87ac-2d92f8b3c570" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841/javablobreleaseleaseac1blobapitestreleaseleaseac90f95310db2", + "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" : "84defe5a-4a72-4b7e-a84d-00a3f6de1c22", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8CF03F04\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7cd7-d01e-009e-08e5-644931000000", + "x-ms-client-request-id" : "84defe5a-4a72-4b7e-a84d-00a3f6de1c22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841/javablobreleaseleaseac1blobapitestreleaseleaseac90f95310db2?comp=lease", + "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" : "af7d4c55-2cd7-4be4-8c11-00ea41f6f7e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8CF03F04\"", + "x-ms-lease-id" : "bc4cb94e-0eb2-4e5f-829c-e655c9e883f1", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7d0f-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "af7d4c55-2cd7-4be4-8c11-00ea41f6f7e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841/javablobreleaseleaseac1blobapitestreleaseleaseac90f95310db2?comp=lease", + "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" : "f9a211cd-e33c-4bae-ba70-268eeb93ddf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8CF03F04\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7d22-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "f9a211cd-e33c-4bae-ba70-268eeb93ddf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b95c8cd2-e026-4719-aa2e-17a44d8e36ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7d45-d01e-009e-68e5-644931000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841Fri, 06 Sep 2019 19:00:57 GMT\"0x8D732FC8CEA5EEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "b95c8cd2-e026-4719-aa2e-17a44d8e36ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841?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" : "2ab34de9-654e-49c0-96c7-05c494b78d68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7d68-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "2ab34de9-654e-49c0-96c7-05c494b78d68" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac90f26726edd841", "javablobreleaseleaseac1blobapitestreleaseleaseac90f95310db2" ] +} \ 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..09ac4e6e9adb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86e?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" : "a8673169-2f66-4c33-a35b-946da2173d03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D165AFD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7d94-d01e-009e-30e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "a8673169-2f66-4c33-a35b-946da2173d03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86e/javablobreleaseleaseac1blobapitestreleaseleaseacdb771976c21", + "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" : "a387db6c-6e7d-4d0c-84b6-ac0e058fd452", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8D1CFEF3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7de4-d01e-009e-79e5-644931000000", + "x-ms-client-request-id" : "a387db6c-6e7d-4d0c-84b6-ac0e058fd452" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86e/javablobreleaseleaseac1blobapitestreleaseleaseacdb771976c21?comp=lease", + "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" : "3017bd94-41d2-438b-8f91-aa5819e3c0db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D1CFEF3\"", + "x-ms-lease-id" : "42132aab-1a23-45d7-8559-0493aa7f4696", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7e05-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "3017bd94-41d2-438b-8f91-aa5819e3c0db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86e/javablobreleaseleaseac1blobapitestreleaseleaseacdb771976c21?comp=lease", + "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" : "4f1b7f5f-db5c-4d0f-b9da-bfb2be50590c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D1CFEF3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7e28-d01e-009e-3ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "4f1b7f5f-db5c-4d0f-b9da-bfb2be50590c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a4b91eec-abdd-475a-9c4c-aaa8b290d814" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7e56-d01e-009e-67e5-644931000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86eFri, 06 Sep 2019 19:00:57 GMT\"0x8D732FC8D165AFD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "a4b91eec-abdd-475a-9c4c-aaa8b290d814", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86e?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" : "4d399237-ffa8-4e2b-8cfc-b1e9631441f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7e84-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "4d399237-ffa8-4e2b-8cfc-b1e9631441f0" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseacdb78283461c86e", "javablobreleaseleaseac1blobapitestreleaseleaseacdb771976c21" ] +} \ 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..440b6424fae8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4?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" : "f9e9428a-81bd-451f-89c8-c9ef64453882" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D3B0265\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7eb4-d01e-009e-3ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "f9e9428a-81bd-451f-89c8-c9ef64453882" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4/javablobreleaseleaseac1blobapitestreleaseleaseacc540797430a", + "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" : "9dc88aab-de3e-41ed-a8e9-6c0e9096c067", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8D41F4DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7edb-d01e-009e-5ee5-644931000000", + "x-ms-client-request-id" : "9dc88aab-de3e-41ed-a8e9-6c0e9096c067" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4/javablobreleaseleaseac1blobapitestreleaseleaseacc540797430a", + "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" : "6bdc18f1-7640-4a97-9332-6df0cdfef2af" + }, + "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" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC8D41F4DA\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:57 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b7ef2-d01e-009e-73e5-644931000000", + "x-ms-client-request-id" : "6bdc18f1-7640-4a97-9332-6df0cdfef2af", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4/javablobreleaseleaseac1blobapitestreleaseleaseacc540797430a?comp=lease", + "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" : "40eeccb3-f4e9-45cc-93be-96ec7f6ae07a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D41F4DA\"", + "x-ms-lease-id" : "14ff0ef2-ea74-409c-909b-c4e988067122", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7f0f-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "40eeccb3-f4e9-45cc-93be-96ec7f6ae07a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4/javablobreleaseleaseac1blobapitestreleaseleaseacc540797430a?comp=lease", + "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" : "4acbe17b-bfbf-47f8-9594-52d87d6cf0bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D41F4DA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7f32-d01e-009e-30e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "4acbe17b-bfbf-47f8-9594-52d87d6cf0bc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f3a9ca62-05b3-49eb-ac72-8396f8c4dd17" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7f5a-d01e-009e-53e5-644931000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4Fri, 06 Sep 2019 19:00:57 GMT\"0x8D732FC8D3B0265\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "f3a9ca62-05b3-49eb-ac72-8396f8c4dd17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4?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" : "9b3dfb8a-80ab-4751-ac5e-932f8565346d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7f87-d01e-009e-7de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "9b3dfb8a-80ab-4751-ac5e-932f8565346d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseacc5433607705dd4", "javablobreleaseleaseac1blobapitestreleaseleaseacc540797430a" ] +} \ 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..4605f1ef250c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49?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" : "fb615480-f607-4b8c-b9ac-11796f658da1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D635423\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7fb1-d01e-009e-24e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "fb615480-f607-4b8c-b9ac-11796f658da1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49/javablobreleaseleaseac1blobapitestreleaseleaseac24290801cc8", + "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" : "32ca77a9-c56f-4f68-b402-5413aab4492a", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8D6BCDF3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7ff2-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "32ca77a9-c56f-4f68-b402-5413aab4492a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49/javablobreleaseleaseac1blobapitestreleaseleaseac24290801cc8?comp=lease", + "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" : "56d38eea-7805-4574-8f36-fb9f924c4d41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D6BCDF3\"", + "x-ms-lease-id" : "ca7fa902-5e94-4d8f-9ddd-291265b52b80", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b801e-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:57 GMT", + "x-ms-client-request-id" : "56d38eea-7805-4574-8f36-fb9f924c4d41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49/javablobreleaseleaseac1blobapitestreleaseleaseac24290801cc8?comp=lease", + "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" : "3eeb823f-fec5-485a-ae79-c5f8cf00ce29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D6BCDF3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8036-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "3eeb823f-fec5-485a-ae79-c5f8cf00ce29" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1f90241d-c564-470f-b64c-27673e5245a6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8058-d01e-009e-3ee5-644931000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49Fri, 06 Sep 2019 19:00:58 GMT\"0x8D732FC8D635423\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "1f90241d-c564-470f-b64c-27673e5245a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49?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" : "439a0030-43f0-4a39-89ff-1b65ed84e13d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8087-d01e-009e-68e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "439a0030-43f0-4a39-89ff-1b65ed84e13d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac242455716e4d49", "javablobreleaseleaseac1blobapitestreleaseleaseac24290801cc8" ] +} \ 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..7ee1403e8a9d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228c?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" : "9297f300-0a59-40eb-a555-c0ba3b0ba9f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D8B0984\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b80a7-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "9297f300-0a59-40eb-a555-c0ba3b0ba9f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228c/javablobreleaseleaseacfail1178881f828a2468464f9", + "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" : "0566c2d6-ef6d-4a61-b8bb-64f4e5817ae4", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8D924ACE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b80c2-d01e-009e-1fe5-644931000000", + "x-ms-client-request-id" : "0566c2d6-ef6d-4a61-b8bb-64f4e5817ae4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228c/javablobreleaseleaseacfail1178881f828a2468464f9?comp=lease", + "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" : "2ddf233b-f470-4f81-8041-980e24d87224" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8D924ACE\"", + "x-ms-lease-id" : "fcca13b3-20b7-4827-9a9a-0dd54d82adb9", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b80ef-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "2ddf233b-f470-4f81-8041-980e24d87224" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228c/javablobreleaseleaseacfail1178881f828a2468464f9?comp=lease", + "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" : "d7c0d2f1-ab4d-4fe5-a881-ef4c992a7f86" + }, + "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" : "b92b810f-d01e-009e-66e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b810f-d01e-009e-66e5-644931000000\nTime:2019-09-06T19:00:58.5492609Z", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "d7c0d2f1-ab4d-4fe5-a881-ef4c992a7f86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bbcc1a88-f60f-486c-93ae-45345124cf62" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b812a-d01e-009e-7fe5-644931000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228cFri, 06 Sep 2019 19:00:58 GMT\"0x8D732FC8D8B0984\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "bbcc1a88-f60f-486c-93ae-45345124cf62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228c?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" : "3b51e532-1b0a-4dad-bd5a-8a76476d51fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b813e-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "3b51e532-1b0a-4dad-bd5a-8a76476d51fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfailf35653228c", "javablobreleaseleaseacfail1178881f828a2468464f9" ] +} \ 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..9980db97c8e1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607b?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" : "c54fa868-f3fa-416d-8e2f-9e9b3ab571e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8DB249A7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8164-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "c54fa868-f3fa-416d-8e2f-9e9b3ab571e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607b/javablobreleaseleaseacfail103236bdf3cc3a271e4b8", + "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" : "66eb6b12-1ff6-41ab-b6da-ff581c26af64", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8DB915E9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8183-d01e-009e-4be5-644931000000", + "x-ms-client-request-id" : "66eb6b12-1ff6-41ab-b6da-ff581c26af64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607b/javablobreleaseleaseacfail103236bdf3cc3a271e4b8?comp=lease", + "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" : "616c3060-1b45-449a-a588-5f2b50468971" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8DB915E9\"", + "x-ms-lease-id" : "afc418be-fa7b-4675-979d-ea73efa75fb8", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b81c9-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "616c3060-1b45-449a-a588-5f2b50468971" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607b/javablobreleaseleaseacfail103236bdf3cc3a271e4b8?comp=lease", + "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" : "822000ae-604c-421a-b941-32ebc241f796" + }, + "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" : "b92b81ee-d01e-009e-25e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b81ee-d01e-009e-25e5-644931000000\nTime:2019-09-06T19:00:58.8124987Z", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "822000ae-604c-421a-b941-32ebc241f796", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8cc2af8f-7720-43c0-87ef-d70acc19e657" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b820f-d01e-009e-42e5-644931000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607bFri, 06 Sep 2019 19:00:58 GMT\"0x8D732FC8DB249A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "8cc2af8f-7720-43c0-87ef-d70acc19e657", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607b?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" : "3dedb14c-4b1e-4cde-8017-3e6518f0b333" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8231-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "3dedb14c-4b1e-4cde-8017-3e6518f0b333" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail271061607b", "javablobreleaseleaseacfail103236bdf3cc3a271e4b8" ] +} \ 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..6bba660adbb3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cb?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" : "b9957f85-4439-4e91-a280-c7d429e38408" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8DDA9B72\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b8255-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "b9957f85-4439-4e91-a280-c7d429e38408" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cb/javablobreleaseleaseacfail112723693ee95d54b648d", + "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" : "17c65e4b-135f-4a8e-9434-c8b6a95ec11f", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8DE0A47C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b8274-d01e-009e-1fe5-644931000000", + "x-ms-client-request-id" : "17c65e4b-135f-4a8e-9434-c8b6a95ec11f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cb/javablobreleaseleaseacfail112723693ee95d54b648d?comp=lease", + "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" : "8ec57b36-060b-48fb-afef-e3cb9c2775fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8DE0A47C\"", + "x-ms-lease-id" : "3bee3402-99d6-4a49-9d03-bdae682548a7", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b828a-d01e-009e-34e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "8ec57b36-060b-48fb-afef-e3cb9c2775fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cb/javablobreleaseleaseacfail112723693ee95d54b648d?comp=lease", + "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" : "7b1dd258-9c97-42e3-a13f-97baa4dbdeb6" + }, + "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" : "b92b82ae-d01e-009e-56e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b82ae-d01e-009e-56e5-644931000000\nTime:2019-09-06T19:00:59.0387022Z", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "7b1dd258-9c97-42e3-a13f-97baa4dbdeb6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8c0e940b-f010-415e-bbd3-b9147d7e77e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b82db-d01e-009e-02e5-644931000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cbFri, 06 Sep 2019 19:00:58 GMT\"0x8D732FC8DDA9B72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "8c0e940b-f010-415e-bbd3-b9147d7e77e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cb?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" : "845cb1ca-9f63-4574-993c-8fa2685fc76e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b82fe-d01e-009e-24e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "845cb1ca-9f63-4574-993c-8fa2685fc76e" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail6fe79943cb", "javablobreleaseleaseacfail112723693ee95d54b648d" ] +} \ 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..caeaf6777df1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531?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" : "cfe8b397-e77d-4dc3-bd3f-70da28dabb59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E0229CB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b833b-d01e-009e-56e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:58 GMT", + "x-ms-client-request-id" : "cfe8b397-e77d-4dc3-bd3f-70da28dabb59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531/javablobreleaseleaseacfail1579683deb942c956345b", + "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" : "ecb69c3b-6898-497d-8efd-57520bbb2ad2", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8E15F1F2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b83e3-d01e-009e-71e5-644931000000", + "x-ms-client-request-id" : "ecb69c3b-6898-497d-8efd-57520bbb2ad2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531/javablobreleaseleaseacfail1579683deb942c956345b", + "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" : "8e25f260-32e2-4e32-b1c2-89943b5794f5" + }, + "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" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:59 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" : "\"0x8D732FC8E15F1F2\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:59 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b8413-d01e-009e-1ae5-644931000000", + "x-ms-client-request-id" : "8e25f260-32e2-4e32-b1c2-89943b5794f5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531/javablobreleaseleaseacfail1579683deb942c956345b?comp=lease", + "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" : "3d6e5188-44a0-428c-9f87-1a171869c95b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E15F1F2\"", + "x-ms-lease-id" : "49599a98-9951-4a4a-a589-0b996b79bd18", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b842c-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "3d6e5188-44a0-428c-9f87-1a171869c95b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531/javablobreleaseleaseacfail1579683deb942c956345b?comp=lease", + "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" : "eadea8b5-f7fe-4704-9ce9-514ab82e4dc0" + }, + "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" : "b92b8452-d01e-009e-58e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b8452-d01e-009e-58e5-644931000000\nTime:2019-09-06T19:00:59.4190452Z", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "eadea8b5-f7fe-4704-9ce9-514ab82e4dc0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac3deec5-3bca-4f6b-a172-f066c1ca19cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8476-d01e-009e-78e5-644931000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531Fri, 06 Sep 2019 19:00:59 GMT\"0x8D732FC8E0229CB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "ac3deec5-3bca-4f6b-a172-f066c1ca19cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531?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" : "ee81977e-89bf-4873-b439-5bc817b2837c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b8495-d01e-009e-15e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "ee81977e-89bf-4873-b439-5bc817b2837c" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5c77733531", "javablobreleaseleaseacfail1579683deb942c956345b" ] +} \ 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..d13d1d52e4d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorb1601837b45?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" : "9d198739-c540-4932-9867-452f13ed3f51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8E366524\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b84bb-d01e-009e-37e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "9d198739-c540-4932-9867-452f13ed3f51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorb1601837b45/javablobreleaseleaseerror1blobapitestreleaseleaseerrorb1609876", + "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" : "79bf7987-3697-4213-81c7-995022678f86", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8E3C95F2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b84e2-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "79bf7987-3697-4213-81c7-995022678f86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorb1601837b45/javablobreleaseleaseerror2blobapitestreleaseleaseerrorb1616538?comp=lease", + "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" : "bd39491d-5f57-442d-9c75-84a7ce8c7e39" + }, + "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" : "b92b850b-d01e-009e-03e5-644931000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b92b850b-d01e-009e-03e5-644931000000\nTime:2019-09-06T19:00:59.6092150Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "bd39491d-5f57-442d-9c75-84a7ce8c7e39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2958a59e-a530-4f24-bf72-49dd5a543bd2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b8526-d01e-009e-1de5-644931000000", + "Body" : "jtcreleaseleaseerrorjtcreleaseleaseerror0blobapitestreleaseleaseerrorb1601837b45Fri, 06 Sep 2019 19:00:59 GMT\"0x8D732FC8E366524\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "2958a59e-a530-4f24-bf72-49dd5a543bd2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorb1601837b45?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" : "6ba9779e-b130-46ec-875c-26aefd0eb8d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b854c-d01e-009e-41e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:59 GMT", + "x-ms-client-request-id" : "6ba9779e-b130-46ec-875c-26aefd0eb8d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseerror0blobapitestreleaseleaseerrorb1601837b45", "javablobreleaseleaseerror1blobapitestreleaseleaseerrorb1609876", "javablobreleaseleaseerror2blobapitestreleaseleaseerrorb1616538" ] +} \ 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..1819ad95d005 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9?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" : "acef2757-68be-48fc-86ae-fdf235acd01d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C92B4EE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7a8e-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "acef2757-68be-48fc-86ae-fdf235acd01d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9/javablobreleaseleasemin1blobapitestreleaseleaseminf12617335a", + "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" : "eea8cb29-b4c2-4281-b9d9-6535438fd02e", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8C997EEF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7ab2-d01e-009e-2ee5-644931000000", + "x-ms-client-request-id" : "eea8cb29-b4c2-4281-b9d9-6535438fd02e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9/javablobreleaseleasemin1blobapitestreleaseleaseminf12617335a?comp=lease", + "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" : "c92882cf-8031-4454-804d-a797139b6a23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C997EEF\"", + "x-ms-lease-id" : "b6ff9d89-15cd-4659-996f-fd007343fc86", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7ad4-d01e-009e-4ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "c92882cf-8031-4454-804d-a797139b6a23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9/javablobreleaseleasemin1blobapitestreleaseleaseminf12617335a?comp=lease", + "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" : "567f5d28-d5be-4ca2-ab65-9ebeabbd49ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C997EEF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7af1-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "567f5d28-d5be-4ca2-ab65-9ebeabbd49ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2170b170-bda1-488e-8438-e4437c01ae3d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7b0e-d01e-009e-80e5-644931000000", + "Body" : "jtcreleaseleaseminjtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9Fri, 06 Sep 2019 19:00:56 GMT\"0x8D732FC8C92B4EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "2170b170-bda1-488e-8438-e4437c01ae3d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9?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" : "4f4c53a4-76b6-4f46-b9e3-d0a1079aca1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7b2e-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "4f4c53a4-76b6-4f46-b9e3-d0a1079aca1f" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleasemin0blobapitestreleaseleaseminf1208654a40c9", "javablobreleaseleasemin1blobapitestreleaseleaseminf12617335a" ] +} \ 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..78b9a20c5a9d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json @@ -0,0 +1,167 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease7f479136d367895634?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" : "670e1ccc-59f1-44ee-956f-3dd32f2adc51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC80C7F1E7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b325b-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "670e1ccc-59f1-44ee-956f-3dd32f2adc51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease7f479136d367895634/javablobrenewlease1blobapitestrenewlease7f439944298eccb", + "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" : "65382fc3-b9db-4797-9ee9-343b81fc56cd", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC80CE7D08\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b3282-d01e-009e-61e5-644931000000", + "x-ms-client-request-id" : "65382fc3-b9db-4797-9ee9-343b81fc56cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease7f479136d367895634/javablobrenewlease1blobapitestrenewlease7f439944298eccb?comp=lease", + "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" : "0c225768-903d-48d8-aef0-59facca5faa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC80CE7D08\"", + "x-ms-lease-id" : "d27ad392-19f2-48d5-9788-adad10460024", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b32ac-d01e-009e-09e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:36 GMT", + "x-ms-client-request-id" : "0c225768-903d-48d8-aef0-59facca5faa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease7f479136d367895634/javablobrenewlease1blobapitestrenewlease7f439944298eccb?comp=lease", + "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" : "d47dcee1-ef0a-4ed4-975e-afc29d534980" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC80CE7D08\"", + "x-ms-lease-id" : "d27ad392-19f2-48d5-9788-adad10460024", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6d14-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:52 GMT", + "x-ms-client-request-id" : "d47dcee1-ef0a-4ed4-975e-afc29d534980" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease7f479136d367895634/javablobrenewlease1blobapitestrenewlease7f439944298eccb", + "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" : "1100e65a-f874-4282-bf5d-758d6d190b19" + }, + "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" : "Fri, 06 Sep 2019 19:00:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:52 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" : "\"0x8D732FC80CE7D08\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:37 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "b92b6d51-d01e-009e-76e5-644931000000", + "x-ms-client-request-id" : "1100e65a-f874-4282-bf5d-758d6d190b19", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "87fb2eb5-5bd6-45d9-8f0a-ac5a60d258c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6d76-d01e-009e-19e5-644931000000", + "Body" : "jtcrenewleasejtcrenewlease0blobapitestrenewlease7f479136d367895634Fri, 06 Sep 2019 19:00:36 GMT\"0x8D732FC80C7F1E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:52 GMT", + "x-ms-client-request-id" : "87fb2eb5-5bd6-45d9-8f0a-ac5a60d258c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease7f479136d367895634?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" : "ddfda213-3fb6-46aa-96b9-9e5b54977507" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b6d96-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:52 GMT", + "x-ms-client-request-id" : "ddfda213-3fb6-46aa-96b9-9e5b54977507" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewlease0blobapitestrenewlease7f479136d367895634", "javablobrenewlease1blobapitestrenewlease7f439944298eccb" ] +} \ 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..aa1ef3cef651 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727?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" : "5435d1cc-fa39-4b1e-b54b-bd3965e1be49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AA84E95\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b6eaa-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "5435d1cc-fa39-4b1e-b54b-bd3965e1be49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727/javablobrenewleaseac1blobapitestrenewleaseac0501569969aa5", + "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" : "b18e847e-6b00-4796-9b13-7b2e5bb6b222", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8AAE513F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b6ed4-d01e-009e-49e5-644931000000", + "x-ms-client-request-id" : "b18e847e-6b00-4796-9b13-7b2e5bb6b222" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727/javablobrenewleaseac1blobapitestrenewleaseac0501569969aa5?comp=lease", + "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" : "ae583ab7-17c3-4d97-bc4b-0d36a8c0df23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AAE513F\"", + "x-ms-lease-id" : "8a3485e0-5f61-42b9-888e-018366ea9e17", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b6eed-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "ae583ab7-17c3-4d97-bc4b-0d36a8c0df23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727/javablobrenewleaseac1blobapitestrenewleaseac0501569969aa5?comp=lease", + "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" : "dd757bfe-7611-490f-b319-fa323413ee53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AAE513F\"", + "x-ms-lease-id" : "8a3485e0-5f61-42b9-888e-018366ea9e17", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6f01-d01e-009e-71e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "dd757bfe-7611-490f-b319-fa323413ee53" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c87f0f63-a551-4953-9969-1d9d5be4e918" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6f1e-d01e-009e-0ae5-644931000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727Fri, 06 Sep 2019 19:00:53 GMT\"0x8D732FC8AA84E95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "c87f0f63-a551-4953-9969-1d9d5be4e918", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727?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" : "74491d99-32c4-4aa7-b786-6577424072a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b6f51-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "74491d99-32c4-4aa7-b786-6577424072a6" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac05073118b34d5727", "javablobrenewleaseac1blobapitestrenewleaseac0501569969aa5" ] +} \ 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..9cf046fa3d0a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748a?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" : "c175b320-a4e6-49a7-b913-0347bda3aaa2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8ACB6EFE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b6f7e-d01e-009e-58e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "c175b320-a4e6-49a7-b913-0347bda3aaa2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748a/javablobrenewleaseac1blobapitestrenewleaseace4859087c5f15", + "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" : "b2dc4e9e-e045-459a-8238-4e6747859cb9", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8AD123CE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b6fa8-d01e-009e-78e5-644931000000", + "x-ms-client-request-id" : "b2dc4e9e-e045-459a-8238-4e6747859cb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748a/javablobrenewleaseac1blobapitestrenewleaseace4859087c5f15?comp=lease", + "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" : "d8df46ff-d241-472b-900a-c017cc1e7cb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AD123CE\"", + "x-ms-lease-id" : "527012ef-57a7-460e-a1d1-de2ce5bf27c4", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b6fc8-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "d8df46ff-d241-472b-900a-c017cc1e7cb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748a/javablobrenewleaseac1blobapitestrenewleaseace4859087c5f15?comp=lease", + "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" : "f926a1b8-bdcf-4615-b380-b9eb0325c539" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AD123CE\"", + "x-ms-lease-id" : "527012ef-57a7-460e-a1d1-de2ce5bf27c4", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6ff1-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "f926a1b8-bdcf-4615-b380-b9eb0325c539" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "675b58f8-360f-47aa-8ab3-b9ddd1bc5433" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7015-d01e-009e-54e5-644931000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748aFri, 06 Sep 2019 19:00:53 GMT\"0x8D732FC8ACB6EFE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "675b58f8-360f-47aa-8ab3-b9ddd1bc5433", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748a?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" : "d13c6099-0c3d-45fd-9d03-6fbd832009bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7031-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "d13c6099-0c3d-45fd-9d03-6fbd832009bc" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseace4819457e7ae748a", "javablobrenewleaseac1blobapitestrenewleaseace4859087c5f15" ] +} \ 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..1b640a9b742a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8d?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" : "ac00e13c-19a3-4868-a3f7-c27015ba9388" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AEF52E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7064-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "ac00e13c-19a3-4868-a3f7-c27015ba9388" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8d/javablobrenewleaseac1blobapitestrenewleaseac8c503477abbd8", + "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" : "a99d8069-0c78-4837-b977-7b3fffdc2142", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8AF57D4B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7088-d01e-009e-35e5-644931000000", + "x-ms-client-request-id" : "a99d8069-0c78-4837-b977-7b3fffdc2142" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8d/javablobrenewleaseac1blobapitestrenewleaseac8c503477abbd8?comp=lease", + "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" : "a71333d0-7279-47f4-9ca6-0546ca3b6855" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AF57D4B\"", + "x-ms-lease-id" : "b50e6956-7e25-401d-bc27-94ff6bf3ca55", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b70b1-d01e-009e-58e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "a71333d0-7279-47f4-9ca6-0546ca3b6855" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8d/javablobrenewleaseac1blobapitestrenewleaseac8c503477abbd8?comp=lease", + "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" : "9fc0e4b0-3ea4-45e0-af22-f31cffa61200" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8AF57D4B\"", + "x-ms-lease-id" : "b50e6956-7e25-401d-bc27-94ff6bf3ca55", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b70d5-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "9fc0e4b0-3ea4-45e0-af22-f31cffa61200" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c582b49a-c9c2-475d-9a0c-6eb9065db822" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b70fa-d01e-009e-15e5-644931000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8dFri, 06 Sep 2019 19:00:54 GMT\"0x8D732FC8AEF52E6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "c582b49a-c9c2-475d-9a0c-6eb9065db822", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8d?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" : "25d5f500-17fd-408f-9606-61b610f60669" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7122-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "25d5f500-17fd-408f-9606-61b610f60669" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac8c562950a66c1d8d", "javablobrenewleaseac1blobapitestrenewleaseac8c503477abbd8" ] +} \ 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..3958d9b912a9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695?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" : "1a465a76-6358-4a19-b8ad-6a8220fd9dd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B28987A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b71d1-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "1a465a76-6358-4a19-b8ad-6a8220fd9dd9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695/javablobrenewleaseac1blobapitestrenewleaseac499986967e52a", + "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" : "d5946e0f-5353-481f-aff1-6bbbdeae42c6", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8B2F38A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b71fa-d01e-009e-75e5-644931000000", + "x-ms-client-request-id" : "d5946e0f-5353-481f-aff1-6bbbdeae42c6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695/javablobrenewleaseac1blobapitestrenewleaseac499986967e52a", + "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" : "4c089152-36e3-4ee1-8918-e6410cda19d1" + }, + "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" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC8B2F38A1\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:54 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b7221-d01e-009e-16e5-644931000000", + "x-ms-client-request-id" : "4c089152-36e3-4ee1-8918-e6410cda19d1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695/javablobrenewleaseac1blobapitestrenewleaseac499986967e52a?comp=lease", + "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" : "c4b6fb0f-4f2e-48a3-b799-fe7bf0cf686c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B2F38A1\"", + "x-ms-lease-id" : "c44d6b8d-cbcb-4fe3-9f47-cef2e30d16ec", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7247-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "c4b6fb0f-4f2e-48a3-b799-fe7bf0cf686c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695/javablobrenewleaseac1blobapitestrenewleaseac499986967e52a?comp=lease", + "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" : "313cb5ba-7fb5-4e6a-8808-b04eb198e4de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B2F38A1\"", + "x-ms-lease-id" : "c44d6b8d-cbcb-4fe3-9f47-cef2e30d16ec", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7269-d01e-009e-59e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "313cb5ba-7fb5-4e6a-8808-b04eb198e4de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "db90c5a2-d4a6-4974-b1bf-4a80aa57df18" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b727e-d01e-009e-6be5-644931000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695Fri, 06 Sep 2019 19:00:54 GMT\"0x8D732FC8B28987A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "db90c5a2-d4a6-4974-b1bf-4a80aa57df18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695?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" : "26c0f5c4-84f9-434f-9f9f-b278031560ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b728e-d01e-009e-78e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "26c0f5c4-84f9-434f-9f9f-b278031560ce" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac49960944b1bdd695", "javablobrenewleaseac1blobapitestrenewleaseac499986967e52a" ] +} \ 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..9441d622e3ea --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15?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" : "8990f729-34c1-474f-a1de-7b273ea2b85c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B4EC6D6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b72a7-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "8990f729-34c1-474f-a1de-7b273ea2b85c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15/javablobrenewleaseac1blobapitestrenewleaseac0f68098542570", + "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" : "01ab03dd-432a-4545-81b0-93247813deea", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8B556752\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b72d4-d01e-009e-36e5-644931000000", + "x-ms-client-request-id" : "01ab03dd-432a-4545-81b0-93247813deea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15/javablobrenewleaseac1blobapitestrenewleaseac0f68098542570?comp=lease", + "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" : "31af7e8f-1c17-480f-9671-a99f16586d8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B556752\"", + "x-ms-lease-id" : "064f76e6-60bc-4eb3-8237-bacbe0c4b20c", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b72ff-d01e-009e-5ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "31af7e8f-1c17-480f-9671-a99f16586d8c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15/javablobrenewleaseac1blobapitestrenewleaseac0f68098542570?comp=lease", + "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" : "88f6b8fc-23fe-4938-8a44-ff7667375b43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B556752\"", + "x-ms-lease-id" : "064f76e6-60bc-4eb3-8237-bacbe0c4b20c", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7326-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "88f6b8fc-23fe-4938-8a44-ff7667375b43" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "82bd9b83-d62f-42e1-a29a-760fba86f7c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b734a-d01e-009e-21e5-644931000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15Fri, 06 Sep 2019 19:00:54 GMT\"0x8D732FC8B4EC6D6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "82bd9b83-d62f-42e1-a29a-760fba86f7c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15?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" : "4d49fd68-2f7a-47af-8a83-1b12ed53170b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7361-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "4d49fd68-2f7a-47af-8a83-1b12ed53170b" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac0f67631256df6f15", "javablobrenewleaseac1blobapitestrenewleaseac0f68098542570" ] +} \ 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..1cfd916a78a9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700?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" : "4c5919bb-3021-4811-a8c3-1ac205bb7546" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B714AE0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7382-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "4c5919bb-3021-4811-a8c3-1ac205bb7546" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700/javablobrenewleaseacfail1blobapitestrenewleaseacfaild19062036", + "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" : "3a830008-8a8a-4c28-9b56-fddff17e4730", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8B7C0B5B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b73ae-d01e-009e-76e5-644931000000", + "x-ms-client-request-id" : "3a830008-8a8a-4c28-9b56-fddff17e4730" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700/javablobrenewleaseacfail1blobapitestrenewleaseacfaild19062036?comp=lease", + "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" : "0547f847-fbdc-4399-83a6-f679175c0887" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B7C0B5B\"", + "x-ms-lease-id" : "d22dabb4-14fd-407e-b580-1eb95c652f72", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b73ef-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "0547f847-fbdc-4399-83a6-f679175c0887" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700/javablobrenewleaseacfail1blobapitestrenewleaseacfaild19062036?comp=lease", + "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" : "6ffe5216-cf18-4cb0-98b8-2b67fbecbcc3" + }, + "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" : "b92b7410-d01e-009e-4ae5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b7410-d01e-009e-4ae5-644931000000\nTime:2019-09-06T19:00:55.0280993Z", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "6ffe5216-cf18-4cb0-98b8-2b67fbecbcc3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "37bdc175-4a99-411e-ac95-bcfe0a571f26" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7437-d01e-009e-6de5-644931000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700Fri, 06 Sep 2019 19:00:54 GMT\"0x8D732FC8B714AE0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "37bdc175-4a99-411e-ac95-bcfe0a571f26", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700?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" : "f9cdc6c3-5d90-4940-bc06-cc41f4529e5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7461-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "f9cdc6c3-5d90-4940-bc06-cc41f4529e5c" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfaild19053360700", "javablobrenewleaseacfail1blobapitestrenewleaseacfaild19062036" ] +} \ 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..01d1e275da50 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2d?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" : "ed11cc8b-4e09-408a-85c6-1eed607be2df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8B9B98E1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b749d-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "ed11cc8b-4e09-408a-85c6-1eed607be2df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2d/javablobrenewleaseacfail1blobapitestrenewleaseacfail888948015", + "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" : "99e84da8-8a6f-4eb0-b5e8-176c746cef14", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8BA2611A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b74c8-d01e-009e-65e5-644931000000", + "x-ms-client-request-id" : "99e84da8-8a6f-4eb0-b5e8-176c746cef14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2d/javablobrenewleaseacfail1blobapitestrenewleaseacfail888948015?comp=lease", + "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" : "4e5336b0-88b7-4a18-af2a-9b51bb3826d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8BA2611A\"", + "x-ms-lease-id" : "3da32320-df73-4991-a6e8-503cd5e270b4", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b74f1-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:54 GMT", + "x-ms-client-request-id" : "4e5336b0-88b7-4a18-af2a-9b51bb3826d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2d/javablobrenewleaseacfail1blobapitestrenewleaseacfail888948015?comp=lease", + "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" : "50838127-fa87-4011-8952-03dd2e019464" + }, + "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" : "b92b750e-d01e-009e-21e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b750e-d01e-009e-21e5-644931000000\nTime:2019-09-06T19:00:55.2793236Z", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "50838127-fa87-4011-8952-03dd2e019464", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d4aa8912-5b9b-4cd2-9bb9-1ff318bf490c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7528-d01e-009e-37e5-644931000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2dFri, 06 Sep 2019 19:00:55 GMT\"0x8D732FC8B9B98E1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "d4aa8912-5b9b-4cd2-9bb9-1ff318bf490c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2d?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" : "bed66464-de7e-40e9-83cd-44bdaea6a002" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7543-d01e-009e-4ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "bed66464-de7e-40e9-83cd-44bdaea6a002" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail888723222e2d", "javablobrenewleaseacfail1blobapitestrenewleaseacfail888948015" ] +} \ 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..582039a6ce61 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1f?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" : "7cc87ee9-55fe-4b8e-9dda-da2ed9932a63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8BBEE073\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b755e-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "7cc87ee9-55fe-4b8e-9dda-da2ed9932a63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1f/javablobrenewleaseacfail1blobapitestrenewleaseacfail82b23491a", + "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" : "8c3f0d54-2c9a-47e5-9336-1087b3d50c34", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8BC50C88\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b757b-d01e-009e-01e5-644931000000", + "x-ms-client-request-id" : "8c3f0d54-2c9a-47e5-9336-1087b3d50c34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1f/javablobrenewleaseacfail1blobapitestrenewleaseacfail82b23491a?comp=lease", + "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" : "26eec001-af8c-486f-949d-e8f9faf82b66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8BC50C88\"", + "x-ms-lease-id" : "fc884027-e463-432f-a736-b9d7015e015e", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b75bf-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "26eec001-af8c-486f-949d-e8f9faf82b66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1f/javablobrenewleaseacfail1blobapitestrenewleaseacfail82b23491a?comp=lease", + "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" : "35ee1f29-3c27-4185-82c2-55c080528eb6" + }, + "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" : "b92b75e6-d01e-009e-64e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b75e6-d01e-009e-64e5-644931000000\nTime:2019-09-06T19:00:55.5575758Z", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "35ee1f29-3c27-4185-82c2-55c080528eb6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b7ef87df-f64d-4009-86aa-9016e4ed3c06" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b7608-d01e-009e-02e5-644931000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1fFri, 06 Sep 2019 19:00:55 GMT\"0x8D732FC8BBEE073\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "b7ef87df-f64d-4009-86aa-9016e4ed3c06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1f?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" : "2da82435-39be-4dcb-9dce-76f39472db77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7625-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "2da82435-39be-4dcb-9dce-76f39472db77" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail82b969488f1f", "javablobrenewleaseacfail1blobapitestrenewleaseacfail82b23491a" ] +} \ 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..02123567eb2b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7?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" : "2a541ece-0e7b-4b4b-b089-1189098c53ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8BEBA012\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7663-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "2a541ece-0e7b-4b4b-b089-1189098c53ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7/javablobrenewleaseacfail1blobapitestrenewleaseacfail95274090c", + "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" : "439c7478-f2cb-4ebe-bdc8-556df951c953", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8BF3053C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b769c-d01e-009e-01e5-644931000000", + "x-ms-client-request-id" : "439c7478-f2cb-4ebe-bdc8-556df951c953" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7/javablobrenewleaseacfail1blobapitestrenewleaseacfail95274090c", + "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" : "6014dae0-1590-413c-b184-884423d6c2e9" + }, + "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" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC8BF3053C\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:55 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b776a-d01e-009e-3fe5-644931000000", + "x-ms-client-request-id" : "6014dae0-1590-413c-b184-884423d6c2e9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7/javablobrenewleaseacfail1blobapitestrenewleaseacfail95274090c?comp=lease", + "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" : "9f7423dd-b6f3-4b79-9966-208d8616155a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8BF3053C\"", + "x-ms-lease-id" : "d05d955d-2250-4dc1-a3a1-a43ccabbf18b", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b7795-d01e-009e-65e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "9f7423dd-b6f3-4b79-9966-208d8616155a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7/javablobrenewleaseacfail1blobapitestrenewleaseacfail95274090c?comp=lease", + "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" : "d7fdd9de-c0e4-43c8-af86-b234a9dee82e" + }, + "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" : "b92b77b2-d01e-009e-01e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b77b2-d01e-009e-01e5-644931000000\nTime:2019-09-06T19:00:56.0149873Z", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "d7fdd9de-c0e4-43c8-af86-b234a9dee82e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4739430e-5c21-4889-ac2d-c8ceef4f5747" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b77d7-d01e-009e-25e5-644931000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7Fri, 06 Sep 2019 19:00:55 GMT\"0x8D732FC8BEBA012\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "4739430e-5c21-4889-ac2d-c8ceef4f5747", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7?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" : "e7944b2d-722d-417e-af40-c45e8da80b75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b781a-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "e7944b2d-722d-417e-af40-c45e8da80b75" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail95228235f7a7", "javablobrenewleaseacfail1blobapitestrenewleaseacfail95274090c" ] +} \ 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..ec9102808420 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorc25236438e0a0?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" : "b01b5c6e-07cd-42aa-93d4-a84bf08fbe76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8C353D37\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b785e-d01e-009e-1be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "b01b5c6e-07cd-42aa-93d4-a84bf08fbe76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorc25236438e0a0/javablobrenewleaseerror1blobapitestrenewleaseerrorc256883609", + "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" : "00af3402-8542-4ad6-9ce1-7d8780906a45", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8C3C0685\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b7892-d01e-009e-49e5-644931000000", + "x-ms-client-request-id" : "00af3402-8542-4ad6-9ce1-7d8780906a45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorc25236438e0a0/javablobrenewleaseerror2blobapitestrenewleaseerrorc254227188?comp=lease", + "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" : "5e06ee58-e584-4105-9cf1-cd37ab4a7711" + }, + "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" : "b92b78d9-d01e-009e-08e5-644931000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b92b78d9-d01e-009e-08e5-644931000000\nTime:2019-09-06T19:00:56.2652130Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:00:55 GMT", + "x-ms-client-request-id" : "5e06ee58-e584-4105-9cf1-cd37ab4a7711", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d61a0696-9678-4f61-9d02-aede35056a71" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b78fa-d01e-009e-26e5-644931000000", + "Body" : "jtcrenewleaseerrorjtcrenewleaseerror0blobapitestrenewleaseerrorc25236438e0a0Fri, 06 Sep 2019 19:00:56 GMT\"0x8D732FC8C353D37\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "d61a0696-9678-4f61-9d02-aede35056a71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorc25236438e0a0?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" : "fc664698-94db-49e4-bd30-09fd1104d76c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b7922-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:56 GMT", + "x-ms-client-request-id" : "fc664698-94db-49e4-bd30-09fd1104d76c" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseerror0blobapitestrenewleaseerrorc25236438e0a0", "javablobrenewleaseerror1blobapitestrenewleaseerrorc256883609", "javablobrenewleaseerror2blobapitestrenewleaseerrorc254227188" ] +} \ 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..7d37020cd8f0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2?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" : "e2802e17-8ad4-45c6-9409-1ff721ad7223" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8A826E61\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b6dc1-d01e-009e-5ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "e2802e17-8ad4-45c6-9409-1ff721ad7223" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2/javablobrenewleasemin1blobapitestrenewleasemin53681149cf0f", + "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" : "2a8f3e65-f8f9-452d-97df-4fb5ab1369ac", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC8A8C1B20\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b6e12-d01e-009e-1fe5-644931000000", + "x-ms-client-request-id" : "2a8f3e65-f8f9-452d-97df-4fb5ab1369ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2/javablobrenewleasemin1blobapitestrenewleasemin53681149cf0f?comp=lease", + "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" : "a1ef86b2-92b7-454f-917f-bc12ae0b91d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8A8C1B20\"", + "x-ms-lease-id" : "00dc4f19-6d5d-4de9-a037-78b6a5756dac", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b6e2f-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "a1ef86b2-92b7-454f-917f-bc12ae0b91d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2/javablobrenewleasemin1blobapitestrenewleasemin53681149cf0f?comp=lease", + "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" : "b262b361-000d-45b1-aa56-038bb68a5540" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC8A8C1B20\"", + "x-ms-lease-id" : "00dc4f19-6d5d-4de9-a037-78b6a5756dac", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6e49-d01e-009e-52e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "b262b361-000d-45b1-aa56-038bb68a5540" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "138c9984-e294-4614-b238-823f628e4059" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b6e61-d01e-009e-68e5-644931000000", + "Body" : "jtcrenewleaseminjtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2Fri, 06 Sep 2019 19:00:53 GMT\"0x8D732FC8A826E61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "138c9984-e294-4614-b238-823f628e4059", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2?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" : "b880170f-c51a-4f22-921d-8664c1de9f65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b6e7e-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:53 GMT", + "x-ms-client-request-id" : "b880170f-c51a-4f22-921d-8664c1de9f65" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleasemin0blobapitestrenewleasemin536235244d8aad2", "javablobrenewleasemin1blobapitestrenewleasemin53681149cf0f" ] +} \ 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..bceed31dc3e4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac99724670e707?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" : "21e3887b-f455-4091-a3af-b951e80dbe1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7951F755\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b026f-d01e-009e-03e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "21e3887b-f455-4091-a3af-b951e80dbe1d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac99724670e707/javablobsethttpheadersac1blobapitestsethttpheadersac997458567", + "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" : "2a2e2caf-dd87-4250-b95c-5219df7bb6ee", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC795788F7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b02a7-d01e-009e-33e5-644931000000", + "x-ms-client-request-id" : "2a2e2caf-dd87-4250-b95c-5219df7bb6ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac99724670e707/javablobsethttpheadersac1blobapitestsethttpheadersac997458567?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" : "275aefeb-d397-446c-bcc3-efa34b4d7098" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC795DA4E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b02c9-d01e-009e-52e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "275aefeb-d397-446c-bcc3-efa34b4d7098" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6f4badfd-0a7b-4a56-9ad6-554a9ee2370c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b02f9-d01e-009e-7ee5-644931000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac99724670e707Fri, 06 Sep 2019 19:00:24 GMT\"0x8D732FC7951F755\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "6f4badfd-0a7b-4a56-9ad6-554a9ee2370c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac99724670e707?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" : "bdbf75fc-861c-4226-9f49-9ab6dab33678" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0328-d01e-009e-26e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "bdbf75fc-861c-4226-9f49-9ab6dab33678" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac99724670e707", "javablobsethttpheadersac1blobapitestsethttpheadersac997458567" ] +} \ 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..a2a6b856f7a3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf13351386447?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" : "4d725794-8bda-4b40-b1fa-122a72690599" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79856F39\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b03e6-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "4d725794-8bda-4b40-b1fa-122a72690599" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf13351386447/javablobsethttpheadersac1blobapitestsethttpheadersacf1395717c", + "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" : "c19a56ca-16d3-4b2e-ac80-a782374b5d57", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC798CFD85\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b0409-d01e-009e-68e5-644931000000", + "x-ms-client-request-id" : "c19a56ca-16d3-4b2e-ac80-a782374b5d57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf13351386447/javablobsethttpheadersac1blobapitestsethttpheadersacf1395717c?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" : "98b3c04f-c7a1-48a4-886f-82bcd3619c1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79942B27\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0441-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "98b3c04f-c7a1-48a4-886f-82bcd3619c1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e49f27c9-dc95-4397-b13d-e7d7f061448b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0469-d01e-009e-3ae5-644931000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacf13351386447Fri, 06 Sep 2019 19:00:24 GMT\"0x8D732FC79856F39\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "e49f27c9-dc95-4397-b13d-e7d7f061448b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf13351386447?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" : "4a726077-3cab-4e57-b120-94cf3132b6f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0481-d01e-009e-50e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "4a726077-3cab-4e57-b120-94cf3132b6f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacf13351386447", "javablobsethttpheadersac1blobapitestsethttpheadersacf1395717c" ] +} \ 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..c63a9d3bef10 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc38223488ff1?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" : "722c8615-8f0d-4b89-ae74-5c516b18ac82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79A6452D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b04a8-d01e-009e-74e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "722c8615-8f0d-4b89-ae74-5c516b18ac82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc38223488ff1/javablobsethttpheadersac1blobapitestsethttpheadersacc38712464", + "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" : "b56ac195-84f0-41dd-a7a0-01f2bab09fb8", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC79ACC215\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b04d4-d01e-009e-1de5-644931000000", + "x-ms-client-request-id" : "b56ac195-84f0-41dd-a7a0-01f2bab09fb8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc38223488ff1/javablobsethttpheadersac1blobapitestsethttpheadersacc38712464?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" : "f492621f-8891-4e9e-9477-fc6010704b4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79B3051F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b04ff-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "f492621f-8891-4e9e-9477-fc6010704b4c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1d27e342-020e-4363-aeaa-c696d20083f7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0527-d01e-009e-69e5-644931000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacc38223488ff1Fri, 06 Sep 2019 19:00:25 GMT\"0x8D732FC79A6452D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "1d27e342-020e-4363-aeaa-c696d20083f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc38223488ff1?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" : "0a6be123-5962-4366-b9b6-8989e1517402" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0543-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "0a6be123-5962-4366-b9b6-8989e1517402" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacc38223488ff1", "javablobsethttpheadersac1blobapitestsethttpheadersacc38712464" ] +} \ 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..79a0ddeba41b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ff?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" : "e2a7f0d3-06c3-41ff-baa9-2e27aa1db7da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79C657A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0575-d01e-009e-31e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "e2a7f0d3-06c3-41ff-baa9-2e27aa1db7da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ff/javablobsethttpheadersac1blobapitestsethttpheadersac79d022860", + "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" : "a3272378-b927-4713-8a88-65c5401166f8", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC79D58971\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b05ea-d01e-009e-18e5-644931000000", + "x-ms-client-request-id" : "a3272378-b927-4713-8a88-65c5401166f8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ff/javablobsethttpheadersac1blobapitestsethttpheadersac79d022860", + "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" : "a691add5-e013-427f-b6a7-a837b4344743" + }, + "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" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC79D58971\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b0605-d01e-009e-30e5-644931000000", + "x-ms-client-request-id" : "a691add5-e013-427f-b6a7-a837b4344743", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ff/javablobsethttpheadersac1blobapitestsethttpheadersac79d022860?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" : "b72db211-5efb-4f9c-9f48-4496629928da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79DFEC29\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0629-d01e-009e-4ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "b72db211-5efb-4f9c-9f48-4496629928da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "22b719be-43b5-41f7-acc1-5e685ca7fecb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0654-d01e-009e-77e5-644931000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ffFri, 06 Sep 2019 19:00:25 GMT\"0x8D732FC79C657A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "22b719be-43b5-41f7-acc1-5e685ca7fecb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ff?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" : "a58e0b2a-f8c3-4e45-83d9-203b151e129e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b066c-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "a58e0b2a-f8c3-4e45-83d9-203b151e129e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac79d2853050ff", "javablobsethttpheadersac1blobapitestsethttpheadersac79d022860" ] +} \ 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..110cc8704da3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacce5471428d4c?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" : "c0fc5e66-dad9-4497-a6f5-518bfadf6ec7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79F253D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b069a-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "c0fc5e66-dad9-4497-a6f5-518bfadf6ec7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacce5471428d4c/javablobsethttpheadersac1blobapitestsethttpheadersacce5683754", + "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" : "b3436673-5e66-4d7d-acb6-215f12e2323b", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7A23BC04\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b07a9-d01e-009e-2ae5-644931000000", + "x-ms-client-request-id" : "b3436673-5e66-4d7d-acb6-215f12e2323b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacce5471428d4c/javablobsethttpheadersac1blobapitestsethttpheadersacce5683754?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" : "1e06ae13-0af9-45da-9708-b0477485469f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7A2D0D0C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b07df-d01e-009e-56e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "1e06ae13-0af9-45da-9708-b0477485469f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5bf502b0-7c1c-422b-9c08-020cdeaac3f2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b084f-d01e-009e-3ae5-644931000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacce5471428d4cFri, 06 Sep 2019 19:00:25 GMT\"0x8D732FC79F253D3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "5bf502b0-7c1c-422b-9c08-020cdeaac3f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacce5471428d4c?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" : "c5fd9917-c46d-411c-bddc-e2ca5f924e6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0871-d01e-009e-5ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "c5fd9917-c46d-411c-bddc-e2ca5f924e6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacce5471428d4c", "javablobsethttpheadersac1blobapitestsethttpheadersacce5683754" ] +} \ 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..94196cdf86d8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4b?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" : "812e8466-325f-4c01-b6cf-b300f635211f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7A4AE883\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b08b2-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "x-ms-client-request-id" : "812e8466-325f-4c01-b6cf-b300f635211f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4b/javablobsethttpheadersac1blobapitestsethttpheadersacc44644243", + "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" : "13b3f8e1-b055-4134-95c2-acb61c3c9187", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7A5202F4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b08e6-d01e-009e-40e5-644931000000", + "x-ms-client-request-id" : "13b3f8e1-b055-4134-95c2-acb61c3c9187" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4b/javablobsethttpheadersac1blobapitestsethttpheadersacc44644243?comp=lease", + "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" : "c69bb375-035d-481d-a9de-1b90d7f2c830" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7A5202F4\"", + "x-ms-lease-id" : "3c55af7d-746e-4942-876e-679e0460d8ec", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0957-d01e-009e-20e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "c69bb375-035d-481d-a9de-1b90d7f2c830" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4b/javablobsethttpheadersac1blobapitestsethttpheadersacc44644243?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" : "a2090ade-dd04-489b-b3dc-3a509bcfb324" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7A64CC13\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0986-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "a2090ade-dd04-489b-b3dc-3a509bcfb324" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b434f8eb-25b1-4e1a-932b-419e315e89da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b09a9-d01e-009e-67e5-644931000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4bFri, 06 Sep 2019 19:00:26 GMT\"0x8D732FC7A4AE883\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "b434f8eb-25b1-4e1a-932b-419e315e89da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4b?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" : "d5ebffc5-6345-4073-ab00-0763aefbd5eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b09cc-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "d5ebffc5-6345-4073-ab00-0763aefbd5eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacc4458937fd4b", "javablobsethttpheadersac1blobapitestsethttpheadersacc44644243" ] +} \ 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..7d153a1d4074 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0048058b82dc82c9004d25a?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" : "bda06ea4-6089-4193-92c6-98d28c02c4ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7A762129\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b09f7-d01e-009e-2de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "bda06ea4-6089-4193-92c6-98d28c02c4ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0048058b82dc82c9004d25a/javablobsethttpheadersacfail1705936d2606c8047144", + "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" : "4e75def2-3a71-4d61-a5ac-aabdd3c94244", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7A7CEDAE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b0a31-d01e-009e-5fe5-644931000000", + "x-ms-client-request-id" : "4e75def2-3a71-4d61-a5ac-aabdd3c94244" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0048058b82dc82c9004d25a/javablobsethttpheadersacfail1705936d2606c8047144?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" : "ec904199-47b7-4464-b502-c00e24dc6c7f" + }, + "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" : "b92b0a65-d01e-009e-0fe5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b0a65-d01e-009e-0fe5-644931000000\nTime:2019-09-06T19:00:26.4764762Z", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "ec904199-47b7-4464-b502-c00e24dc6c7f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "46ee414e-4f50-40a5-b32b-57de26e28d57" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0a84-d01e-009e-2ce5-644931000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0048058b82dc82c9004d25aFri, 06 Sep 2019 19:00:26 GMT\"0x8D732FC7A762129\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "46ee414e-4f50-40a5-b32b-57de26e28d57", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0048058b82dc82c9004d25a?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" : "5a1db33b-e961-4958-9aea-65b56c79239d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0aa2-d01e-009e-47e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "5a1db33b-e961-4958-9aea-65b56c79239d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0048058b82dc82c9004d25a", "javablobsethttpheadersacfail1705936d2606c8047144" ] +} \ 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..19f3cae14081 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0267984b3cd4dfc4fd4b2aa?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" : "cf8f12e4-015f-41ba-9983-de3e2668a220" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7A943761\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0ad4-d01e-009e-75e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "cf8f12e4-015f-41ba-9983-de3e2668a220" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0267984b3cd4dfc4fd4b2aa/javablobsethttpheadersacfail137588d378879e10244c", + "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" : "571d6e9d-ceac-4f0d-bbd2-ec0560de2765", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7A9C15DD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b0aff-d01e-009e-1de5-644931000000", + "x-ms-client-request-id" : "571d6e9d-ceac-4f0d-bbd2-ec0560de2765" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0267984b3cd4dfc4fd4b2aa/javablobsethttpheadersacfail137588d378879e10244c?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" : "c41ad8d3-9403-49c4-ab8a-3fc5710465ac" + }, + "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" : "b92b0b37-d01e-009e-4be5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b0b37-d01e-009e-4be5-644931000000\nTime:2019-09-06T19:00:26.6876651Z", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "c41ad8d3-9403-49c4-ab8a-3fc5710465ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "af2587c0-80de-4fcd-a47c-5ee04ede5fcf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0b63-d01e-009e-73e5-644931000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0267984b3cd4dfc4fd4b2aaFri, 06 Sep 2019 19:00:26 GMT\"0x8D732FC7A943761\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "af2587c0-80de-4fcd-a47c-5ee04ede5fcf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0267984b3cd4dfc4fd4b2aa?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" : "32ad1be6-b07f-4c7f-acd3-210399e875e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0b8c-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "32ad1be6-b07f-4c7f-acd3-210399e875e4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0267984b3cd4dfc4fd4b2aa", "javablobsethttpheadersacfail137588d378879e10244c" ] +} \ 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..35ac8e2d3855 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail00909206088415971348d1b?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" : "bc371827-db92-474b-89a8-a923e0a90515" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7ABE5E47\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0bc9-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "bc371827-db92-474b-89a8-a923e0a90515" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail00909206088415971348d1b/javablobsethttpheadersacfail161348d703967bc4a040", + "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" : "d4aebee8-2356-41db-9ef1-ad20b2b5fefe", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7AD97B92\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b0cd0-d01e-009e-3ee5-644931000000", + "x-ms-client-request-id" : "d4aebee8-2356-41db-9ef1-ad20b2b5fefe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail00909206088415971348d1b/javablobsethttpheadersacfail161348d703967bc4a040?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" : "aa39e07f-8acf-4fcc-a9b3-4da655ddc66f" + }, + "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" : "b92b0d00-d01e-009e-6be5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b0d00-d01e-009e-6be5-644931000000\nTime:2019-09-06T19:00:27.0800165Z", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "aa39e07f-8acf-4fcc-a9b3-4da655ddc66f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c0f6c1f-79e8-4a0d-b65e-0c14f313520a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0d1c-d01e-009e-06e5-644931000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail00909206088415971348d1bFri, 06 Sep 2019 19:00:26 GMT\"0x8D732FC7ABE5E47\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "7c0f6c1f-79e8-4a0d-b65e-0c14f313520a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail00909206088415971348d1b?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" : "106edfa6-7876-410e-9f1e-0038e7737356" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0d41-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "106edfa6-7876-410e-9f1e-0038e7737356" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail00909206088415971348d1b", "javablobsethttpheadersacfail161348d703967bc4a040" ] +} \ 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..710ca71b89b7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0306655659a2cba2e44dc3a?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" : "87593ba4-9d50-4755-b399-cd107efb1473" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7AF0764C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0d71-d01e-009e-52e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:26 GMT", + "x-ms-client-request-id" : "87593ba4-9d50-4755-b399-cd107efb1473" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0306655659a2cba2e44dc3a/javablobsethttpheadersacfail11070221240cfa42c54d", + "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" : "770e4154-c161-4f81-9850-2b08dfb484e3", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7AF6CE80\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b0d99-d01e-009e-78e5-644931000000", + "x-ms-client-request-id" : "770e4154-c161-4f81-9850-2b08dfb484e3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0306655659a2cba2e44dc3a/javablobsethttpheadersacfail11070221240cfa42c54d", + "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" : "cb069998-4b93-4cfc-9dc4-377de4843088" + }, + "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" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:27 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" : "\"0x8D732FC7AF6CE80\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b0ddb-d01e-009e-37e5-644931000000", + "x-ms-client-request-id" : "cb069998-4b93-4cfc-9dc4-377de4843088", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0306655659a2cba2e44dc3a/javablobsethttpheadersacfail11070221240cfa42c54d?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" : "6bf726dc-4ece-40dc-9dcc-50dee7dc1a19" + }, + "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" : "b92b0e1a-d01e-009e-70e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b0e1a-d01e-009e-70e5-644931000000\nTime:2019-09-06T19:00:27.3332435Z", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "6bf726dc-4ece-40dc-9dcc-50dee7dc1a19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d1a5e3e-d5d3-4948-83eb-f4bef143d376" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0e4b-d01e-009e-1de5-644931000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0306655659a2cba2e44dc3aFri, 06 Sep 2019 19:00:27 GMT\"0x8D732FC7AF0764C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "9d1a5e3e-d5d3-4948-83eb-f4bef143d376", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0306655659a2cba2e44dc3a?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" : "191fb4f0-9c80-43a1-9b39-ad5af33e2eb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0e79-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "191fb4f0-9c80-43a1-9b39-ad5af33e2eb6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0306655659a2cba2e44dc3a", "javablobsethttpheadersacfail11070221240cfa42c54d" ] +} \ 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..b77f87125d63 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail009922447933b8017948afb?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" : "ea8a4de6-a26c-4231-bbeb-d8b93cb9c6fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B180482\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0eae-d01e-009e-78e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "ea8a4de6-a26c-4231-bbeb-d8b93cb9c6fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail009922447933b8017948afb/javablobsethttpheadersacfail1326998891cb1958a842", + "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" : "d2a3fdc2-7c7e-46e3-aa29-0b7b242046d5", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7B1E3605\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b0eeb-d01e-009e-2ee5-644931000000", + "x-ms-client-request-id" : "d2a3fdc2-7c7e-46e3-aa29-0b7b242046d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail009922447933b8017948afb/javablobsethttpheadersacfail1326998891cb1958a842?comp=lease", + "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" : "e4671a83-6dad-475c-850e-666b826798b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B1E3605\"", + "x-ms-lease-id" : "cb24e97a-da9f-4eaf-b8ed-7f2976be1309", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0f43-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "e4671a83-6dad-475c-850e-666b826798b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail009922447933b8017948afb/javablobsethttpheadersacfail1326998891cb1958a842?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" : "248eb779-58df-4cda-acff-c6f8a91b7a4d" + }, + "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" : "b92b0f7e-d01e-009e-34e5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92b0f7e-d01e-009e-34e5-644931000000\nTime:2019-09-06T19:00:27.6104911Z", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "248eb779-58df-4cda-acff-c6f8a91b7a4d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c0febbea-740b-4c22-a426-e2724658c8b8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0f9b-d01e-009e-4ce5-644931000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail009922447933b8017948afbFri, 06 Sep 2019 19:00:27 GMT\"0x8D732FC7B180482\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "c0febbea-740b-4c22-a426-e2724658c8b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail009922447933b8017948afb?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" : "38b9392d-9233-49d3-bd5d-f7fe6d9370ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0fc3-d01e-009e-6be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "38b9392d-9233-49d3-bd5d-f7fe6d9370ff" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail009922447933b8017948afb", "javablobsethttpheadersacfail1326998891cb1958a842" ] +} \ 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..0647c82bea50 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrord72980240?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" : "c0ee8879-9a34-4619-9277-7cbcdc9393b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B436439\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0ff1-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "c0ee8879-9a34-4619-9277-7cbcdc9393b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrord72980240/javablobsethttpheaderserror12871327d8ac063e49462", + "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" : "4ac68ca0-3374-43cd-901d-4db5f40f7c61", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7B496EFF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b100d-d01e-009e-30e5-644931000000", + "x-ms-client-request-id" : "4ac68ca0-3374-43cd-901d-4db5f40f7c61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrord72980240/javablobsethttpheaderserror2044832b07ea5808fd417?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" : "fb409314-c982-40f6-9dda-612c6d827140" + }, + "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" : "b92b1041-d01e-009e-57e5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92b1041-d01e-009e-57e5-644931000000\nTime:2019-09-06T19:00:27.8136738Z", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "fb409314-c982-40f6-9dda-612c6d827140", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d761c29-d632-4be4-aef8-c533ff836615" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b106d-d01e-009e-7ee5-644931000000", + "Body" : "jtcsethttpheaderserrorjtcsethttpheaderserror0blobapitestsethttpheaderserrord72980240Fri, 06 Sep 2019 19:00:27 GMT\"0x8D732FC7B436439\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "9d761c29-d632-4be4-aef8-c533ff836615", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrord72980240?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" : "7e0e59e5-7f34-4233-acb9-b41454f3d39d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b108c-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "7e0e59e5-7f34-4233-acb9-b41454f3d39d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheaderserror0blobapitestsethttpheaderserrord72980240", "javablobsethttpheaderserror12871327d8ac063e49462", "javablobsethttpheaderserror2044832b07ea5808fd417" ] +} \ 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..637ba9bfa191 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders005190e9d9efe94f8543e8?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" : "267f5bcf-1302-431a-9945-ef8e11c70b27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC78F011D5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b002c-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "267f5bcf-1302-431a-9945-ef8e11c70b27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders005190e9d9efe94f8543e8/javablobsethttpheadersheaders153325f8973219235540", + "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" : "65d9df29-824a-4bc7-bb36-c55b08f7e72f", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC78F63F0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b004d-d01e-009e-33e5-644931000000", + "x-ms-client-request-id" : "65d9df29-824a-4bc7-bb36-c55b08f7e72f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders005190e9d9efe94f8543e8/javablobsethttpheadersheaders153325f8973219235540?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" : "ff447376-9b95-4290-837a-4b740125a195" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC78FBBE94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0061-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "ff447376-9b95-4290-837a-4b740125a195" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders005190e9d9efe94f8543e8/javablobsethttpheadersheaders153325f8973219235540", + "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" : "fa17b6a8-5c0c-4a5e-8a24-15cc31741f41" + }, + "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" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC78FBBE94\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b007c-d01e-009e-5be5-644931000000", + "x-ms-client-request-id" : "fa17b6a8-5c0c-4a5e-8a24-15cc31741f41" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7309d727-8cd7-4837-bbeb-0407729811f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b009b-d01e-009e-74e5-644931000000", + "Body" : "jtcsethttpheadersheadersjtcsethttpheadersheaders005190e9d9efe94f8543e8Fri, 06 Sep 2019 19:00:23 GMT\"0x8D732FC78F011D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "7309d727-8cd7-4837-bbeb-0407729811f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders005190e9d9efe94f8543e8?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" : "eec0ae96-6ad1-4d40-8c70-ada80f8e0735" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b00bc-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "eec0ae96-6ad1-4d40-8c70-ada80f8e0735" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersheaders005190e9d9efe94f8543e8", "javablobsethttpheadersheaders153325f8973219235540" ] +} \ 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..a88a73e0ac7c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0890900862d5c6d7fe4957?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" : "7c15336b-461d-476a-9203-2434d64c5b64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7918B1CA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b0118-d01e-009e-60e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "7c15336b-461d-476a-9203-2434d64c5b64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0890900862d5c6d7fe4957/javablobsethttpheadersheaders1408682c816554aac545", + "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" : "76abd352-dd5f-48aa-88d1-fda0d25a005b", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC791F549E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b014d-d01e-009e-0de5-644931000000", + "x-ms-client-request-id" : "76abd352-dd5f-48aa-88d1-fda0d25a005b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0890900862d5c6d7fe4957/javablobsethttpheadersheaders1408682c816554aac545?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" : "202acef4-da1d-4f1e-9b09-b54e6d299ca3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC79254976\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b0163-d01e-009e-20e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "202acef4-da1d-4f1e-9b09-b54e6d299ca3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0890900862d5c6d7fe4957/javablobsethttpheadersheaders1408682c816554aac545", + "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" : "8e6ae304-6cce-4663-82a1-687fbbc431b3" + }, + "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" : "Fri, 06 Sep 2019 19:00:24 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" : "Fri, 06 Sep 2019 19:00:24 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b0212-d01e-009e-33e5-644931000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D732FC79254976\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "8e6ae304-6cce-4663-82a1-687fbbc431b3", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9c9446e4-f6d5-4183-89d9-f7c01070c18b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b022d-d01e-009e-4be5-644931000000", + "Body" : "jtcsethttpheadersheadersjtcsethttpheadersheaders0890900862d5c6d7fe4957Fri, 06 Sep 2019 19:00:24 GMT\"0x8D732FC7918B1CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "9c9446e4-f6d5-4183-89d9-f7c01070c18b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0890900862d5c6d7fe4957?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" : "504df711-3429-4662-8e27-19720528134c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0246-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:24 GMT", + "x-ms-client-request-id" : "504df711-3429-4662-8e27-19720528134c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersheaders0890900862d5c6d7fe4957", "javablobsethttpheadersheaders1408682c816554aac545" ] +} \ 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..c0802ec29f28 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1?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" : "f7ebcaa4-93ef-40f3-ac77-5676a3bc681b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC78C5EAF9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92aff3f-d01e-009e-4ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "f7ebcaa4-93ef-40f3-ac77-5676a3bc681b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1/javablobsethttpheadersmin1blobapitestsethttpheadersmin3db86729", + "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" : "e84787f2-2e4c-4bd2-b68a-81c7818d37f4", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC78CC6608\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92aff61-d01e-009e-69e5-644931000000", + "x-ms-client-request-id" : "e84787f2-2e4c-4bd2-b68a-81c7818d37f4" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1/javablobsethttpheadersmin1blobapitestsethttpheadersmin3db86729", + "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" : "b7bad4b6-0176-4f98-9fa9-62d98285688a" + }, + "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" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC78CC6608\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92aff96-d01e-009e-17e5-644931000000", + "x-ms-client-request-id" : "b7bad4b6-0176-4f98-9fa9-62d98285688a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1/javablobsethttpheadersmin1blobapitestsethttpheadersmin3db86729?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" : "c54e4d18-1ecd-49d6-a4d1-c9d2281769e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC78D9D6AB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92affb4-d01e-009e-31e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "c54e4d18-1ecd-49d6-a4d1-c9d2281769e6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1/javablobsethttpheadersmin1blobapitestsethttpheadersmin3db86729", + "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" : "fd226db8-34d2-4488-bf10-550f77466ec2" + }, + "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" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:23 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" : "\"0x8D732FC78D9D6AB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92affd2-d01e-009e-49e5-644931000000", + "Body" : "", + "x-ms-client-request-id" : "fd226db8-34d2-4488-bf10-550f77466ec2", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1d22d385-577a-4b46-8187-486fc750bf0d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92affed-d01e-009e-61e5-644931000000", + "Body" : "jtcsethttpheadersminjtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1Fri, 06 Sep 2019 19:00:23 GMT\"0x8D732FC78C5EAF9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "1d22d385-577a-4b46-8187-486fc750bf0d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1?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" : "96787bf8-7164-42a3-a63d-b201064d407f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b0008-d01e-009e-7ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "96787bf8-7164-42a3-a63d-b201064d407f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersmin0blobapitestsethttpheadersmin3db346343d1", "javablobsethttpheadersmin1blobapitestsethttpheadersmin3db86729" ] +} \ 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..3574fbcef15d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnulle509246063?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" : "09c50aab-582e-4f75-a100-76e85e0bda02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC78A49FA9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92afe7f-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "09c50aab-582e-4f75-a100-76e85e0bda02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnulle509246063/javablobsethttpheadersnull1539120aeeea8dc33b4cd", + "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" : "3d606787-f1b8-493d-b59e-6df446e57058", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC78AC2C20\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92afea5-d01e-009e-48e5-644931000000", + "x-ms-client-request-id" : "3d606787-f1b8-493d-b59e-6df446e57058" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnulle509246063/javablobsethttpheadersnull1539120aeeea8dc33b4cd?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" : "8417176f-3ade-4178-ae56-f674f6d24b64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC78B4445A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92afed9-d01e-009e-76e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "8417176f-3ade-4178-ae56-f674f6d24b64" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f0e69031-f094-499f-a763-121adca6c2ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92afefa-d01e-009e-13e5-644931000000", + "Body" : "jtcsethttpheadersnulljtcsethttpheadersnull0blobapitestsethttpheadersnulle509246063Fri, 06 Sep 2019 19:00:23 GMT\"0x8D732FC78A49FA9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "f0e69031-f094-499f-a763-121adca6c2ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnulle509246063?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" : "1d95588a-7d68-49c2-a255-efb06c7b6564" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92aff17-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:23 GMT", + "x-ms-client-request-id" : "1d95588a-7d68-49c2-a255-efb06c7b6564" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersnull0blobapitestsethttpheadersnulle509246063", "javablobsethttpheadersnull1539120aeeea8dc33b4cd" ] +} \ 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..484d3774110a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6955514216416b0?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" : "caa23e42-4d1e-4e13-a866-4db8d7caacfc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7BF74D42\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b14f3-d01e-009e-0be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "caa23e42-4d1e-4e13-a866-4db8d7caacfc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6955514216416b0/javablobsetmetadataac1blobapitestsetmetadataac69539917e8c4", + "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" : "abed4dd6-e4d4-4334-8315-f4acc5864c14", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7BFE1CD1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b151b-d01e-009e-2de5-644931000000", + "x-ms-client-request-id" : "abed4dd6-e4d4-4334-8315-f4acc5864c14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6955514216416b0/javablobsetmetadataac1blobapitestsetmetadataac69539917e8c4?comp=metadata", + "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" : "b428b3cc-bbf4-4022-9d03-1463b9615475" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7C04AE13\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b154a-d01e-009e-57e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "b428b3cc-bbf4-4022-9d03-1463b9615475" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ed802958-ed6e-44c9-be0b-ccda8a1724a5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b156e-d01e-009e-79e5-644931000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac6955514216416b0Fri, 06 Sep 2019 19:00:28 GMT\"0x8D732FC7BF74D42\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "ed802958-ed6e-44c9-be0b-ccda8a1724a5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6955514216416b0?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" : "271787dc-405e-4c57-bb45-2b0f38df5ece" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b1598-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "271787dc-405e-4c57-bb45-2b0f38df5ece" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac6955514216416b0", "javablobsetmetadataac1blobapitestsetmetadataac69539917e8c4" ] +} \ 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..609e1cf2e9b3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6bd678200006c00?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" : "8a51eb47-0135-4e96-bd13-bbcb3469635e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7C20D7D5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b15fe-d01e-009e-77e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "8a51eb47-0135-4e96-bd13-bbcb3469635e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6bd678200006c00/javablobsetmetadataac1blobapitestsetmetadataac6bd73376bd5a", + "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" : "ae437b70-a104-43a1-8380-973f254b3f7b", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7C281CF8\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b163d-d01e-009e-2ae5-644931000000", + "x-ms-client-request-id" : "ae437b70-a104-43a1-8380-973f254b3f7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6bd678200006c00/javablobsetmetadataac1blobapitestsetmetadataac6bd73376bd5a?comp=metadata", + "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" : "63665a2d-ef65-411f-a166-9072b539a1c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7C2DEAB5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b165a-d01e-009e-43e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "63665a2d-ef65-411f-a166-9072b539a1c6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a170cecd-db5e-4c90-ad87-63a2b9ae692c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b16cb-d01e-009e-2ce5-644931000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac6bd678200006c00Fri, 06 Sep 2019 19:00:29 GMT\"0x8D732FC7C20D7D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "a170cecd-db5e-4c90-ad87-63a2b9ae692c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac6bd678200006c00?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" : "2b4f69f5-6aad-46c4-bb41-0336c6f48011" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b16eb-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "2b4f69f5-6aad-46c4-bb41-0336c6f48011" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac6bd678200006c00", "javablobsetmetadataac1blobapitestsetmetadataac6bd73376bd5a" ] +} \ 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..fb81e047f239 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac12933391a07a819?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" : "21e5c382-9336-428c-ab01-9153133b096f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7C567313\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1736-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "21e5c382-9336-428c-ab01-9153133b096f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac12933391a07a819/javablobsetmetadataac1blobapitestsetmetadataac12981507e7bc", + "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" : "0aa9188e-8774-4c09-bbd9-d0b2e989a459", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7C5E7C30\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b1766-d01e-009e-34e5-644931000000", + "x-ms-client-request-id" : "0aa9188e-8774-4c09-bbd9-d0b2e989a459" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac12933391a07a819/javablobsetmetadataac1blobapitestsetmetadataac12981507e7bc?comp=metadata", + "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" : "2a2d446e-7ed3-4160-8119-f476e617e15d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7C6A65DB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b179a-d01e-009e-62e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "2a2d446e-7ed3-4160-8119-f476e617e15d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c86323d-5d16-4668-b48d-39820d0cbbbf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b18cd-d01e-009e-7ce5-644931000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac12933391a07a819Fri, 06 Sep 2019 19:00:29 GMT\"0x8D732FC7C567313\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "7c86323d-5d16-4668-b48d-39820d0cbbbf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac12933391a07a819?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" : "67a1c75d-76c6-494e-bb7d-edc3feb6345f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b18e7-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "67a1c75d-76c6-494e-bb7d-edc3feb6345f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac12933391a07a819", "javablobsetmetadataac1blobapitestsetmetadataac12981507e7bc" ] +} \ 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..988a4db8633c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac41548893bbec2cc?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" : "70985900-dc9c-4dec-ab5f-40163bd7497a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7CADA7C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b191b-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "x-ms-client-request-id" : "70985900-dc9c-4dec-ab5f-40163bd7497a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac41548893bbec2cc/javablobsetmetadataac1blobapitestsetmetadataac41550617f72a", + "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" : "cb62ae5f-b63d-4076-bd20-41b42e58f501", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7CB451A4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b1942-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "cb62ae5f-b63d-4076-bd20-41b42e58f501" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac41548893bbec2cc/javablobsetmetadataac1blobapitestsetmetadataac41550617f72a", + "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" : "431f1250-87cc-43ff-a435-15b43f3a2e74" + }, + "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" : "Fri, 06 Sep 2019 19:00:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7CB451A4\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:30 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b1978-d01e-009e-18e5-644931000000", + "x-ms-client-request-id" : "431f1250-87cc-43ff-a435-15b43f3a2e74", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac41548893bbec2cc/javablobsetmetadataac1blobapitestsetmetadataac41550617f72a?comp=metadata", + "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" : "2f85c351-7955-46d8-9a20-43eed30a9028" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7CC32237\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b19a5-d01e-009e-43e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "2f85c351-7955-46d8-9a20-43eed30a9028" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "07e0459d-c169-4625-a90e-71f648bc707c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b19d8-d01e-009e-71e5-644931000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac41548893bbec2ccFri, 06 Sep 2019 19:00:30 GMT\"0x8D732FC7CADA7C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "07e0459d-c169-4625-a90e-71f648bc707c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac41548893bbec2cc?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" : "12ee701f-6ab8-4dd5-9459-5308bf6e1e50" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b19f5-d01e-009e-0de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "12ee701f-6ab8-4dd5-9459-5308bf6e1e50" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac41548893bbec2cc", "javablobsetmetadataac1blobapitestsetmetadataac41550617f72a" ] +} \ 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..b95f58263ea5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1c781024b2da1c6?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" : "2d4304d5-a694-4d03-8465-d2e75de3b02d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7D22F2AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1bfb-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "2d4304d5-a694-4d03-8465-d2e75de3b02d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1c781024b2da1c6/javablobsetmetadataac1blobapitestsetmetadataac1c791583f42d", + "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" : "5785841b-4fc9-42f5-a341-6db1354e5d1b", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7D29EBD1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b1c29-d01e-009e-0fe5-644931000000", + "x-ms-client-request-id" : "5785841b-4fc9-42f5-a341-6db1354e5d1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1c781024b2da1c6/javablobsetmetadataac1blobapitestsetmetadataac1c791583f42d?comp=metadata", + "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" : "38f76b79-7592-4efe-b1e7-a808ef3aa3b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7D2F6B5D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1c56-d01e-009e-33e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "38f76b79-7592-4efe-b1e7-a808ef3aa3b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "710a09c7-cbbe-4868-b6a1-8964faa80196" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1cb3-d01e-009e-0be5-644931000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac1c781024b2da1c6Fri, 06 Sep 2019 19:00:30 GMT\"0x8D732FC7D22F2AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "710a09c7-cbbe-4868-b6a1-8964faa80196", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1c781024b2da1c6?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" : "02370ec8-a537-4fc1-903a-f573bfca0a7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b1cf6-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "02370ec8-a537-4fc1-903a-f573bfca0a7f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac1c781024b2da1c6", "javablobsetmetadataac1blobapitestsetmetadataac1c791583f42d" ] +} \ 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..d7c4162e60a8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9?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" : "b937ce99-27f3-4da8-a0f1-333db9e29443" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7D4B4475\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1d23-d01e-009e-72e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "x-ms-client-request-id" : "b937ce99-27f3-4da8-a0f1-333db9e29443" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9/javablobsetmetadataac1blobapitestsetmetadataac1a87652829dc", + "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" : "7651b34b-dbc4-4c63-8069-ae0ab6f61ae1", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7D51EFBD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b1d4f-d01e-009e-17e5-644931000000", + "x-ms-client-request-id" : "7651b34b-dbc4-4c63-8069-ae0ab6f61ae1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9/javablobsetmetadataac1blobapitestsetmetadataac1a87652829dc?comp=lease", + "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" : "360cfdfb-d638-4991-aaaa-945be8374eb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7D51EFBD\"", + "x-ms-lease-id" : "29e86055-5ead-4ba8-be8b-c62f31663fd8", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1d81-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "360cfdfb-d638-4991-aaaa-945be8374eb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9/javablobsetmetadataac1blobapitestsetmetadataac1a87652829dc?comp=metadata", + "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" : "dfb43346-fc57-4d97-aab9-da908421b0f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7D6C82FC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1de6-d01e-009e-25e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "dfb43346-fc57-4d97-aab9-da908421b0f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f8148f6a-b7ca-4c51-b551-d2bada258cf9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1e05-d01e-009e-44e5-644931000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9Fri, 06 Sep 2019 19:00:31 GMT\"0x8D732FC7D4B4475\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "f8148f6a-b7ca-4c51-b551-d2bada258cf9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9?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" : "0eeaa045-19d4-427d-82ef-9f9ec8601034" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b1e1e-d01e-009e-5ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "0eeaa045-19d4-427d-82ef-9f9ec8601034" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac1a83473861644f9", "javablobsetmetadataac1blobapitestsetmetadataac1a87652829dc" ] +} \ 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..573187c58403 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail2ce40860c08?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" : "2281f4c2-cab5-425d-8358-8da2cd46a413" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7D85E9E9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1e52-d01e-009e-10e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "2281f4c2-cab5-425d-8358-8da2cd46a413" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail2ce40860c08/javablobsetmetadataacfail1blobapitestsetmetadataacfail2ce42602", + "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" : "bb3727e0-69f1-442d-af76-89e542069604", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7D9B3F39\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b1f0b-d01e-009e-35e5-644931000000", + "x-ms-client-request-id" : "bb3727e0-69f1-442d-af76-89e542069604" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail2ce40860c08/javablobsetmetadataacfail1blobapitestsetmetadataacfail2ce42602?comp=metadata", + "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" : "3fc241cb-0808-44f1-8592-60f7c4751670" + }, + "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" : "b92b1f3a-d01e-009e-61e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b1f3a-d01e-009e-61e5-644931000000\nTime:2019-09-06T19:00:31.7091719Z", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "3fc241cb-0808-44f1-8592-60f7c4751670", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "beb3e409-4783-4795-8c4e-9d22d04a8eca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1f61-d01e-009e-06e5-644931000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail2ce40860c08Fri, 06 Sep 2019 19:00:31 GMT\"0x8D732FC7D85E9E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "beb3e409-4783-4795-8c4e-9d22d04a8eca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail2ce40860c08?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" : "11721d07-7292-4e6c-ab14-7de2e64a2694" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b1f78-d01e-009e-1be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "11721d07-7292-4e6c-ab14-7de2e64a2694" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail2ce40860c08", "javablobsetmetadataacfail1blobapitestsetmetadataacfail2ce42602" ] +} \ 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..cbe606818019 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail73a41478220?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" : "fe25fff1-be6c-4d8c-b2d7-d07d928d9c91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7DB4A5D4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1fb5-d01e-009e-54e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "fe25fff1-be6c-4d8c-b2d7-d07d928d9c91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail73a41478220/javablobsetmetadataacfail1blobapitestsetmetadataacfail73a14622", + "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" : "8d6cf879-ac14-4500-a31d-60c838ca6678", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7DBBEE57\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b1fe4-d01e-009e-80e5-644931000000", + "x-ms-client-request-id" : "8d6cf879-ac14-4500-a31d-60c838ca6678" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail73a41478220/javablobsetmetadataacfail1blobapitestsetmetadataacfail73a14622?comp=metadata", + "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" : "9c322120-48d1-4872-8d78-7e66af34b123" + }, + "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" : "b92b2016-d01e-009e-30e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b2016-d01e-009e-30e5-644931000000\nTime:2019-09-06T19:00:31.9593977Z", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "9c322120-48d1-4872-8d78-7e66af34b123", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f51130ec-381e-4b7d-acb9-4785dbcd8e57" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b202f-d01e-009e-49e5-644931000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail73a41478220Fri, 06 Sep 2019 19:00:31 GMT\"0x8D732FC7DB4A5D4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "f51130ec-381e-4b7d-acb9-4785dbcd8e57", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail73a41478220?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" : "ad55ee5c-b01d-4e51-8c96-0d0de2551ade" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2045-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "ad55ee5c-b01d-4e51-8c96-0d0de2551ade" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail73a41478220", "javablobsetmetadataacfail1blobapitestsetmetadataacfail73a14622" ] +} \ 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..7e747781506e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila2c35312ebe?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" : "b264b48a-807a-42e2-8eab-726ebed93577" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7DD97467\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b206f-d01e-009e-04e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "b264b48a-807a-42e2-8eab-726ebed93577" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila2c35312ebe/javablobsetmetadataacfail1blobapitestsetmetadataacfaila2c28172", + "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" : "310e6328-7d50-48f1-9c6b-2970d654ae77", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7DE13271\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b209a-d01e-009e-29e5-644931000000", + "x-ms-client-request-id" : "310e6328-7d50-48f1-9c6b-2970d654ae77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila2c35312ebe/javablobsetmetadataacfail1blobapitestsetmetadataacfaila2c28172?comp=metadata", + "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" : "577c2c1e-c9f9-473e-bce5-726c282f2caa" + }, + "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" : "b92b20bf-d01e-009e-4be5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b20bf-d01e-009e-4be5-644931000000\nTime:2019-09-06T19:00:32.1625807Z", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "577c2c1e-c9f9-473e-bce5-726c282f2caa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "02cd9661-dfcd-4a54-9015-f65faf394a46" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b20e0-d01e-009e-6ae5-644931000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfaila2c35312ebeFri, 06 Sep 2019 19:00:32 GMT\"0x8D732FC7DD97467\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:31 GMT", + "x-ms-client-request-id" : "02cd9661-dfcd-4a54-9015-f65faf394a46", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila2c35312ebe?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" : "57c70ae8-6794-4629-b9f2-8979905a1b43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b2116-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "57c70ae8-6794-4629-b9f2-8979905a1b43" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfaila2c35312ebe", "javablobsetmetadataacfail1blobapitestsetmetadataacfaila2c28172" ] +} \ 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..1c8ddbf7ae01 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634?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" : "3f2c6547-c6c9-4d90-9fe7-d43a47e44ba3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7DF9FC3C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b214c-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "3f2c6547-c6c9-4d90-9fe7-d43a47e44ba3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634/javablobsetmetadataacfail1blobapitestsetmetadataacfailb0d64119", + "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" : "0011261d-2a98-4b2d-8029-07ace5571fc3", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7E003380\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2168-d01e-009e-62e5-644931000000", + "x-ms-client-request-id" : "0011261d-2a98-4b2d-8029-07ace5571fc3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634/javablobsetmetadataacfail1blobapitestsetmetadataacfailb0d64119", + "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" : "e3929ae6-3639-4e01-bae8-f301daed1ef7" + }, + "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" : "Fri, 06 Sep 2019 19:00:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7E003380\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:32 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b218b-d01e-009e-7de5-644931000000", + "x-ms-client-request-id" : "e3929ae6-3639-4e01-bae8-f301daed1ef7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634/javablobsetmetadataacfail1blobapitestsetmetadataacfailb0d64119?comp=metadata", + "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" : "600fff2f-4d9c-4c51-9448-8502caad7227" + }, + "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" : "b92b21a7-d01e-009e-16e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92b21a7-d01e-009e-16e5-644931000000\nTime:2019-09-06T19:00:32.3967922Z", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "600fff2f-4d9c-4c51-9448-8502caad7227", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "89afdc8a-2bfb-49bd-862c-5aa17ea5dbbd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b21c3-d01e-009e-2fe5-644931000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634Fri, 06 Sep 2019 19:00:32 GMT\"0x8D732FC7DF9FC3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "89afdc8a-2bfb-49bd-862c-5aa17ea5dbbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634?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" : "75b49508-cb9b-450b-b6b8-64492f67621c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b21d9-d01e-009e-44e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "75b49508-cb9b-450b-b6b8-64492f67621c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfailb0d16600634", "javablobsetmetadataacfail1blobapitestsetmetadataacfailb0d64119" ] +} \ 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..6681ae3615e1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7?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" : "16267981-3d54-4219-b233-2fbca49ca6f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7E1E073B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b2214-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "16267981-3d54-4219-b233-2fbca49ca6f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7/javablobsetmetadataacfail1blobapitestsetmetadataacfailb5e31725", + "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" : "c48232ee-5e87-4346-8a66-eed830c11e4d", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7E252967\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b223e-d01e-009e-17e5-644931000000", + "x-ms-client-request-id" : "c48232ee-5e87-4346-8a66-eed830c11e4d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7/javablobsetmetadataacfail1blobapitestsetmetadataacfailb5e31725?comp=lease", + "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" : "c02d4334-1051-4603-a6eb-e400b86d7d07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7E252967\"", + "x-ms-lease-id" : "846999fd-b8a5-4b32-9c7f-8170eb6ae710", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b225d-d01e-009e-30e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "c02d4334-1051-4603-a6eb-e400b86d7d07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7/javablobsetmetadataacfail1blobapitestsetmetadataacfailb5e31725?comp=metadata", + "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" : "3fa01be8-dc13-49a2-8ab5-16e8dfcff2a1" + }, + "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" : "b92b227c-d01e-009e-4ce5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92b227c-d01e-009e-4ce5-644931000000\nTime:2019-09-06T19:00:32.6630293Z", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "3fa01be8-dc13-49a2-8ab5-16e8dfcff2a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b04cb8c5-0c0f-4cd4-92cd-265bd8721cd3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2294-d01e-009e-62e5-644931000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7Fri, 06 Sep 2019 19:00:32 GMT\"0x8D732FC7E1E073B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "b04cb8c5-0c0f-4cd4-92cd-265bd8721cd3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7?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" : "46c41f30-4856-4761-a435-5193bf32847e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b22c4-d01e-009e-0ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "46c41f30-4856-4761-a435-5193bf32847e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfailb5e221881b7", "javablobsetmetadataacfail1blobapitestsetmetadataacfailb5e31725" ] +} \ 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..4ecd86b1a71e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull838279565e?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" : "b0381f5b-520a-4b26-b58c-b512c2af2a94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B5F08E2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b10bc-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "b0381f5b-520a-4b26-b58c-b512c2af2a94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull838279565e/javablobsetmetadataallnull170931cfefb421fe9b4b6", + "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" : "129114c9-e4d4-4df3-a5c0-5a40c676d407", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7B653AE7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b10f0-d01e-009e-75e5-644931000000", + "x-ms-client-request-id" : "129114c9-e4d4-4df3-a5c0-5a40c676d407" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull838279565e/javablobsetmetadataallnull170931cfefb421fe9b4b6?comp=metadata", + "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" : "ad47d523-37ba-4c85-82aa-09e0650449a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B6B08B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1112-d01e-009e-14e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "ad47d523-37ba-4c85-82aa-09e0650449a1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull838279565e/javablobsetmetadataallnull170931cfefb421fe9b4b6", + "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" : "f88a001f-a8da-49bf-b266-5b2627ef60e4" + }, + "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" : "Fri, 06 Sep 2019 19:00:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:27 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" : "\"0x8D732FC7B6B08B1\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b113a-d01e-009e-34e5-644931000000", + "x-ms-client-request-id" : "f88a001f-a8da-49bf-b266-5b2627ef60e4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dbb23dc4-6d27-4f3a-878c-04c4c11f2b32" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1157-d01e-009e-4fe5-644931000000", + "Body" : "jtcsetmetadataallnulljtcsetmetadataallnull0blobapitestsetmetadataallnull838279565eFri, 06 Sep 2019 19:00:27 GMT\"0x8D732FC7B5F08E2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "dbb23dc4-6d27-4f3a-878c-04c4c11f2b32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull838279565e?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" : "de741f49-8d42-48be-a36c-1c28d1e69fb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b1183-d01e-009e-75e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "de741f49-8d42-48be-a36c-1c28d1e69fb7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataallnull0blobapitestsetmetadataallnull838279565e", "javablobsetmetadataallnull170931cfefb421fe9b4b6" ] +} \ 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..fb8ee0db059e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrora8418538343d?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" : "7ac9f71f-b570-42d0-b3e0-3f66529d320f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7E47DFF8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b22f8-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "7ac9f71f-b570-42d0-b3e0-3f66529d320f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrora8418538343d/javablobsetmetadataerror1blobapitestsetmetadataerrora8420729c", + "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" : "ad976ccf-cf69-4b7d-a732-f3440436dc8a", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7E50142B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b2330-d01e-009e-71e5-644931000000", + "x-ms-client-request-id" : "ad976ccf-cf69-4b7d-a732-f3440436dc8a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrora8418538343d/javablobsetmetadataerror2blobapitestsetmetadataerrora8405941b?comp=metadata", + "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" : "bb47dd10-469f-412d-84e0-ec75f1d481d7" + }, + "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" : "b92b235b-d01e-009e-19e5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92b235b-d01e-009e-19e5-644931000000\nTime:2019-09-06T19:00:32.9012435Z", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "bb47dd10-469f-412d-84e0-ec75f1d481d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "732b17a5-70e8-4bf9-ae99-ebe0109e68e1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b2383-d01e-009e-3be5-644931000000", + "Body" : "jtcsetmetadataerrorjtcsetmetadataerror0blobapitestsetmetadataerrora8418538343dFri, 06 Sep 2019 19:00:32 GMT\"0x8D732FC7E47DFF8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "732b17a5-70e8-4bf9-ae99-ebe0109e68e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrora8418538343d?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" : "8b8f8e48-f7fb-4f31-a41f-a469c3ac0900" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b23b6-d01e-009e-68e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:32 GMT", + "x-ms-client-request-id" : "8b8f8e48-f7fb-4f31-a41f-a469c3ac0900" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataerror0blobapitestsetmetadataerrora8418538343d", "javablobsetmetadataerror1blobapitestsetmetadataerrora8420729c", "javablobsetmetadataerror2blobapitestsetmetadataerrora8405941b" ] +} \ 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..1dda21585ef1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160b?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" : "2f40dd85-f4a9-4654-9f77-14f535645298" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7BAA53F7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b12db-d01e-009e-29e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "2f40dd85-f4a9-4654-9f77-14f535645298" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160b/javablobsetmetadatametadata12795582d07093760341a", + "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" : "d602a25b-f9e9-4b9d-881b-9a55eb1f25a5", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7BB6F0C5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b133e-d01e-009e-7fe5-644931000000", + "x-ms-client-request-id" : "d602a25b-f9e9-4b9d-881b-9a55eb1f25a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160b/javablobsetmetadatametadata12795582d07093760341a?comp=metadata", + "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" : "9ee6ef55-8999-46f6-9229-c14c023ea684" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7BBD0CB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b1371-d01e-009e-30e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "9ee6ef55-8999-46f6-9229-c14c023ea684" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160b/javablobsetmetadatametadata12795582d07093760341a", + "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" : "e73857b4-f917-48e5-9dd6-3f71f08fb0b9" + }, + "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" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00: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" : "\"0x8D732FC7BBD0CB4\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b138c-d01e-009e-49e5-644931000000", + "x-ms-client-request-id" : "e73857b4-f917-48e5-9dd6-3f71f08fb0b9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c60b69d6-7550-4760-9d6e-76a3e6cbce54" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b13ae-d01e-009e-64e5-644931000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160bFri, 06 Sep 2019 19:00:28 GMT\"0x8D732FC7BAA53F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "c60b69d6-7550-4760-9d6e-76a3e6cbce54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160b?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" : "761d7297-ba1b-43a1-b2ed-4a55368a2ddd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b13d6-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "761d7297-ba1b-43a1-b2ed-4a55368a2ddd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata0blobapitestsetmetadatametadata73f13160b", "javablobsetmetadatametadata12795582d07093760341a" ] +} \ 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..8ec3b132b7ef --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740c?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" : "571cb4d4-c97f-487e-b427-5ee4bd4e600f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7BD20967\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b1407-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "571cb4d4-c97f-487e-b427-5ee4bd4e600f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740c/javablobsetmetadatametadata19475883f90a08c536493", + "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" : "54e0547a-4090-48d3-b090-ff0f5dcac2a5", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7BD8D8B3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b143a-d01e-009e-63e5-644931000000", + "x-ms-client-request-id" : "54e0547a-4090-48d3-b090-ff0f5dcac2a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740c/javablobsetmetadatametadata19475883f90a08c536493?comp=metadata", + "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" : "af90136e-dcb3-4470-886b-3e9d20362c84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7BDE5841\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b145d-d01e-009e-80e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "af90136e-dcb3-4470-886b-3e9d20362c84" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740c/javablobsetmetadatametadata19475883f90a08c536493", + "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" : "29075f59-859b-47e3-a081-83ef3da22b61" + }, + "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" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:28 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" : "\"0x8D732FC7BDE5841\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b1477-d01e-009e-19e5-644931000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "29075f59-859b-47e3-a081-83ef3da22b61", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "69ec84d4-64f9-486a-86b9-7fb11926a0f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b14aa-d01e-009e-46e5-644931000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740cFri, 06 Sep 2019 19:00:28 GMT\"0x8D732FC7BD20967\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "69ec84d4-64f9-486a-86b9-7fb11926a0f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740c?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" : "adc3954e-d893-4b2b-ad11-2d7179f1ab6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b14ca-d01e-009e-63e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "adc3954e-d893-4b2b-ad11-2d7179f1ab6c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata0blobapitestsetmetadatametadatad4974740c", "javablobsetmetadatametadata19475883f90a08c536493" ] +} \ 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..d6c2a4d23e97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80ba?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" : "0a205696-1885-4839-9bac-4c622f0183b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B83D777\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92b11c5-d01e-009e-31e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "x-ms-client-request-id" : "0a205696-1885-4839-9bac-4c622f0183b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80ba/javablobsetmetadatamin1blobapitestsetmetadatamin0ce09632b62", + "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" : "ce3fa1ad-7137-4e4c-9f24-f44d4c368767", + "Content-Type" : "application/octet-stream" + }, + "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 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC7B8A7F0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92b11f5-d01e-009e-5ae5-644931000000", + "x-ms-client-request-id" : "ce3fa1ad-7137-4e4c-9f24-f44d4c368767" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80ba/javablobsetmetadatamin1blobapitestsetmetadatamin0ce09632b62?comp=metadata", + "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" : "33fe4285-e144-4556-93f2-2f4178de4149" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC7B9073E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b122a-d01e-009e-0be5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "33fe4285-e144-4556-93f2-2f4178de4149" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80ba/javablobsetmetadatamin1blobapitestsetmetadatamin0ce09632b62", + "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" : "1fa8f2e4-8240-4696-b7e2-dab2e24d7e29" + }, + "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" : "Fri, 06 Sep 2019 19:00:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:00:28 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" : "\"0x8D732FC7B9073E6\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:00:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92b1259-d01e-009e-33e5-644931000000", + "x-ms-client-request-id" : "1fa8f2e4-8240-4696-b7e2-dab2e24d7e29", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "61328095-7257-4245-9e11-802d36615ace" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92b127e-d01e-009e-55e5-644931000000", + "Body" : "jtcsetmetadataminjtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80baFri, 06 Sep 2019 19:00:28 GMT\"0x8D732FC7B83D777\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "61328095-7257-4245-9e11-802d36615ace", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80ba?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" : "3622f188-7d9a-428d-a1a8-6ada89e51160" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92b12a7-d01e-009e-7ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:00:28 GMT", + "x-ms-client-request-id" : "3622f188-7d9a-428d-a1a8-6ada89e51160" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatamin0blobapitestsetmetadatamin0ce28600ad80ba", "javablobsetmetadatamin1blobapitestsetmetadatamin0ce09632b62" ] +} \ 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..3cb0fc1a187e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus0637725c069c1bd5444747a?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" : "3b440a66-31e0-4125-8945-8304abb7f24f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCADAB46CE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6583-d01e-009e-40e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "3b440a66-31e0-4125-8945-8304abb7f24f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus0637725c069c1bd5444747a/javablobsettierarchivestatus108244e501e45bcf8c4d", + "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" : "f9390249-9213-4820-851d-e3b59842c2e1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCADB27AA8\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c65c6-d01e-009e-78e5-644931000000", + "x-ms-client-request-id" : "f9390249-9213-4820-851d-e3b59842c2e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2070703974c5ee9d6e43?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" : "af006256-5fda-41ab-b2fa-94aaeb9a6170" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCADB86EBC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a6cc-301e-004b-7fe5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "af006256-5fda-41ab-b2fa-94aaeb9a6170" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2070703974c5ee9d6e43/javablobsettierarchivestatus310632fb46377237b240", + "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" : "9e272333-1d16-4fb9-962d-047bd0e7ef24", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCADBFE629\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a6db-301e-004b-0be5-64feb1000000", + "x-ms-client-request-id" : "9e272333-1d16-4fb9-962d-047bd0e7ef24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2070703974c5ee9d6e43/javablobsettierarchivestatus310632fb46377237b240?comp=tier", + "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" : "753d4fe8-6db4-4c1d-a356-c3f1d6025f69" + }, + "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" : "b8f1a6f2-301e-004b-1ce5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "753d4fe8-6db4-4c1d-a356-c3f1d6025f69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2070703974c5ee9d6e43/javablobsettierarchivestatus310632fb46377237b240?comp=tier", + "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" : "03369bbb-193d-4ea9-a09a-85d076e43889" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f1a6fe-301e-004b-24e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "03369bbb-193d-4ea9-a09a-85d076e43889" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2070703974c5ee9d6e43/javablobsettierarchivestatus310632fb46377237b240", + "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" : "7249fb0a-6537-4d3c-b627-923eb1639c84" + }, + "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" : "Fri, 06 Sep 2019 19:01:52 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 06 Sep 2019 19:01:52 GMT", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:52 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" : "\"0x8D732FCADBFE629\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:52 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-cool", + "x-ms-request-id" : "b8f1a716-301e-004b-39e5-64feb1000000", + "x-ms-client-request-id" : "7249fb0a-6537-4d3c-b627-923eb1639c84", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2070703974c5ee9d6e43?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e1f7cc28-9604-411e-9e16-2848b82dd568" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f1a72b-301e-004b-49e5-64feb1000000", + "Body" : "javablobsettierarchivestatus310632fb46377237b240Fri, 06 Sep 2019 19:01:52 GMTFri, 06 Sep 2019 19:01:52 GMT0x8D732FCADBFE6297application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-coolFri, 06 Sep 2019 19:01:52 GMTunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "e1f7cc28-9604-411e-9e16-2848b82dd568", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e3074a3-c3aa-4b6d-8162-0bfd88a37c4f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6733-d01e-009e-2ce5-644931000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus0637725c069c1bd5444747aFri, 06 Sep 2019 19:01:52 GMT\"0x8D732FCADAB46CE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "3e3074a3-c3aa-4b6d-8162-0bfd88a37c4f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus0637725c069c1bd5444747a?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" : "1f295eb8-0de3-40bb-9929-19a82ac6c5c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6766-d01e-009e-59e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "1f295eb8-0de3-40bb-9929-19a82ac6c5c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus0637725c069c1bd5444747a", "javablobsettierarchivestatus108244e501e45bcf8c4d", "javablobsettierarchivestatus2070703974c5ee9d6e43", "javablobsettierarchivestatus310632fb46377237b240" ] +} \ 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..49e6a76c3c53 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus02361710be35d009d04079a?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" : "934f60d2-d11a-45d0-a827-59284212bd79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCADECF2D7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c679c-d01e-009e-0be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "934f60d2-d11a-45d0-a827-59284212bd79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus02361710be35d009d04079a/javablobsettierarchivestatus19463754163f31e9a242", + "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" : "a2dc2860-e01d-464f-8917-5d77c1c19105", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCADF363A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c67da-d01e-009e-3be5-644931000000", + "x-ms-client-request-id" : "a2dc2860-e01d-464f-8917-5d77c1c19105" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2050289ad5673a39034e?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" : "a211b4c5-e399-451c-9e97-5be7afb39119" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCADF93107\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a78a-301e-004b-1ee5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "a211b4c5-e399-451c-9e97-5be7afb39119" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2050289ad5673a39034e/javablobsettierarchivestatus3556761e61f77f1c1341", + "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" : "c437d623-0f05-4ba5-b8ab-93a23891b818", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCADFF215A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a7a2-301e-004b-2fe5-64feb1000000", + "x-ms-client-request-id" : "c437d623-0f05-4ba5-b8ab-93a23891b818" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2050289ad5673a39034e/javablobsettierarchivestatus3556761e61f77f1c1341?comp=tier", + "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" : "3ffd9e8e-b343-4a7a-b701-8d53ca0692e4" + }, + "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" : "b8f1a7b6-301e-004b-40e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "3ffd9e8e-b343-4a7a-b701-8d53ca0692e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2050289ad5673a39034e/javablobsettierarchivestatus3556761e61f77f1c1341?comp=tier", + "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" : "e32b6af0-55b5-48aa-81e0-7ff668291918" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f1a7c9-301e-004b-4ee5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "e32b6af0-55b5-48aa-81e0-7ff668291918" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2050289ad5673a39034e/javablobsettierarchivestatus3556761e61f77f1c1341", + "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" : "751142e7-0258-4f93-97c5-3315451f6e04" + }, + "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" : "Fri, 06 Sep 2019 19:01:52 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 06 Sep 2019 19:01:52 GMT", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:52 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" : "\"0x8D732FCADFF215A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:52 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-hot", + "x-ms-request-id" : "b8f1a7e4-301e-004b-63e5-64feb1000000", + "x-ms-client-request-id" : "751142e7-0258-4f93-97c5-3315451f6e04", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus2050289ad5673a39034e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "01ba9395-b338-45a9-99a6-b0baeaf088e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f1a7ed-301e-004b-6ae5-64feb1000000", + "Body" : "javablobsettierarchivestatus3556761e61f77f1c1341Fri, 06 Sep 2019 19:01:52 GMTFri, 06 Sep 2019 19:01:52 GMT0x8D732FCADFF215A7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-hotFri, 06 Sep 2019 19:01:52 GMTunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "01ba9395-b338-45a9-99a6-b0baeaf088e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "653764f1-6c5c-443c-aced-e35d8afcb11a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6909-d01e-009e-42e5-644931000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus02361710be35d009d04079aFri, 06 Sep 2019 19:01:52 GMT\"0x8D732FCADECF2D7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "653764f1-6c5c-443c-aced-e35d8afcb11a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus02361710be35d009d04079a?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" : "d03463f6-d823-4b22-9587-88f3d35c7d92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6933-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "d03463f6-d823-4b22-9587-88f3d35c7d92" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus02361710be35d009d04079a", "javablobsettierarchivestatus19463754163f31e9a242", "javablobsettierarchivestatus2050289ad5673a39034e", "javablobsettierarchivestatus3556761e61f77f1c1341" ] +} \ 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..4faa54176b5c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob7dc8237320ee?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" : "17bff7b4-a858-45fa-be17-5e6e04de4ca5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA95A0190\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c439c-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "17bff7b4-a858-45fa-be17-5e6e04de4ca5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob7dc8237320ee/javablobsettierblockblob1blobapitestsettierblockblob7dc223224", + "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" : "f6255b69-1d04-4ac8-b66c-1b57110d7e73", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA9643A94\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c43ff-d01e-009e-43e5-644931000000", + "x-ms-client-request-id" : "f6255b69-1d04-4ac8-b66c-1b57110d7e73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33?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" : "18b77f92-7199-41bf-9042-2d823959faad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA96BAED2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1998a-301e-004b-1de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "18b77f92-7199-41bf-9042-2d823959faad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33/javablobsettierblockblob3blobapitestsettierblockblob7dc608377", + "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" : "1591cd7f-7b13-4518-87eb-02658639fbdf", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA9728B3C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f199a4-301e-004b-33e5-64feb1000000", + "x-ms-client-request-id" : "1591cd7f-7b13-4518-87eb-02658639fbdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33/javablobsettierblockblob3blobapitestsettierblockblob7dc608377?comp=tier", + "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" : "5cc9322c-a389-4068-afe5-f5f789fe5626" + }, + "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" : "b8f199bd-301e-004b-46e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "5cc9322c-a389-4068-afe5-f5f789fe5626" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33/javablobsettierblockblob3blobapitestsettierblockblob7dc608377", + "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" : "cde6aafe-a014-4fbf-af1a-30f837b2b22a" + }, + "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" : "Fri, 06 Sep 2019 19:01:45 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 06 Sep 2019 19:01:45 GMT", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:44 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" : "\"0x8D732FCA9728B3C\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:45 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b8f199e3-301e-004b-67e5-64feb1000000", + "x-ms-client-request-id" : "cde6aafe-a014-4fbf-af1a-30f837b2b22a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "254252bb-82b1-4eea-a523-96bf0581e058" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f199fa-301e-004b-7ce5-64feb1000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblob7dc608377Fri, 06 Sep 2019 19:01:45 GMTFri, 06 Sep 2019 19:01:45 GMT0x8D732FCA9728B3C7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHotFri, 06 Sep 2019 19:01:45 GMTunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "254252bb-82b1-4eea-a523-96bf0581e058", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33?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" : "507967ab-6c76-4fb9-8fab-de5b1fdaa028" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f19a0f-301e-004b-0ce5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:44 GMT", + "x-ms-client-request-id" : "507967ab-6c76-4fb9-8fab-de5b1fdaa028" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "75d12021-fbad-4dc0-87dd-704226382dc3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c4580-d01e-009e-2ce5-644931000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblob7dc8237320eeFri, 06 Sep 2019 19:01:45 GMT\"0x8D732FCA95A0190\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "75d12021-fbad-4dc0-87dd-704226382dc3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob7dc8237320ee?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" : "605bc6b2-aa97-48c1-a4f3-d5522a061ab7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c45a5-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "605bc6b2-aa97-48c1-a4f3-d5522a061ab7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblob7dc8237320ee", "javablobsettierblockblob1blobapitestsettierblockblob7dc223224", "jtcsettierblockblob2blobapitestsettierblockblob7dc267555f33", "javablobsettierblockblob3blobapitestsettierblockblob7dc608377" ] +} \ 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..613721d90811 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobed4440811a44?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" : "e7b30bde-4243-48d8-a8de-4d87e1e68179" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA9A65E5D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c45e1-d01e-009e-09e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "e7b30bde-4243-48d8-a8de-4d87e1e68179" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobed4440811a44/javablobsettierblockblob1blobapitestsettierblockblobed4964229", + "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" : "61e12bb3-3b43-413b-80f0-4273dcb3254a", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA9AE74A3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c461a-d01e-009e-39e5-644931000000", + "x-ms-client-request-id" : "61e12bb3-3b43-413b-80f0-4273dcb3254a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobed44594704f0?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" : "51e4fae9-5f8f-4bf2-9fe0-3621afa5d638" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA9B8F74F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f19a80-301e-004b-6de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "51e4fae9-5f8f-4bf2-9fe0-3621afa5d638" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobed44594704f0/javablobsettierblockblob3blobapitestsettierblockblobed429874e", + "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" : "33aa6491-8e92-4173-b0df-80004912b4ff", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA9C1339F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f19a9b-301e-004b-02e5-64feb1000000", + "x-ms-client-request-id" : "33aa6491-8e92-4173-b0df-80004912b4ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobed44594704f0/javablobsettierblockblob3blobapitestsettierblockblobed429874e?comp=tier", + "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" : "b7651037-b00a-4ab0-9bbe-4a944bbb9bab" + }, + "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" : "b8f19aae-301e-004b-13e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "b7651037-b00a-4ab0-9bbe-4a944bbb9bab" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobed44594704f0/javablobsettierblockblob3blobapitestsettierblockblobed429874e", + "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" : "a5dac1eb-a5da-4c63-a6a2-906a772707bb" + }, + "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" : "Fri, 06 Sep 2019 19:01:45 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 06 Sep 2019 19:01:45 GMT", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:45 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" : "\"0x8D732FCA9C1339F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:45 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b8f19abd-301e-004b-20e5-64feb1000000", + "x-ms-client-request-id" : "a5dac1eb-a5da-4c63-a6a2-906a772707bb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobed44594704f0?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e1a7656a-4e7c-41cc-b74d-8c2b8b63806a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f19ad1-301e-004b-31e5-64feb1000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblobed429874eFri, 06 Sep 2019 19:01:45 GMTFri, 06 Sep 2019 19:01:45 GMT0x8D732FCA9C1339F7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobCoolFri, 06 Sep 2019 19:01:45 GMTunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "e1a7656a-4e7c-41cc-b74d-8c2b8b63806a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobed44594704f0?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" : "9aa2c08c-b90b-45f9-9c5f-f9a2f5d414c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f19ad9-301e-004b-37e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "9aa2c08c-b90b-45f9-9c5f-f9a2f5d414c4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2d183439-1c26-4845-b211-c8462f374720" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c479f-d01e-009e-22e5-644931000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblobed4440811a44Fri, 06 Sep 2019 19:01:45 GMT\"0x8D732FCA9A65E5D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "2d183439-1c26-4845-b211-c8462f374720", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobed4440811a44?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" : "82cc0f2c-2795-4b5c-9daa-7009bc18dd76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c47c4-d01e-009e-43e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "82cc0f2c-2795-4b5c-9daa-7009bc18dd76" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblobed4440811a44", "javablobsettierblockblob1blobapitestsettierblockblobed4964229", "jtcsettierblockblob2blobapitestsettierblockblobed44594704f0", "javablobsettierblockblob3blobapitestsettierblockblobed429874e" ] +} \ 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..ec9ad136b8aa --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobf0b835720d0f?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" : "d55da91d-1b78-40b4-84f6-601785bd8388" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA9FCA899\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c4812-d01e-009e-09e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "d55da91d-1b78-40b4-84f6-601785bd8388" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobf0b835720d0f/javablobsettierblockblob1blobapitestsettierblockblobf0b433149", + "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" : "857315d8-ef40-407d-8534-eacc7982de18", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAA0CD79F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c48fe-d01e-009e-66e5-644931000000", + "x-ms-client-request-id" : "857315d8-ef40-407d-8534-eacc7982de18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba?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" : "aff47c49-edfb-4dd5-8d15-887ac65f72ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAA13625D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f19b71-301e-004b-3de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "aff47c49-edfb-4dd5-8d15-887ac65f72ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba/javablobsettierblockblob3blobapitestsettierblockblobf0b16468b", + "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" : "66496722-1728-43ab-a392-31702fed38ae", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAA242C23\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f19b9b-301e-004b-5de5-64feb1000000", + "x-ms-client-request-id" : "66496722-1728-43ab-a392-31702fed38ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba/javablobsettierblockblob3blobapitestsettierblockblobf0b16468b?comp=tier", + "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" : "2e27d1c2-98fe-4223-b5c8-c7ee8b6b661d" + }, + "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" : "b8f19bb8-301e-004b-75e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "2e27d1c2-98fe-4223-b5c8-c7ee8b6b661d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba/javablobsettierblockblob3blobapitestsettierblockblobf0b16468b", + "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" : "5ee0b17b-00d1-4384-a91e-cf85fb1ad859" + }, + "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" : "Fri, 06 Sep 2019 19:01:46 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 06 Sep 2019 19:01:46 GMT", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:45 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" : "\"0x8D732FCAA242C23\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:46 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b8f19bd0-301e-004b-0de5-64feb1000000", + "x-ms-client-request-id" : "5ee0b17b-00d1-4384-a91e-cf85fb1ad859", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5861944b-8cbb-4e00-be6d-3605d56b123b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f19be2-301e-004b-1de5-64feb1000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblobf0b16468bFri, 06 Sep 2019 19:01:46 GMTFri, 06 Sep 2019 19:01:46 GMT0x8D732FCAA242C237application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiveFri, 06 Sep 2019 19:01:46 GMTunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "5861944b-8cbb-4e00-be6d-3605d56b123b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba?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" : "cbe20f35-0cb6-4f72-b6c6-71c561565d46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f19bed-301e-004b-28e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:45 GMT", + "x-ms-client-request-id" : "cbe20f35-0cb6-4f72-b6c6-71c561565d46" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0fa7a3f2-413e-4721-b6f4-3808dd9d7ca7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c4a96-d01e-009e-5fe5-644931000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblobf0b835720d0fFri, 06 Sep 2019 19:01:46 GMT\"0x8D732FCA9FCA899\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:46 GMT", + "x-ms-client-request-id" : "0fa7a3f2-413e-4721-b6f4-3808dd9d7ca7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobf0b835720d0f?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" : "e6e2038d-5391-4647-8b87-5e88f1802446" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c4abe-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:46 GMT", + "x-ms-client-request-id" : "e6e2038d-5391-4647-8b87-5e88f1802446" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblobf0b835720d0f", "javablobsettierblockblob1blobapitestsettierblockblobf0b433149", "jtcsettierblockblob2blobapitestsettierblockblobf0b2751914ba", "javablobsettierblockblob3blobapitestsettierblockblobf0b16468b" ] +} \ 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..da89189f7179 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json @@ -0,0 +1,177 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror51752299d5904b52?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" : "f7a06ad8-a598-4717-81a9-66494cba4b87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE26FBFE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6982-d01e-009e-23e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "f7a06ad8-a598-4717-81a9-66494cba4b87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror51752299d5904b52/javablobsettiererror1blobapitestsettiererror517912111e934", + "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" : "d0a86e60-4267-4a88-a1e9-4f722bbcebbe", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAE2D4612\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c69bf-d01e-009e-56e5-644931000000", + "x-ms-client-request-id" : "d0a86e60-4267-4a88-a1e9-4f722bbcebbe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror51734883632336c3?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" : "6c916dfa-9397-4b14-8da7-81752d36f3dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE32776F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a86f-301e-004b-5ae5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "6c916dfa-9397-4b14-8da7-81752d36f3dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror51734883632336c3/javablobsettiererror3blobapitestsettiererror5174554505616", + "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" : "5f554086-271f-435f-97ef-83aaeb7275ea", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAE388ED4\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a882-301e-004b-6ae5-64feb1000000", + "x-ms-client-request-id" : "5f554086-271f-435f-97ef-83aaeb7275ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror51734883632336c3/javablobsettiererror3blobapitestsettiererror5174554505616?comp=tier", + "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" : "86ae41be-f2a9-4e16-a1cd-38a45791d309" + }, + "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" : "b8f1a88f-301e-004b-74e5-64feb1000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b8f1a88f-301e-004b-74e5-64feb1000000\nTime:2019-09-06T19:01:53.2645580Zx-ms-access-tiergarbage", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "86ae41be-f2a9-4e16-a1cd-38a45791d309", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror51734883632336c3?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" : "84ca12d8-fa01-4ce6-a35e-31ba68ec9bee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f1a8a4-301e-004b-06e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "84ca12d8-fa01-4ce6-a35e-31ba68ec9bee" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "76134e95-5f3f-49df-a83f-b58d2a6cd146" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6a8d-d01e-009e-04e5-644931000000", + "Body" : "jtcsettiererrorjtcsettiererror0blobapitestsettiererror51752299d5904b52Fri, 06 Sep 2019 19:01:53 GMT\"0x8D732FCAE26FBFE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "76134e95-5f3f-49df-a83f-b58d2a6cd146", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror51752299d5904b52?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" : "68a12070-60be-4d21-99cc-23ee4ee210e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6ac3-d01e-009e-34e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:52 GMT", + "x-ms-client-request-id" : "68a12070-60be-4d21-99cc-23ee4ee210e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettiererror0blobapitestsettiererror51752299d5904b52", "javablobsettiererror1blobapitestsettiererror517912111e934", "jtcsettiererror2blobapitestsettiererror51734883632336c3", "javablobsettiererror3blobapitestsettiererror5174554505616" ] +} \ 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..8cc59cf8afe8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierillegalargument06167498f412f496084b52?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" : "7fa0390d-b396-4ac2-a20e-5eb548508163" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE560615\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6b07-d01e-009e-70e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "7fa0390d-b396-4ac2-a20e-5eb548508163" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierillegalargument06167498f412f496084b52/javablobsettierillegalargument129515a254c2e9fe894", + "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" : "8c77a62d-0111-45ba-89f2-79fd4231be42", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAE5C779E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c6b3c-d01e-009e-1de5-644931000000", + "x-ms-client-request-id" : "8c77a62d-0111-45ba-89f2-79fd4231be42" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7062d38b-e6e0-4d45-9f1e-f293785ae1f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6b75-d01e-009e-52e5-644931000000", + "Body" : "jtcsettierillegalargumentjtcsettierillegalargument06167498f412f496084b52Fri, 06 Sep 2019 19:01:53 GMT\"0x8D732FCAE560615\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "7062d38b-e6e0-4d45-9f1e-f293785ae1f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierillegalargument06167498f412f496084b52?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" : "a073b059-e3e3-4216-a232-ef6ef95ead8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6ba8-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "a073b059-e3e3-4216-a232-ef6ef95ead8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierillegalargument06167498f412f496084b52", "javablobsettierillegalargument129515a254c2e9fe894" ] +} \ 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..82fcea0fefed --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json @@ -0,0 +1,261 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferred6d904017026f2?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" : "35e8eb28-4ddf-4e67-84f3-9007e6661630" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAD45DE0D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6250-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "35e8eb28-4ddf-4e67-84f3-9007e6661630" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferred6d904017026f2/javablobsettierinferred1blobapitestsettierinferred6d90862461", + "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" : "eaf1e444-8497-49d8-bbb1-176a055c1d45", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAD4C4DA0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c6288-d01e-009e-09e5-644931000000", + "x-ms-client-request-id" : "eaf1e444-8497-49d8-bbb1-176a055c1d45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564?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" : "38c22c3c-b3e1-4c07-8ec9-85c0a046cfbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAD56D5FE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a56f-301e-004b-56e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "38c22c3c-b3e1-4c07-8ec9-85c0a046cfbe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564/javablobsettierinferred3blobapitestsettierinferred6d9969362b", + "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" : "cbe512df-724d-45b4-bfde-c55c36f8a11b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAD718C22\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a57a-301e-004b-5ee5-64feb1000000", + "x-ms-client-request-id" : "cbe512df-724d-45b4-bfde-c55c36f8a11b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564/javablobsettierinferred3blobapitestsettierinferred6d9969362b", + "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" : "ea6010bc-6d9c-48b1-bb56-9e89dd0ad5bf" + }, + "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" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D732FCAD718C22\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b8f1a60b-301e-004b-56e5-64feb1000000", + "x-ms-client-request-id" : "ea6010bc-6d9c-48b1-bb56-9e89dd0ad5bf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0ca7793c-3b6a-471c-acd5-3f5d26195b53" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f1a61e-301e-004b-66e5-64feb1000000", + "Body" : "javablobsettierinferred3blobapitestsettierinferred6d9969362bFri, 06 Sep 2019 19:01:51 GMTFri, 06 Sep 2019 19:01:51 GMT0x8D732FCAD718C227application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "0ca7793c-3b6a-471c-acd5-3f5d26195b53", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564/javablobsettierinferred3blobapitestsettierinferred6d9969362b?comp=tier", + "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" : "1e44ed4b-210a-4dbc-ba0d-3aee771e5db2" + }, + "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" : "b8f1a647-301e-004b-0de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "1e44ed4b-210a-4dbc-ba0d-3aee771e5db2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564/javablobsettierinferred3blobapitestsettierinferred6d9969362b", + "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" : "67afe858-5599-4d32-b74f-4abf452871d2" + }, + "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" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 06 Sep 2019 19:01:52 GMT", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:51 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" : "\"0x8D732FCAD718C22\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b8f1a660-301e-004b-22e5-64feb1000000", + "x-ms-client-request-id" : "67afe858-5599-4d32-b74f-4abf452871d2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred6d95046564?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5c9fe502-d6a1-49e7-afc8-252db4bc21de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b8f1a669-301e-004b-2be5-64feb1000000", + "Body" : "javablobsettierinferred3blobapitestsettierinferred6d9969362bFri, 06 Sep 2019 19:01:51 GMTFri, 06 Sep 2019 19:01:51 GMT0x8D732FCAD718C227application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHotFri, 06 Sep 2019 19:01:52 GMTunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "5c9fe502-d6a1-49e7-afc8-252db4bc21de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a716ed9b-81b9-4a57-8885-eff13b6a4f90" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c64f4-d01e-009e-46e5-644931000000", + "Body" : "jtcsettierinferredjtcsettierinferred0blobapitestsettierinferred6d904017026f2Fri, 06 Sep 2019 19:01:51 GMT\"0x8D732FCAD45DE0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "a716ed9b-81b9-4a57-8885-eff13b6a4f90", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferred6d904017026f2?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" : "24ee22d1-809a-4224-803d-e9feffed4783" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6522-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "24ee22d1-809a-4224-803d-e9feffed4783" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierinferred0blobapitestsettierinferred6d904017026f2", "javablobsettierinferred1blobapitestsettierinferred6d90862461", "javablobsettierinferred2blobapitestsettierinferred6d95046564", "javablobsettierinferred3blobapitestsettierinferred6d9969362b" ] +} \ 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..64476670351c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json @@ -0,0 +1,196 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease959740223c17b995?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" : "762336cc-86c0-4716-a8aa-063b8163d272" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE6D8B22\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6bea-d01e-009e-3ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "762336cc-86c0-4716-a8aa-063b8163d272" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease959740223c17b995/javablobsettierlease1blobapitestsettierlease9597622071be1", + "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" : "0671dd9a-f427-448b-8ac7-93072a61826d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAE73FCD9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c6c0c-d01e-009e-5ee5-644931000000", + "x-ms-client-request-id" : "0671dd9a-f427-448b-8ac7-93072a61826d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease9591748146a4fc1f?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" : "c88d6c91-8edc-4cce-970a-7c7b18acfb51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE792E9A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a955-301e-004b-28e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "c88d6c91-8edc-4cce-970a-7c7b18acfb51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease9591748146a4fc1f/javablobsettierlease3blobapitestsettierlease9592617357c37", + "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" : "08432f2b-13a1-4acc-9afb-7b212f742870", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAE7E5B6A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a960-301e-004b-32e5-64feb1000000", + "x-ms-client-request-id" : "08432f2b-13a1-4acc-9afb-7b212f742870" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease9591748146a4fc1f/javablobsettierlease3blobapitestsettierlease9592617357c37?comp=lease", + "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" : "1cb8ec5d-e952-4f97-9db9-33704f6a49c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE7E5B6A\"", + "x-ms-lease-id" : "4939e999-be06-4992-8817-8a9fefb435c3", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a966-301e-004b-37e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "1cb8ec5d-e952-4f97-9db9-33704f6a49c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease9591748146a4fc1f/javablobsettierlease3blobapitestsettierlease9592617357c37?comp=tier", + "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" : "f2867ec5-e303-44a9-87cf-ec20aad496e9" + }, + "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" : "b8f1a96c-301e-004b-3de5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "f2867ec5-e303-44a9-87cf-ec20aad496e9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease9591748146a4fc1f?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" : "c87a989b-4085-4f87-a4c1-d12fb72da8ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f1a975-301e-004b-46e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "c87a989b-4085-4f87-a4c1-d12fb72da8ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5d4da792-c2b4-4d51-af38-bbd951cc9276" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6cfe-d01e-009e-35e5-644931000000", + "Body" : "jtcsettierleasejtcsettierlease0blobapitestsettierlease959740223c17b995Fri, 06 Sep 2019 19:01:53 GMT\"0x8D732FCAE6D8B22\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "5d4da792-c2b4-4d51-af38-bbd951cc9276", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease959740223c17b995?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" : "b44ce1a7-1bf7-448c-b402-afede2a32034" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6d1d-d01e-009e-51e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "b44ce1a7-1bf7-448c-b402-afede2a32034" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierlease0blobapitestsettierlease959740223c17b995", "javablobsettierlease1blobapitestsettierlease9597622071be1", "jtcsettierlease2blobapitestsettierlease9591748146a4fc1f", "javablobsettierlease3blobapitestsettierlease9592617357c37" ] +} \ 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..c320ece91680 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefaildb48584507eb?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" : "1fe75449-34c8-4d7e-8531-d964418b3f21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAE9E9164\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6d57-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "1fe75449-34c8-4d7e-8531-d964418b3f21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefaildb48584507eb/javablobsettierleasefail1blobapitestsettierleasefaildb492317e", + "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" : "8d992074-0a68-4e20-b559-000263c4b1e1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAEA5037D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c6d79-d01e-009e-1ce5-644931000000", + "x-ms-client-request-id" : "8d992074-0a68-4e20-b559-000263c4b1e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefaildb429308b7b1?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" : "83687045-4aa5-47ad-b942-d4f0fb12695a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAEAB4756\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a9c9-301e-004b-0ee5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "83687045-4aa5-47ad-b942-d4f0fb12695a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefaildb429308b7b1/javablobsettierleasefail3blobapitestsettierleasefaildb4252523", + "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" : "c6f0633a-63fb-4ed8-b494-58929dd344a9", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAEB4E1FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a9da-301e-004b-1be5-64feb1000000", + "x-ms-client-request-id" : "c6f0633a-63fb-4ed8-b494-58929dd344a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefaildb429308b7b1/javablobsettierleasefail3blobapitestsettierleasefaildb4252523?comp=tier", + "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" : "4346020b-95b8-40d4-a505-4161078a0fac" + }, + "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" : "b8f1a9f2-301e-004b-32e5-64feb1000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b8f1a9f2-301e-004b-32e5-64feb1000000\nTime:2019-09-06T19:01:54.2665126Zx-ms-lease-idgarbage", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "4346020b-95b8-40d4-a505-4161078a0fac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5448096a-e29c-4b65-81af-874e233f090f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6f36-d01e-009e-1ee5-644931000000", + "Body" : "jtcsettierleasefailjtcsettierleasefail0blobapitestsettierleasefaildb48584507ebFri, 06 Sep 2019 19:01:53 GMT\"0x8D732FCAE9E9164\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "5448096a-e29c-4b65-81af-874e233f090f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefaildb48584507eb?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" : "842f25e5-70a3-4099-b09d-c809879ece32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6f5a-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:53 GMT", + "x-ms-client-request-id" : "842f25e5-70a3-4099-b09d-c809879ece32" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierleasefail0blobapitestsettierleasefaildb48584507eb", "javablobsettierleasefail1blobapitestsettierleasefaildb492317e", "jtcsettierleasefail2blobapitestsettierleasefaildb429308b7b1", "javablobsettierleasefail3blobapitestsettierleasefaildb4252523" ] +} \ 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..2df8cc4e8b5f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettierminc0082625aa729a05c5?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" : "dc4c6100-0378-44ea-b08e-a4354e0bcf02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAD177068\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c60ba-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "dc4c6100-0378-44ea-b08e-a4354e0bcf02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettierminc0082625aa729a05c5/javablobsettiermin1blobapitestsettierminc006684680e7a10", + "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" : "f73cfe14-3a29-4ab9-87dc-cea43ea910c7", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAD1E06A0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c60fc-d01e-009e-10e5-644931000000", + "x-ms-client-request-id" : "f73cfe14-3a29-4ab9-87dc-cea43ea910c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiermin2blobapitestsettierminc0050105c288d221d6?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" : "091027f2-9a29-4086-ba81-e4608aaa70f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAD235D60\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b8f1a4b9-301e-004b-33e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "091027f2-9a29-4086-ba81-e4608aaa70f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiermin2blobapitestsettierminc0050105c288d221d6/javablobsettiermin3blobapitestsettierminc00104085281714", + "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" : "2c17bac0-0dab-40ef-803d-51a67e749bf8", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAD29C35E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b8f1a4c8-301e-004b-40e5-64feb1000000", + "x-ms-client-request-id" : "2c17bac0-0dab-40ef-803d-51a67e749bf8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettierminc0082625aa729a05c5/javablobsettiermin1blobapitestsettierminc006684680e7a10?comp=tier", + "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" : "be9578f5-1b74-4966-80e4-4a477b009d68" + }, + "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" : "b92c6189-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "be9578f5-1b74-4966-80e4-4a477b009d68" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiermin2blobapitestsettierminc0050105c288d221d6?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" : "7a9bb12f-f578-4a04-949e-247ab890f7a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b8f1a4f4-301e-004b-69e5-64feb1000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "7a9bb12f-f578-4a04-949e-247ab890f7a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2645eb37-fa9c-4d81-a0a3-cc222df19c84" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c61ea-d01e-009e-73e5-644931000000", + "Body" : "jtcsettierminjtcsettiermin0blobapitestsettierminc0082625aa729a05c5Fri, 06 Sep 2019 19:01:51 GMT\"0x8D732FCAD177068\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "2645eb37-fa9c-4d81-a0a3-cc222df19c84", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettierminc0082625aa729a05c5?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" : "79be0115-18fa-4a12-9aed-6936a2f9483d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6215-d01e-009e-1be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:51 GMT", + "x-ms-client-request-id" : "79be0115-18fa-4a12-9aed-6936a2f9483d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettiermin0blobapitestsettierminc0082625aa729a05c5", "javablobsettiermin1blobapitestsettierminc006684680e7a10", "jtcsettiermin2blobapitestsettierminc0050105c288d221d6", "javablobsettiermin3blobapitestsettierminc00104085281714" ] +} \ 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..18b41ac86841 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf9135846c4ac5?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" : "e71aa2c9-cc52-47fc-8f79-f2b64d9ffb75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAA50F687\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c4b1b-d01e-009e-5ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:46 GMT", + "x-ms-client-request-id" : "e71aa2c9-cc52-47fc-8f79-f2b64d9ffb75" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf9135846c4ac5/javablobsettierpageblob1blobapitestsettierpageblobf9150419da", + "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" : "7c339ec8-58cf-4829-b92e-dca9f12bc3ba", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAA57D525\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c4b4e-d01e-009e-0be5-644931000000", + "x-ms-client-request-id" : "7c339ec8-58cf-4829-b92e-dca9f12bc3ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf912696506adb?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" : "e7dd5fd6-56b5-4972-8fe3-f892cde7d737" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAB29B8D0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c020-501c-000c-62e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:47 GMT", + "x-ms-client-request-id" : "e7dd5fd6-56b5-4972-8fe3-f892cde7d737" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf912696506adb/javablobsettierpageblob3blobapitestsettierpageblobf9194345b4", + "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" : "932dcc8f-460d-4517-a0d9-4a43e1e76cff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAB33986F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c04c-501c-000c-0ee5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:47 GMT", + "x-ms-client-request-id" : "932dcc8f-460d-4517-a0d9-4a43e1e76cff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf912696506adb/javablobsettierpageblob3blobapitestsettierpageblobf9194345b4?comp=tier", + "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" : "e5b4834c-6ccd-4f37-b462-ddb49752dec5" + }, + "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" : "2305c068-501c-000c-2ae5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:47 GMT", + "x-ms-client-request-id" : "e5b4834c-6ccd-4f37-b462-ddb49752dec5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf912696506adb/javablobsettierpageblob3blobapitestsettierpageblobf9194345b4", + "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" : "10baab8f-52e8-4cce-8113-4f2c4e18cef6" + }, + "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" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:47 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P4", + "ETag" : "\"0x8D732FCAB33986F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:48 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c089-501c-000c-4be5-64d511000000", + "x-ms-client-request-id" : "10baab8f-52e8-4cce-8113-4f2c4e18cef6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf912696506adb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ff53c9f2-cbc0-40e0-9340-899f1d8c50c6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c0c4-501c-000c-06e5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobf9194345b4Fri, 06 Sep 2019 19:01:48 GMTFri, 06 Sep 2019 19:01:48 GMT0x8D732FCAB33986F512application/octet-stream0PageBlobP4unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:47 GMT", + "x-ms-client-request-id" : "ff53c9f2-cbc0-40e0-9340-899f1d8c50c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf912696506adb?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" : "15bd77f9-974d-4a73-bff0-98e4204c0676" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c0db-501c-000c-1de5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:47 GMT", + "x-ms-client-request-id" : "15bd77f9-974d-4a73-bff0-98e4204c0676" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1bb39730-b469-452d-a6ed-544bd61996fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c5340-d01e-009e-57e5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobf9135846c4ac5Fri, 06 Sep 2019 19:01:46 GMT\"0x8D732FCAA50F687\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "1bb39730-b469-452d-a6ed-544bd61996fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf9135846c4ac5?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" : "2803dbc7-8a2c-465b-b25f-9f420b79107d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c5380-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "2803dbc7-8a2c-465b-b25f-9f420b79107d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobf9135846c4ac5", "javablobsettierpageblob1blobapitestsettierpageblobf9150419da", "jtcsettierpageblob2blobapitestsettierpageblobf912696506adb", "javablobsettierpageblob3blobapitestsettierpageblobf9194345b4" ] +} \ 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..a2e3dd821ae0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd3631348d71d8?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" : "e800430b-d6ef-4fc0-92b1-ffb34e52272d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAB78A35C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c540f-d01e-009e-21e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "e800430b-d6ef-4fc0-92b1-ffb34e52272d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd3631348d71d8/javablobsettierpageblob1blobapitestsettierpageblobd3600289e4", + "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" : "87c5e441-3d8a-44b4-90f5-86bf54e57282", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAB88600F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c5471-d01e-009e-7ee5-644931000000", + "x-ms-client-request-id" : "87c5e441-3d8a-44b4-90f5-86bf54e57282" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd361140665241?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" : "a7038f2e-0ccd-4298-a701-481bd6671b5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAB911959\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c1e0-501c-000c-22e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "a7038f2e-0ccd-4298-a701-481bd6671b5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd361140665241/javablobsettierpageblob3blobapitestsettierpageblobd3617052be", + "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" : "07e78025-ca2b-4a2e-9b90-6e2f71af5256" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAB9D8430\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c20e-501c-000c-50e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "07e78025-ca2b-4a2e-9b90-6e2f71af5256" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd361140665241/javablobsettierpageblob3blobapitestsettierpageblobd3617052be?comp=tier", + "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" : "756848c1-886a-4f44-a330-fff7f387d8f0" + }, + "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" : "2305c233-501c-000c-75e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "756848c1-886a-4f44-a330-fff7f387d8f0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd361140665241/javablobsettierpageblob3blobapitestsettierpageblobd3617052be", + "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" : "f63d8197-562a-4b4e-9149-1d7f9dda6e99" + }, + "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" : "Fri, 06 Sep 2019 19:01:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P6", + "ETag" : "\"0x8D732FCAB9D8430\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:48 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c25c-501c-000c-1ee5-64d511000000", + "x-ms-client-request-id" : "f63d8197-562a-4b4e-9149-1d7f9dda6e99", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd361140665241?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ba0ca699-3b40-4ef2-bddd-97d5d518afd3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c282-501c-000c-44e5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobd3617052beFri, 06 Sep 2019 19:01:48 GMTFri, 06 Sep 2019 19:01:48 GMT0x8D732FCAB9D8430512application/octet-stream0PageBlobP6unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "ba0ca699-3b40-4ef2-bddd-97d5d518afd3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd361140665241?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" : "69aeef66-ff89-4bab-961f-743dc5309c71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c29e-501c-000c-60e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "69aeef66-ff89-4bab-961f-743dc5309c71" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96c0ebf9-3b5e-4499-a2a2-fffadd8fe8ee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c5622-d01e-009e-14e5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobd3631348d71d8Fri, 06 Sep 2019 19:01:48 GMT\"0x8D732FCAB78A35C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "96c0ebf9-3b5e-4499-a2a2-fffadd8fe8ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd3631348d71d8?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" : "2fd91401-75e0-4eba-9d78-40604a2930cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c564c-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "2fd91401-75e0-4eba-9d78-40604a2930cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobd3631348d71d8", "javablobsettierpageblob1blobapitestsettierpageblobd3600289e4", "jtcsettierpageblob2blobapitestsettierpageblobd361140665241", "javablobsettierpageblob3blobapitestsettierpageblobd3617052be" ] +} \ 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..59b65a9d0a13 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob35e40036eb7d3?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" : "1947b515-251b-4fa4-81a6-58dafe96bd95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCABD04D7F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c568e-d01e-009e-7ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "1947b515-251b-4fa4-81a6-58dafe96bd95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob35e40036eb7d3/javablobsettierpageblob1blobapitestsettierpageblob35e81743ac", + "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" : "47f5c116-d95f-4d30-ad0e-d2ed848ac210", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCABDFE3AA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c5708-d01e-009e-6ee5-644931000000", + "x-ms-client-request-id" : "47f5c116-d95f-4d30-ad0e-d2ed848ac210" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8?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" : "8e981adc-e1b0-41db-a58e-a542f8b58823" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCABE53C65\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c38b-501c-000c-4de5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "8e981adc-e1b0-41db-a58e-a542f8b58823" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8/javablobsettierpageblob3blobapitestsettierpageblob35e28316fe", + "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" : "67900363-d270-4165-8346-4da6e684f8b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCABEA7EBA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c3a3-501c-000c-65e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "67900363-d270-4165-8346-4da6e684f8b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8/javablobsettierpageblob3blobapitestsettierpageblob35e28316fe?comp=tier", + "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" : "c45684d8-259e-470f-966e-5d791c240c1a" + }, + "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" : "2305c3c2-501c-000c-04e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "c45684d8-259e-470f-966e-5d791c240c1a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8/javablobsettierpageblob3blobapitestsettierpageblob35e28316fe", + "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" : "590876ca-5e57-4c82-8f55-b54210835e6f" + }, + "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" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P10", + "ETag" : "\"0x8D732FCABEA7EBA\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:49 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c3e3-501c-000c-25e5-64d511000000", + "x-ms-client-request-id" : "590876ca-5e57-4c82-8f55-b54210835e6f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b7056bd1-5e9b-4921-86c4-4717dc25234c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c3fc-501c-000c-3ee5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob35e28316feFri, 06 Sep 2019 19:01:49 GMTFri, 06 Sep 2019 19:01:49 GMT0x8D732FCABEA7EBA512application/octet-stream0PageBlobP10unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "b7056bd1-5e9b-4921-86c4-4717dc25234c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8?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" : "6aaea8bb-5b0a-44d1-b3c6-dfda18ca4435" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c411-501c-000c-53e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:48 GMT", + "x-ms-client-request-id" : "6aaea8bb-5b0a-44d1-b3c6-dfda18ca4435" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dc94e190-da07-4b22-8799-e601edeb65e5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c5809-d01e-009e-5be5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob35e40036eb7d3Fri, 06 Sep 2019 19:01:49 GMT\"0x8D732FCABD04D7F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "dc94e190-da07-4b22-8799-e601edeb65e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob35e40036eb7d3?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" : "d8a564f7-f9e0-4b96-94e5-153740ded866" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c5820-d01e-009e-6fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "d8a564f7-f9e0-4b96-94e5-153740ded866" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob35e40036eb7d3", "javablobsettierpageblob1blobapitestsettierpageblob35e81743ac", "jtcsettierpageblob2blobapitestsettierpageblob35e9264090bb8", "javablobsettierpageblob3blobapitestsettierpageblob35e28316fe" ] +} \ 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..2e92924aaf27 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob88e723499950e?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" : "55df3300-6421-4b71-812e-f2aba9e3596b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC0FAF02\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c5859-d01e-009e-23e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "55df3300-6421-4b71-812e-f2aba9e3596b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob88e723499950e/javablobsettierpageblob1blobapitestsettierpageblob88e1025665", + "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" : "d054a11f-a7c6-473d-a589-d16fcc429b47", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAC1977E5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c5881-d01e-009e-48e5-644931000000", + "x-ms-client-request-id" : "d054a11f-a7c6-473d-a589-d16fcc429b47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21?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" : "d27c6ec4-d0d8-4823-b3d9-ae757b6a7f35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC1ECDA7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c4a3-501c-000c-65e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "d27c6ec4-d0d8-4823-b3d9-ae757b6a7f35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21/javablobsettierpageblob3blobapitestsettierpageblob88e1554940", + "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" : "acd12a58-333a-486c-a79d-3b96c70e15ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC254A01\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c4d4-501c-000c-16e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "acd12a58-333a-486c-a79d-3b96c70e15ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21/javablobsettierpageblob3blobapitestsettierpageblob88e1554940?comp=tier", + "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" : "fff53002-565a-4b84-8a29-8f7657436a95" + }, + "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" : "2305c510-501c-000c-52e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "fff53002-565a-4b84-8a29-8f7657436a95" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21/javablobsettierpageblob3blobapitestsettierpageblob88e1554940", + "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" : "b1881cda-1d42-42be-8cff-320c85766f0d" + }, + "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" : "Fri, 06 Sep 2019 19:01:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P20", + "ETag" : "\"0x8D732FCAC254A01\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:49 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c543-501c-000c-05e5-64d511000000", + "x-ms-client-request-id" : "b1881cda-1d42-42be-8cff-320c85766f0d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c6e2300-95a5-493f-bd26-f772ad55d5fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c567-501c-000c-29e5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob88e1554940Fri, 06 Sep 2019 19:01:49 GMTFri, 06 Sep 2019 19:01:49 GMT0x8D732FCAC254A01512application/octet-stream0PageBlobP20unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "7c6e2300-95a5-493f-bd26-f772ad55d5fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21?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" : "e4299ad0-ce0a-49ce-ba42-e1dbc221e7e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c586-501c-000c-48e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "e4299ad0-ce0a-49ce-ba42-e1dbc221e7e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc914b08-ee00-46eb-949a-10408eca6e9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c59d5-d01e-009e-7de5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob88e723499950eFri, 06 Sep 2019 19:01:49 GMT\"0x8D732FCAC0FAF02\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "bc914b08-ee00-46eb-949a-10408eca6e9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob88e723499950e?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" : "677dfa82-9fcf-4782-bc2d-86a3d999bdb8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c59f1-d01e-009e-15e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "677dfa82-9fcf-4782-bc2d-86a3d999bdb8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob88e723499950e", "javablobsettierpageblob1blobapitestsettierpageblob88e1025665", "jtcsettierpageblob2blobapitestsettierpageblob88e1417650c21", "javablobsettierpageblob3blobapitestsettierpageblob88e1554940" ] +} \ 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..0da8035ad69f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd089102511811?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" : "420ae769-44e8-44fa-be82-65ec02656737" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC5E0806\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c5aa0-d01e-009e-30e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "420ae769-44e8-44fa-be82-65ec02656737" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd089102511811/javablobsettierpageblob1blobapitestsettierpageblobd0878496b7", + "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" : "77625d69-8a49-47e4-a20e-3b54bc51c11d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAC64C394\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c5ad1-d01e-009e-5ce5-644931000000", + "x-ms-client-request-id" : "77625d69-8a49-47e4-a20e-3b54bc51c11d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826?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" : "4e826136-1ea6-4e5e-be75-0d0b2fe06a1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC6E8316\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c6c8-501c-000c-0ae5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "4e826136-1ea6-4e5e-be75-0d0b2fe06a1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826/javablobsettierpageblob3blobapitestsettierpageblobd0898446ae", + "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" : "e190dc8b-cbe4-470a-a5b1-a78896063b09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC748453\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c6ec-501c-000c-2ee5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "e190dc8b-cbe4-470a-a5b1-a78896063b09" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826/javablobsettierpageblob3blobapitestsettierpageblobd0898446ae?comp=tier", + "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" : "dd61d5af-7a7c-47bb-9181-b930a9b6a55f" + }, + "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" : "2305c707-501c-000c-49e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "dd61d5af-7a7c-47bb-9181-b930a9b6a55f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826/javablobsettierpageblob3blobapitestsettierpageblobd0898446ae", + "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" : "08c636fb-21c3-49dc-a2f7-feb98402a7af" + }, + "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" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P30", + "ETag" : "\"0x8D732FCAC748453\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:50 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c732-501c-000c-74e5-64d511000000", + "x-ms-client-request-id" : "08c636fb-21c3-49dc-a2f7-feb98402a7af", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "82b38a27-d83f-4ae6-a38d-181cb0bfa084" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c746-501c-000c-08e5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobd0898446aeFri, 06 Sep 2019 19:01:50 GMTFri, 06 Sep 2019 19:01:50 GMT0x8D732FCAC748453512application/octet-stream0PageBlobP30unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "82b38a27-d83f-4ae6-a38d-181cb0bfa084", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826?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" : "7c5c7dab-e13c-4df6-b106-6cd6338cf9c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c75f-501c-000c-21e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:49 GMT", + "x-ms-client-request-id" : "7c5c7dab-e13c-4df6-b106-6cd6338cf9c4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3c066254-6df8-426b-9c19-c10e02edfa3b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c5c17-d01e-009e-07e5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobd089102511811Fri, 06 Sep 2019 19:01:50 GMT\"0x8D732FCAC5E0806\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "3c066254-6df8-426b-9c19-c10e02edfa3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd089102511811?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" : "8156ecfe-72b4-43ba-aa22-d6526447b5b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c5c4b-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "8156ecfe-72b4-43ba-aa22-d6526447b5b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobd089102511811", "javablobsettierpageblob1blobapitestsettierpageblobd0878496b7", "jtcsettierpageblob2blobapitestsettierpageblobd0843922b2826", "javablobsettierpageblob3blobapitestsettierpageblobd0898446ae" ] +} \ 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..509a80d88407 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf2345835bdd14?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" : "03216078-d9a5-41c7-b85a-c68f659d38a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAC9E05DF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c5c80-d01e-009e-6ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "03216078-d9a5-41c7-b85a-c68f659d38a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf2345835bdd14/javablobsettierpageblob1blobapitestsettierpageblobf2314613d2", + "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" : "b495eb78-d3fd-426c-8572-54cfd8679c23", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCACA4E91A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c5cba-d01e-009e-1ce5-644931000000", + "x-ms-client-request-id" : "b495eb78-d3fd-426c-8572-54cfd8679c23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf231563665b88?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" : "b2bc8088-d1bf-4160-af7f-d1b834473c44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCACAAACE3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c7e7-501c-000c-29e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "b2bc8088-d1bf-4160-af7f-d1b834473c44" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf231563665b88/javablobsettierpageblob3blobapitestsettierpageblobf231762200", + "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" : "e57bca92-64e3-449d-b59c-bf1fa5ad8fe6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCACB13229\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c81a-501c-000c-5ce5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "e57bca92-64e3-449d-b59c-bf1fa5ad8fe6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf231563665b88/javablobsettierpageblob3blobapitestsettierpageblobf231762200?comp=tier", + "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" : "0b658adf-b161-4398-986a-58ecf6efee03" + }, + "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" : "2305c83b-501c-000c-7de5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "0b658adf-b161-4398-986a-58ecf6efee03" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf231563665b88/javablobsettierpageblob3blobapitestsettierpageblobf231762200", + "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" : "4ff3c187-0f68-4cbf-bea3-08ea8071c097" + }, + "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" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P40", + "ETag" : "\"0x8D732FCACB13229\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:50 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c85e-501c-000c-20e5-64d511000000", + "x-ms-client-request-id" : "4ff3c187-0f68-4cbf-bea3-08ea8071c097", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf231563665b88?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f9cbc7b2-195f-440d-be4f-e34dfbee085f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c870-501c-000c-32e5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobf231762200Fri, 06 Sep 2019 19:01:50 GMTFri, 06 Sep 2019 19:01:50 GMT0x8D732FCACB13229512application/octet-stream0PageBlobP40unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "f9cbc7b2-195f-440d-be4f-e34dfbee085f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf231563665b88?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" : "4ad5537a-2355-417d-b104-e36196c478c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c883-501c-000c-45e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "4ad5537a-2355-417d-b104-e36196c478c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f4695e09-2427-4d24-aa72-0c2a7d9bded9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c5e3d-d01e-009e-01e5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobf2345835bdd14Fri, 06 Sep 2019 19:01:50 GMT\"0x8D732FCAC9E05DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "f4695e09-2427-4d24-aa72-0c2a7d9bded9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf2345835bdd14?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" : "78f6a460-c543-43d1-bb3a-03d1dc0a9a24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c5e68-d01e-009e-2be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "78f6a460-c543-43d1-bb3a-03d1dc0a9a24" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobf2345835bdd14", "javablobsettierpageblob1blobapitestsettierpageblobf2314613d2", "jtcsettierpageblob2blobapitestsettierpageblobf231563665b88", "javablobsettierpageblob3blobapitestsettierpageblobf231762200" ] +} \ 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..92555bd5a8f8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe5b142951c578?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" : "419d489f-a1da-4e91-b122-afbd541e3abf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCACD96ED1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c5e9f-d01e-009e-5ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "419d489f-a1da-4e91-b122-afbd541e3abf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe5b142951c578/javablobsettierpageblob1blobapitestsettierpageblobe5b57043d8", + "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" : "b90eb66c-8c29-4e53-8695-81d1e616f538", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCACE0C7E5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c5ed2-d01e-009e-08e5-644931000000", + "x-ms-client-request-id" : "b90eb66c-8c29-4e53-8695-81d1e616f538" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383?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" : "1323099d-ecb7-4304-a1ed-cadf59ba692c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCACEA59C7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2305c90f-501c-000c-51e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "1323099d-ecb7-4304-a1ed-cadf59ba692c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383/javablobsettierpageblob3blobapitestsettierpageblobe5b18610fa", + "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" : "2b2b2f4f-7df6-45e2-9c70-6aba08ec6e07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCACF05B26\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2305c929-501c-000c-6be5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "2b2b2f4f-7df6-45e2-9c70-6aba08ec6e07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383/javablobsettierpageblob3blobapitestsettierpageblobe5b18610fa?comp=tier", + "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" : "533e1739-6d1d-4605-8bbd-89921b3c795c" + }, + "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" : "2305c947-501c-000c-09e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "533e1739-6d1d-4605-8bbd-89921b3c795c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383/javablobsettierpageblob3blobapitestsettierpageblobe5b18610fa", + "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" : "cff0904b-26e5-4e81-8702-4782a6598055" + }, + "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" : "Fri, 06 Sep 2019 19:01:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P50", + "ETag" : "\"0x8D732FCACF05B26\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:51 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2305c961-501c-000c-23e5-64d511000000", + "x-ms-client-request-id" : "cff0904b-26e5-4e81-8702-4782a6598055", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8728a403-1b89-4908-98e5-0a07767eca50" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2305c973-501c-000c-35e5-64d511000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobe5b18610faFri, 06 Sep 2019 19:01:51 GMTFri, 06 Sep 2019 19:01:51 GMT0x8D732FCACF05B26512application/octet-stream0PageBlobP50unlockedavailabletrue", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "8728a403-1b89-4908-98e5-0a07767eca50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383?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" : "8e23f540-a93f-4e32-826e-b417f08bec1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2305c98e-501c-000c-50e5-64d511000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "8e23f540-a93f-4e32-826e-b417f08bec1e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "43b19516-97a6-434f-acf0-ceb190cff4f9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c6035-d01e-009e-55e5-644931000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobe5b142951c578Fri, 06 Sep 2019 19:01:50 GMT\"0x8D732FCACD96ED1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "43b19516-97a6-434f-acf0-ceb190cff4f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe5b142951c578?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" : "23a39418-8f40-4422-b05e-f26f4854a01b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c6061-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:50 GMT", + "x-ms-client-request-id" : "23a39418-8f40-4422-b05e-f26f4854a01b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobe5b142951c578", "javablobsettierpageblob1blobapitestsettierpageblobe5b57043d8", "jtcsettierpageblob2blobapitestsettierpageblobe5b930967f383", "javablobsettierpageblob3blobapitestsettierpageblobe5b18610fa" ] +} \ 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..491903cd6e17 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotc19991145a9d0ff1ceba?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" : "75b10850-42d2-4c28-9f30-8ffb4e6b36ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC952647D2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb433-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "75b10850-42d2-4c28-9f30-8ffb4e6b36ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotc19991145a9d0ff1ceba/javablobsnapshot1blobapitestsnapshotc1968180edfa94fcd", + "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" : "f212aa65-effd-4134-b1d8-2bdca90e21db", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC952D714F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb45d-d01e-009e-3de5-644931000000", + "x-ms-client-request-id" : "f212aa65-effd-4134-b1d8-2bdca90e21db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotc19991145a9d0ff1ceba/javablobsnapshot1blobapitestsnapshotc1968180edfa94fcd?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", + "x-ms-client-request-id" : "c880b40b-40f0-4dd1-a480-6785411cea10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:11.2575628Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC952D714F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb48d-d01e-009e-67e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:10 GMT", + "x-ms-client-request-id" : "c880b40b-40f0-4dd1-a480-6785411cea10" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotc19991145a9d0ff1ceba/javablobsnapshot1blobapitestsnapshotc1968180edfa94fcd?snapshot=2019-09-06T19%3a01%3a11.2575628Z", + "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" : "5a20a18b-4b31-497e-a58f-ce785f2f92c0" + }, + "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, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:11 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-06T19:01:11.2575628Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D732FC952D714F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bb4c5-d01e-009e-19e5-644931000000", + "x-ms-client-request-id" : "5a20a18b-4b31-497e-a58f-ce785f2f92c0", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e8d7f353-4c1b-44c4-aa71-98f3f3a97efa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb4ef-d01e-009e-3fe5-644931000000", + "Body" : "jtcsnapshotjtcsnapshot0blobapitestsnapshotc19991145a9d0ff1cebaFri, 06 Sep 2019 19:01:11 GMT\"0x8D732FC952647D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "e8d7f353-4c1b-44c4-aa71-98f3f3a97efa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotc19991145a9d0ff1ceba?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" : "d873d99b-a5eb-44c0-b345-04a3015dd936" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb518-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "d873d99b-a5eb-44c0-b345-04a3015dd936" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshot0blobapitestsnapshotc19991145a9d0ff1ceba", "javablobsnapshot1blobapitestsnapshotc1968180edfa94fcd" ] +} \ 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..3839df8efdaf --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac90914513dc81fba8f0?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" : "3708cacb-c70f-435a-ab6c-3039e5cca435" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9591092B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb741-d01e-009e-53e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "3708cacb-c70f-435a-ab6c-3039e5cca435" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac90914513dc81fba8f0/javablobsnapshotac1blobapitestsnapshotac90991862d3600bd", + "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" : "bf44e7cf-89f7-414d-aa3a-343e816c66c1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9597E529\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb780-d01e-009e-06e5-644931000000", + "x-ms-client-request-id" : "bf44e7cf-89f7-414d-aa3a-343e816c66c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac90914513dc81fba8f0/javablobsnapshotac1blobapitestsnapshotac90991862d3600bd?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", + "x-ms-client-request-id" : "45d5a52d-826f-4cee-910e-6dd7873c232f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:11.9702239Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9597E529\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb7b1-d01e-009e-34e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "45d5a52d-826f-4cee-910e-6dd7873c232f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7972785e-15ce-438a-86d7-6f823c6f071c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb7de-d01e-009e-5ce5-644931000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac90914513dc81fba8f0Fri, 06 Sep 2019 19:01:11 GMT\"0x8D732FC9591092B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "7972785e-15ce-438a-86d7-6f823c6f071c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac90914513dc81fba8f0?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" : "eefc5093-8375-4a3d-9006-540deb7bda20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb801-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "eefc5093-8375-4a3d-9006-540deb7bda20" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac90914513dc81fba8f0", "javablobsnapshotac1blobapitestsnapshotac90991862d3600bd" ] +} \ 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..ec4bae1c8a89 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac7a0296381ab528e51b?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" : "241f9c71-a8f4-467c-b7fe-72e497081d74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC95B6C24A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb863-d01e-009e-52e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "241f9c71-a8f4-467c-b7fe-72e497081d74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac7a0296381ab528e51b/javablobsnapshotac1blobapitestsnapshotac7a01955324d176d", + "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" : "438923f4-6352-4922-914f-2b44b18af7a9", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC95BD505E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb896-d01e-009e-01e5-644931000000", + "x-ms-client-request-id" : "438923f4-6352-4922-914f-2b44b18af7a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac7a0296381ab528e51b/javablobsnapshotac1blobapitestsnapshotac7a01955324d176d?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", + "x-ms-client-request-id" : "2a195415-0cef-4f43-a11b-3ebef5a7f4b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:12.2054423Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC95BD505E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb8cf-d01e-009e-34e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "2a195415-0cef-4f43-a11b-3ebef5a7f4b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0ff06414-4d8d-4be1-b7c4-01888efcf50f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb910-d01e-009e-70e5-644931000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac7a0296381ab528e51bFri, 06 Sep 2019 19:01:12 GMT\"0x8D732FC95B6C24A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "0ff06414-4d8d-4be1-b7c4-01888efcf50f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac7a0296381ab528e51b?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" : "3c45c0f2-792c-4303-ac21-1cf59b6cdb3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb93a-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "3c45c0f2-792c-4303-ac21-1cf59b6cdb3f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac7a0296381ab528e51b", "javablobsnapshotac1blobapitestsnapshotac7a01955324d176d" ] +} \ 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..cd7daffb63ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotace0c82060fc889268ed?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" : "23fc87fd-18e2-45d6-a053-292a0a0190ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC95DAA640\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb971-d01e-009e-49e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "23fc87fd-18e2-45d6-a053-292a0a0190ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotace0c82060fc889268ed/javablobsnapshotac1blobapitestsnapshotace0c86470a9a5ee1", + "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" : "0c89ecff-ee20-461a-8c25-bb81d0267757", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC95E1348D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb9b5-d01e-009e-07e5-644931000000", + "x-ms-client-request-id" : "0c89ecff-ee20-461a-8c25-bb81d0267757" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotace0c82060fc889268ed/javablobsnapshotac1blobapitestsnapshotace0c86470a9a5ee1?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", + "x-ms-client-request-id" : "6273bb89-6091-4359-8b3d-84f87a04cf6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:12.4336531Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC95E1348D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb9ea-d01e-009e-38e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "6273bb89-6091-4359-8b3d-84f87a04cf6b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "773283d7-c10d-4ac8-bb02-40faa6b0f5ff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bba0e-d01e-009e-5ae5-644931000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotace0c82060fc889268edFri, 06 Sep 2019 19:01:12 GMT\"0x8D732FC95DAA640\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "773283d7-c10d-4ac8-bb02-40faa6b0f5ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotace0c82060fc889268ed?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" : "bfe6ea12-67a3-45d2-b697-12e7d7c142e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bba22-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "bfe6ea12-67a3-45d2-b697-12e7d7c142e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotace0c82060fc889268ed", "javablobsnapshotac1blobapitestsnapshotace0c86470a9a5ee1" ] +} \ 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..c6f472e586c1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca5633519de08626c72?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" : "5f733e32-6982-4e5b-a35e-b8197be9ff32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC95FD9F93\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bba6b-d01e-009e-31e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "5f733e32-6982-4e5b-a35e-b8197be9ff32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca5633519de08626c72/javablobsnapshotac1blobapitestsnapshotaca5665436f0949ee", + "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" : "a0ffc164-aea9-43a5-addc-cdf369053a11", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9604070E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bba87-d01e-009e-4ae5-644931000000", + "x-ms-client-request-id" : "a0ffc164-aea9-43a5-addc-cdf369053a11" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca5633519de08626c72/javablobsnapshotac1blobapitestsnapshotaca5665436f0949ee", + "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" : "036ed652-92bd-47b4-85b0-3082d9c471d1" + }, + "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" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:12 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" : "\"0x8D732FC9604070E\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bbaa4-d01e-009e-64e5-644931000000", + "x-ms-client-request-id" : "036ed652-92bd-47b4-85b0-3082d9c471d1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca5633519de08626c72/javablobsnapshotac1blobapitestsnapshotaca5665436f0949ee?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", + "x-ms-client-request-id" : "22f5f6dd-6d26-485c-9b42-d7bd468bee73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:12.6888901Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9604070E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbabf-d01e-009e-7ae5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "22f5f6dd-6d26-485c-9b42-d7bd468bee73" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f51f6858-f68f-41ff-8537-36a93837aa97" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbae0-d01e-009e-17e5-644931000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotaca5633519de08626c72Fri, 06 Sep 2019 19:01:12 GMT\"0x8D732FC95FD9F93\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "f51f6858-f68f-41ff-8537-36a93837aa97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca5633519de08626c72?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" : "c6ae917a-e09e-4657-ab9c-424ee6063a9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbb08-d01e-009e-38e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "c6ae917a-e09e-4657-ab9c-424ee6063a9b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotaca5633519de08626c72", "javablobsnapshotac1blobapitestsnapshotaca5665436f0949ee" ] +} \ 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..d1e7f77fc612 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca6212231ce9d8b8b4e?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" : "4b15c1e2-7a97-4e50-afb9-8854eea43ae0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC961FAE54\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbb35-d01e-009e-60e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "4b15c1e2-7a97-4e50-afb9-8854eea43ae0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca6212231ce9d8b8b4e/javablobsnapshotac1blobapitestsnapshotaca62461226691afd", + "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" : "ba928112-63d8-4b55-9403-157f93dc92b1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9625EEFB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bbb59-d01e-009e-7ee5-644931000000", + "x-ms-client-request-id" : "ba928112-63d8-4b55-9403-157f93dc92b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca6212231ce9d8b8b4e/javablobsnapshotac1blobapitestsnapshotaca62461226691afd?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", + "x-ms-client-request-id" : "202f5021-a5f7-4467-8b42-e2c89c4ff815" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:12.8820696Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9625EEFB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbb6f-d01e-009e-11e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "202f5021-a5f7-4467-8b42-e2c89c4ff815" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f6cd2b04-8a01-468c-98a2-1e6f1fa59655" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbb92-d01e-009e-2fe5-644931000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotaca6212231ce9d8b8b4eFri, 06 Sep 2019 19:01:12 GMT\"0x8D732FC961FAE54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "f6cd2b04-8a01-468c-98a2-1e6f1fa59655", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotaca6212231ce9d8b8b4e?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" : "4066de0e-b3a4-4ead-b23a-e22214415ed9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbbaa-d01e-009e-46e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "4066de0e-b3a4-4ead-b23a-e22214415ed9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotaca6212231ce9d8b8b4e", "javablobsnapshotac1blobapitestsnapshotaca62461226691afd" ] +} \ 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..3b23cf4fbff9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101?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" : "02a0bc26-c346-4515-9523-82a479cc80c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC963CB2DB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbbd9-d01e-009e-73e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "02a0bc26-c346-4515-9523-82a479cc80c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101/javablobsnapshotac1blobapitestsnapshotac9cd28158f697b9e", + "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" : "da5400cc-3259-41ea-85db-94b70344903f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC96436917\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bbc04-d01e-009e-18e5-644931000000", + "x-ms-client-request-id" : "da5400cc-3259-41ea-85db-94b70344903f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101/javablobsnapshotac1blobapitestsnapshotac9cd28158f697b9e?comp=lease", + "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" : "5caee53e-613e-4931-97d0-398d9180bb30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC96436917\"", + "x-ms-lease-id" : "48756da2-37f0-4e53-969f-eabcf57f666b", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbc30-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "5caee53e-613e-4931-97d0-398d9180bb30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101/javablobsnapshotac1blobapitestsnapshotac9cd28158f697b9e?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", + "x-ms-client-request-id" : "e4116158-7fa4-46e0-b296-e3f5f86b6bca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:13.1202915Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC96436917\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbc60-d01e-009e-6be5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "e4116158-7fa4-46e0-b296-e3f5f86b6bca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2ca09d8a-4894-4fd4-8f23-29a56e93e183" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbc8f-d01e-009e-14e5-644931000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101Fri, 06 Sep 2019 19:01:12 GMT\"0x8D732FC963CB2DB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "2ca09d8a-4894-4fd4-8f23-29a56e93e183", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101?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" : "74e7c4ed-9e7c-4f4a-b007-501cd38fae5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbca8-d01e-009e-2be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "74e7c4ed-9e7c-4f4a-b007-501cd38fae5b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac9cd277732c6f19b101", "javablobsnapshotac1blobapitestsnapshotac9cd28158f697b9e" ] +} \ 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..47cdef3fad6f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail27a43673dc7505?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" : "cb041228-b700-40e4-8405-70d43743cc53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC966700DC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbce6-d01e-009e-65e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:12 GMT", + "x-ms-client-request-id" : "cb041228-b700-40e4-8405-70d43743cc53" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail27a43673dc7505/javablobsnapshotacfail1blobapitestsnapshotacfail27a6625841f", + "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" : "213a0922-ab88-4b8a-93a3-10e12dfcef1e", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC966EC916\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bbd12-d01e-009e-0ce5-644931000000", + "x-ms-client-request-id" : "213a0922-ab88-4b8a-93a3-10e12dfcef1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail27a43673dc7505/javablobsnapshotacfail1blobapitestsnapshotacfail27a6625841f?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", + "x-ms-client-request-id" : "4d70a591-0b34-49a8-857c-59bab98044b6" + }, + "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" : "b92bbd39-d01e-009e-31e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bbd39-d01e-009e-31e5-644931000000\nTime:2019-09-06T19:01:13.3625589Z", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "4d70a591-0b34-49a8-857c-59bab98044b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5a02b0f1-6c2f-47c4-ae44-58aab87c3b68" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbd52-d01e-009e-45e5-644931000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail27a43673dc7505Fri, 06 Sep 2019 19:01:13 GMT\"0x8D732FC966700DC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "5a02b0f1-6c2f-47c4-ae44-58aab87c3b68", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail27a43673dc7505?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" : "d3ef287d-6616-45d3-98e0-015920974eaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbd7c-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "d3ef287d-6616-45d3-98e0-015920974eaf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail27a43673dc7505", "javablobsnapshotacfail1blobapitestsnapshotacfail27a6625841f" ] +} \ 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..57e7553c7a7f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfailb7996192512809?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" : "395d7958-a688-459b-a2e4-2b54e8b14559" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC968601AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbdb9-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "395d7958-a688-459b-a2e4-2b54e8b14559" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfailb7996192512809/javablobsnapshotacfail1blobapitestsnapshotacfailb7913015a09", + "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" : "827c516e-a63e-48cc-ae70-f7eeef1f0f55", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC968C1C16\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bbde4-d01e-009e-44e5-644931000000", + "x-ms-client-request-id" : "827c516e-a63e-48cc-ae70-f7eeef1f0f55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfailb7996192512809/javablobsnapshotacfail1blobapitestsnapshotacfailb7913015a09?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", + "x-ms-client-request-id" : "26236f62-d161-4348-b359-a5b602f58d1a" + }, + "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" : "b92bbe21-d01e-009e-79e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bbe21-d01e-009e-79e5-644931000000\nTime:2019-09-06T19:01:13.5487256Z", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "26236f62-d161-4348-b359-a5b602f58d1a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6821d66d-eb18-4edd-8ede-b4807f2e6f15" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbe44-d01e-009e-19e5-644931000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfailb7996192512809Fri, 06 Sep 2019 19:01:13 GMT\"0x8D732FC968601AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "6821d66d-eb18-4edd-8ede-b4807f2e6f15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfailb7996192512809?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" : "76b1a1f6-c7ce-4723-bc34-e59c3346cdf9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbe60-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "76b1a1f6-c7ce-4723-bc34-e59c3346cdf9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfailb7996192512809", "javablobsnapshotacfail1blobapitestsnapshotacfailb7913015a09" ] +} \ 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..ac9b699ff75e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0be04977d3205f?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" : "f094c14d-3a43-4a72-8f3b-f0944cea2295" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC96A17F3C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbe8e-d01e-009e-60e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "f094c14d-3a43-4a72-8f3b-f0944cea2295" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0be04977d3205f/javablobsnapshotacfail1blobapitestsnapshotacfail0be77497bff", + "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" : "98854ae9-e9f7-4c21-a245-8315f5f0f72c", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC96A772C2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bbeb6-d01e-009e-03e5-644931000000", + "x-ms-client-request-id" : "98854ae9-e9f7-4c21-a245-8315f5f0f72c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0be04977d3205f/javablobsnapshotacfail1blobapitestsnapshotacfail0be77497bff?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", + "x-ms-client-request-id" : "39e8b4c6-624e-4c61-8caa-9fb583b6c8fa" + }, + "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" : "b92bbed9-d01e-009e-24e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bbed9-d01e-009e-24e5-644931000000\nTime:2019-09-06T19:01:13.7238822Z", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "39e8b4c6-624e-4c61-8caa-9fb583b6c8fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7a87943b-c571-44f7-bce8-f26115daf3e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbeef-d01e-009e-38e5-644931000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail0be04977d3205fFri, 06 Sep 2019 19:01:13 GMT\"0x8D732FC96A17F3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "7a87943b-c571-44f7-bce8-f26115daf3e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0be04977d3205f?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" : "e973adc5-2eac-4d5e-bdfb-76d831b078f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbf03-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "e973adc5-2eac-4d5e-bdfb-76d831b078f0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail0be04977d3205f", "javablobsnapshotacfail1blobapitestsnapshotacfail0be77497bff" ] +} \ 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..19eb292cde41 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367?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" : "50710563-bf98-4a7e-a860-e12f61e71ff7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC96BCD5AF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbf30-d01e-009e-78e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "50710563-bf98-4a7e-a860-e12f61e71ff7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367/javablobsnapshotacfail1blobapitestsnapshotacfail5b201280a17", + "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" : "8efd56b0-0aa5-49ca-8225-58bfa828636c", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC96C317A0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bbf53-d01e-009e-18e5-644931000000", + "x-ms-client-request-id" : "8efd56b0-0aa5-49ca-8225-58bfa828636c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367/javablobsnapshotacfail1blobapitestsnapshotacfail5b201280a17", + "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" : "7d529233-5f31-418b-879b-203d2a90f632" + }, + "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" : "Fri, 06 Sep 2019 19:01:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:13 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" : "\"0x8D732FC96C317A0\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:13 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bbf77-d01e-009e-39e5-644931000000", + "x-ms-client-request-id" : "7d529233-5f31-418b-879b-203d2a90f632", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367/javablobsnapshotacfail1blobapitestsnapshotacfail5b201280a17?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", + "x-ms-client-request-id" : "66b8171d-8ed3-4bf1-b6f6-e795e1bb49f2" + }, + "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" : "b92bbf94-d01e-009e-55e5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92bbf94-d01e-009e-55e5-644931000000\nTime:2019-09-06T19:01:13.9420781Z", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "66b8171d-8ed3-4bf1-b6f6-e795e1bb49f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "99a68262-4270-4ca9-9af8-16108e6b24ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bbfaf-d01e-009e-6de5-644931000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367Fri, 06 Sep 2019 19:01:13 GMT\"0x8D732FC96BCD5AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "99a68262-4270-4ca9-9af8-16108e6b24ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367?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" : "aef39e1b-4775-4a1b-b953-2f8115db05a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bbfc9-d01e-009e-05e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "aef39e1b-4775-4a1b-b953-2f8115db05a8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail5b235903055367", "javablobsnapshotacfail1blobapitestsnapshotacfail5b201280a17" ] +} \ 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..a048042a4209 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35e?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" : "eb7faeca-b980-4962-9d4e-57bcd71c73b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC96DCE829\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bbfec-d01e-009e-23e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "eb7faeca-b980-4962-9d4e-57bcd71c73b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35e/javablobsnapshotacfail1blobapitestsnapshotacfail0b7709806ff", + "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" : "bc00a934-122c-43c4-b977-6c063654aab1", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC96E3C6C8\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc02a-d01e-009e-5de5-644931000000", + "x-ms-client-request-id" : "bc00a934-122c-43c4-b977-6c063654aab1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35e/javablobsnapshotacfail1blobapitestsnapshotacfail0b7709806ff?comp=lease", + "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" : "e61fec67-b022-46b4-b8ff-4053a7bf72e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC96E3C6C8\"", + "x-ms-lease-id" : "78edcb42-6dd7-4487-8c12-20bc6df070e7", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc059-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "e61fec67-b022-46b4-b8ff-4053a7bf72e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35e/javablobsnapshotacfail1blobapitestsnapshotacfail0b7709806ff?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", + "x-ms-client-request-id" : "5a4d83aa-e44f-4f71-90ad-de4f00255bdb" + }, + "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" : "b92bc09d-d01e-009e-48e5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92bc09d-d01e-009e-48e5-644931000000\nTime:2019-09-06T19:01:14.1923018Z", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "5a4d83aa-e44f-4f71-90ad-de4f00255bdb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c6147f6c-3b6c-4200-a528-d1ba5d579d7b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc0be-d01e-009e-67e5-644931000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35eFri, 06 Sep 2019 19:01:14 GMT\"0x8D732FC96DCE829\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "c6147f6c-3b6c-4200-a528-d1ba5d579d7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35e?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" : "6b9af8e4-3205-4949-b1ba-373aaf5c0b67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc0d5-d01e-009e-7de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:13 GMT", + "x-ms-client-request-id" : "6b9af8e4-3205-4949-b1ba-373aaf5c0b67" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail0b778051e1b35e", "javablobsnapshotacfail1blobapitestsnapshotacfail0b7709806ff" ] +} \ 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..4c53649bce8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterror054786095ec10ac?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" : "00ddcb48-ca9c-4895-86c4-3fdb487623d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9707845C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bc0fd-d01e-009e-20e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "00ddcb48-ca9c-4895-86c4-3fdb487623d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterror054786095ec10ac/javablobsnapshoterror1blobapitestsnapshoterror054266285da2", + "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" : "8111ed37-434d-43d8-824a-1fa9365d053d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC97101168\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bc141-d01e-009e-5ee5-644931000000", + "x-ms-client-request-id" : "8111ed37-434d-43d8-824a-1fa9365d053d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterror054786095ec10ac/javablobsnapshoterror2blobapitestsnapshoterror0540457981fd?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", + "x-ms-client-request-id" : "8380fb7b-2617-4bae-a573-18e611b461a8" + }, + "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" : "b92bc16d-d01e-009e-09e5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92bc16d-d01e-009e-09e5-644931000000\nTime:2019-09-06T19:01:14.4124985Z", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "8380fb7b-2617-4bae-a573-18e611b461a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ba1b1b1e-0a90-4d3d-afbc-ccb10a189d88" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bc18e-d01e-009e-27e5-644931000000", + "Body" : "jtcsnapshoterrorjtcsnapshoterror0blobapitestsnapshoterror054786095ec10acFri, 06 Sep 2019 19:01:14 GMT\"0x8D732FC9707845C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "ba1b1b1e-0a90-4d3d-afbc-ccb10a189d88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterror054786095ec10ac?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" : "7073d308-062a-41a2-9a28-09c5dad2145f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bc1a7-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:14 GMT", + "x-ms-client-request-id" : "7073d308-062a-41a2-9a28-09c5dad2145f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshoterror0blobapitestsnapshoterror054786095ec10ac", "javablobsnapshoterror1blobapitestsnapshoterror054266285da2", "javablobsnapshoterror2blobapitestsnapshoterror0540457981fd" ] +} \ 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..55581278872b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707?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" : "9c61d949-28a6-41ee-a6a4-f8abf1819f76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC954D12A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb550-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "9c61d949-28a6-41ee-a6a4-f8abf1819f76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707/javablobsnapshotmetadata1blobapitestsnapshotmetadataeaa05039c", + "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" : "b927cf4f-2a3d-43ee-b215-3906522d935f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9553C717\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb587-d01e-009e-50e5-644931000000", + "x-ms-client-request-id" : "b927cf4f-2a3d-43ee-b215-3906522d935f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707/javablobsnapshotmetadata1blobapitestsnapshotmetadataeaa05039c?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", + "x-ms-client-request-id" : "fa7076b2-4cd2-4549-b118-911fc4b8c870" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:11.5017907Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9553C717\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb5be-d01e-009e-01e5-644931000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "fa7076b2-4cd2-4549-b118-911fc4b8c870" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707/javablobsnapshotmetadata1blobapitestsnapshotmetadataeaa05039c?snapshot=2019-09-06T19%3a01%3a11.5017907Z", + "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" : "d38cba64-0129-4e10-916d-11804e59f449" + }, + "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, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:11 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-06T19:01:11.5017907Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D732FC9553C717\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bb5e8-d01e-009e-22e5-644931000000", + "x-ms-client-request-id" : "d38cba64-0129-4e10-916d-11804e59f449", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "35216130-30e7-4e3a-84ce-8df323592d4c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb616-d01e-009e-4de5-644931000000", + "Body" : "jtcsnapshotmetadatajtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707Fri, 06 Sep 2019 19:01:11 GMT\"0x8D732FC954D12A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "35216130-30e7-4e3a-84ce-8df323592d4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707?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" : "2786f8c0-114e-4a5f-95d6-9aa7964b14a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb62e-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "2786f8c0-114e-4a5f-95d6-9aa7964b14a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmetadata0blobapitestsnapshotmetadataeaa828958707", "javablobsnapshotmetadata1blobapitestsnapshotmetadataeaa05039c" ] +} \ 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..a10cdfb8603d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22?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" : "8d498f7c-f6b6-4d43-ac26-41497eb5b242" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC956EFA57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb662-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "8d498f7c-f6b6-4d43-ac26-41497eb5b242" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22/javablobsnapshotmetadata1blobapitestsnapshotmetadataec103955d", + "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" : "cd685d8a-074e-4b81-92d2-466bcc224fc9", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC957539B2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bb685-d01e-009e-2fe5-644931000000", + "x-ms-client-request-id" : "cd685d8a-074e-4b81-92d2-466bcc224fc9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22/javablobsnapshotmetadata1blobapitestsnapshotmetadataec103955d?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", + "x-ms-client-request-id" : "0d73f6cd-e98a-42bf-b448-ac8304f9c8ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:01:11.7239955Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC957B2E93\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bb6bc-d01e-009e-5de5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "0d73f6cd-e98a-42bf-b448-ac8304f9c8ba" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22/javablobsnapshotmetadata1blobapitestsnapshotmetadataec103955d?snapshot=2019-09-06T19%3a01%3a11.7239955Z", + "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" : "5b49c7a6-ac7e-4d38-b28a-9e7688fce0b6" + }, + "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, 06 Sep 2019 19:01:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01:11 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-06T19:01:11.7239955Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D732FC957B2E93\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92bb6df-d01e-009e-7de5-644931000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "5b49c7a6-ac7e-4d38-b28a-9e7688fce0b6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c33f939-3c05-4aee-a414-74c70be32c10" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bb6f9-d01e-009e-13e5-644931000000", + "Body" : "jtcsnapshotmetadatajtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22Fri, 06 Sep 2019 19:01:11 GMT\"0x8D732FC956EFA57\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "4c33f939-3c05-4aee-a414-74c70be32c10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22?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" : "1f48ae65-0e32-449f-b97f-da137aa8d5d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92bb715-d01e-009e-2ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:11 GMT", + "x-ms-client-request-id" : "1f48ae65-0e32-449f-b97f-da137aa8d5d7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmetadata0blobapitestsnapshotmetadataec134740bf22", "javablobsnapshotmetadata1blobapitestsnapshotmetadataec103955d" ] +} \ 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..9758521a613e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy7a96860392a821fb53eb?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" : "9bb279e6-a29d-4d6a-84b2-7e135fd66429" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FC9FD4D256\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92bfdb7-d01e-009e-16e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "9bb279e6-a29d-4d6a-84b2-7e135fd66429" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy7a96860392a821fb53eb/javablobsynccopy1blobapitestsynccopy7a921051ffc267183", + "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" : "f2bda368-ad98-4344-892e-f6dc4d25776f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FC9FDBEA27\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92bfe24-d01e-009e-76e5-644931000000", + "x-ms-client-request-id" : "f2bda368-ad98-4344-892e-f6dc4d25776f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy7a96860392a821fb53eb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "86878d7a-ce31-4134-9a96-9b6d74ba65de", + "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" : "\"0x8D732FC9FE271FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92bfe5b-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:28 GMT", + "x-ms-client-request-id" : "86878d7a-ce31-4134-9a96-9b6d74ba65de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy7a96860392a821fb53eb/javablobsynccopy2blobapitestsynccopy7a90530088f130c62", + "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" : "9a9be79c-d3c1-489f-9d00-a879dba263fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "afc85735-619a-4544-8cba-59482d3d5787", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:29 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "ETag" : "\"0x8D732FCA013705D\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92bfea0-d01e-009e-63e5-644931000000", + "x-ms-client-request-id" : "9a9be79c-d3c1-489f-9d00-a879dba263fc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "70756d65-0e3a-460a-88a9-11de90201e5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c003f-d01e-009e-61e5-644931000000", + "Body" : "jtcsynccopyjtcsynccopy0blobapitestsynccopy7a96860392a821fb53ebFri, 06 Sep 2019 19:01:29 GMT\"0x8D732FC9FE271FB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "70756d65-0e3a-460a-88a9-11de90201e5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy7a96860392a821fb53eb?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" : "e31c29e4-34b9-463e-891e-250585d4c7a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c005e-d01e-009e-7ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "e31c29e4-34b9-463e-891e-250585d4c7a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopy0blobapitestsynccopy7a96860392a821fb53eb", "javablobsynccopy1blobapitestsynccopy7a921051ffc267183", "javablobsynccopy2blobapitestsynccopy7a90530088f130c62" ] +} \ 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..eb347b85681d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c?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" : "aef96f9a-c227-41ad-93b1-fb9532f50662" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA327319B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c14fc-d01e-009e-6fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "aef96f9a-c227-41ad-93b1-fb9532f50662" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c/javablobsynccopydestac1blobapitestsynccopydestacc6464588d33", + "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" : "d12fd4d9-41ae-4d21-b4c3-2a1a9aaa0e5a", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA3397659\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1595-d01e-009e-80e5-644931000000", + "x-ms-client-request-id" : "d12fd4d9-41ae-4d21-b4c3-2a1a9aaa0e5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "33c4c5e9-9a1d-4780-9a39-686130d3fc01", + "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" : "\"0x8D732FCA3400188\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c15b4-d01e-009e-1ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "33c4c5e9-9a1d-4780-9a39-686130d3fc01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c/javablobsynccopydestac2blobapitestsynccopydestacc64939410c0", + "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" : "863e840e-36e1-46ae-b989-6c1a5dd9fbfe", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA34671B7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c15dc-d01e-009e-43e5-644931000000", + "x-ms-client-request-id" : "863e840e-36e1-46ae-b989-6c1a5dd9fbfe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c/javablobsynccopydestac2blobapitestsynccopydestacc64939410c0", + "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" : "eb39ff97-08c4-442b-bf9e-5f91325498ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0e935934-2b0a-4dea-ae01-004bbc04940b", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "ETag" : "\"0x8D732FCA3561492\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c1601-d01e-009e-64e5-644931000000", + "x-ms-client-request-id" : "eb39ff97-08c4-442b-bf9e-5f91325498ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "43a4db30-98b4-47e8-bd56-a333c1441689" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c16a0-d01e-009e-79e5-644931000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestacc649683860fb5cFri, 06 Sep 2019 19:01:34 GMT\"0x8D732FCA3400188\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "43a4db30-98b4-47e8-bd56-a333c1441689", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c?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" : "e6334d49-f87e-4bb1-bdff-95ef1889cb3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c16d3-d01e-009e-28e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "e6334d49-f87e-4bb1-bdff-95ef1889cb3a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestacc649683860fb5c", "javablobsynccopydestac1blobapitestsynccopydestacc6464588d33", "javablobsynccopydestac2blobapitestsynccopydestacc64939410c0" ] +} \ 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..e5b8987d4dc8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4?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" : "08652829-30e1-4809-9868-9ace86f06c7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA36F6EC2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c16fc-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "08652829-30e1-4809-9868-9ace86f06c7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4/javablobsynccopydestac1blobapitestsynccopydestacb0f43780be8", + "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" : "9d320a1c-5bef-437b-8335-4a8a8d43fb3d", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA38D9DC3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c17cf-d01e-009e-11e5-644931000000", + "x-ms-client-request-id" : "9d320a1c-5bef-437b-8335-4a8a8d43fb3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6ba78948-f5c9-44a5-913f-24fe44cfb2dc", + "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" : "\"0x8D732FCA396E928\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1809-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "6ba78948-f5c9-44a5-913f-24fe44cfb2dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4/javablobsynccopydestac2blobapitestsynccopydestacb0f97145420", + "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" : "ecdca3a8-fc94-453f-a671-f1a52723c8ef", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA3B3300F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c18bd-d01e-009e-6ce5-644931000000", + "x-ms-client-request-id" : "ecdca3a8-fc94-453f-a671-f1a52723c8ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4/javablobsynccopydestac2blobapitestsynccopydestacb0f97145420", + "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" : "8932cf10-c660-46be-9c50-89e19a8c7629" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b2948d86-ba25-46d6-bad2-e86a6f45cec9", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:35 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "ETag" : "\"0x8D732FCA3BF27BE\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c1902-d01e-009e-28e5-644931000000", + "x-ms-client-request-id" : "8932cf10-c660-46be-9c50-89e19a8c7629" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6fe277e5-b857-4ebb-8140-caeb0ae22aa2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1939-d01e-009e-59e5-644931000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4Fri, 06 Sep 2019 19:01:35 GMT\"0x8D732FCA396E928\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "6fe277e5-b857-4ebb-8140-caeb0ae22aa2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4?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" : "99a76c20-453c-4e96-9582-d0e68612f9bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c195b-d01e-009e-79e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "99a76c20-453c-4e96-9582-d0e68612f9bd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestacb0f510276b04f4", "javablobsynccopydestac1blobapitestsynccopydestacb0f43780be8", "javablobsynccopydestac2blobapitestsynccopydestacb0f97145420" ] +} \ 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..f078fc914503 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7?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" : "c989b071-d96d-484a-bd76-eba8e5a61194" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA3D1545E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c197c-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "c989b071-d96d-484a-bd76-eba8e5a61194" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7/javablobsynccopydestac1blobapitestsynccopydestac03e2878719a", + "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" : "80b5373e-ca89-44a0-8bc8-d87eea9cc17f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA3D6ED36\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c19a8-d01e-009e-42e5-644931000000", + "x-ms-client-request-id" : "80b5373e-ca89-44a0-8bc8-d87eea9cc17f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8dc8198e-07bd-4f45-b891-92c843d2095b", + "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" : "\"0x8D732FCA3DC4050\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c19be-d01e-009e-57e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "8dc8198e-07bd-4f45-b891-92c843d2095b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7/javablobsynccopydestac2blobapitestsynccopydestac03e67662de5", + "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" : "88b12e7d-36aa-40ab-b716-7ae1dd47200e", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA3E176FF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c19df-d01e-009e-78e5-644931000000", + "x-ms-client-request-id" : "88b12e7d-36aa-40ab-b716-7ae1dd47200e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7/javablobsynccopydestac2blobapitestsynccopydestac03e67662de5", + "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" : "262daff2-4bca-407e-b6c6-72b6e5c2c069" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0786917b-057a-4862-926e-3a89a9517a49", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:35 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "ETag" : "\"0x8D732FCA3EDBC8D\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c1a12-d01e-009e-23e5-644931000000", + "x-ms-client-request-id" : "262daff2-4bca-407e-b6c6-72b6e5c2c069" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b5b9d606-1827-4238-8bd2-809dd88c5937" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1a98-d01e-009e-20e5-644931000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7Fri, 06 Sep 2019 19:01:35 GMT\"0x8D732FCA3DC4050\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "b5b9d606-1827-4238-8bd2-809dd88c5937", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7?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" : "40f1dcf9-b3c8-4790-bb27-38046fd3a9dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c1ac3-d01e-009e-4ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "40f1dcf9-b3c8-4790-bb27-38046fd3a9dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac03e832006cefd7", "javablobsynccopydestac1blobapitestsynccopydestac03e2878719a", "javablobsynccopydestac2blobapitestsynccopydestac03e67662de5" ] +} \ 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..07972e02d626 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567?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" : "fd5c86f2-44e1-4163-b8b2-55e3b8fd41c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA40E6B75\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c1b00-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "fd5c86f2-44e1-4163-b8b2-55e3b8fd41c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567/javablobsynccopydestac1blobapitestsynccopydestac49c3762403d", + "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" : "8de9ff8f-0428-4334-b874-7e14006e31fa", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA41452E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1b2f-d01e-009e-29e5-644931000000", + "x-ms-client-request-id" : "8de9ff8f-0428-4334-b874-7e14006e31fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "941712c6-7273-493c-bd15-b2fbaee11202", + "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" : "\"0x8D732FCA419F47E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1b52-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "x-ms-client-request-id" : "941712c6-7273-493c-bd15-b2fbaee11202" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567/javablobsynccopydestac2blobapitestsynccopydestac49c97315161", + "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" : "6d40e347-2fed-437d-8d76-2b5e89bb2cae", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA41F51F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1b80-d01e-009e-71e5-644931000000", + "x-ms-client-request-id" : "6d40e347-2fed-437d-8d76-2b5e89bb2cae" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567/javablobsynccopydestac2blobapitestsynccopydestac49c97315161", + "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" : "a32534bc-2fb6-402a-8234-f8b72c3c314c" + }, + "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" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FCA41F51F9\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:36 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c1ba5-d01e-009e-14e5-644931000000", + "x-ms-client-request-id" : "a32534bc-2fb6-402a-8234-f8b72c3c314c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567/javablobsynccopydestac2blobapitestsynccopydestac49c97315161", + "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" : "db245f7d-a241-441e-989e-3d5ddbc64c03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0a7d4ed2-98c6-47d1-9447-23e814c10c95", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "ETag" : "\"0x8D732FCA4342498\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c1be0-d01e-009e-48e5-644931000000", + "x-ms-client-request-id" : "db245f7d-a241-441e-989e-3d5ddbc64c03" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "901146a8-097c-4681-b958-3fa3506374af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1c64-d01e-009e-41e5-644931000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567Fri, 06 Sep 2019 19:01:36 GMT\"0x8D732FCA419F47E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "901146a8-097c-4681-b958-3fa3506374af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567?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" : "4eac1221-879c-4bd5-868b-cc5d3a2ec0c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c1c8d-d01e-009e-66e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "4eac1221-879c-4bd5-868b-cc5d3a2ec0c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac49c83786eb5567", "javablobsynccopydestac1blobapitestsynccopydestac49c3762403d", "javablobsynccopydestac2blobapitestsynccopydestac49c97315161" ] +} \ 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..ba67b877a57f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9?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" : "a98d6fdf-81e5-4210-847c-239d47e87916" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA44F2CDD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c1cb9-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "a98d6fdf-81e5-4210-847c-239d47e87916" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9/javablobsynccopydestac1blobapitestsynccopydestac50b97208a9f", + "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" : "93697aa8-84a0-4fac-a31e-409f65739b88", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA4556303\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1d1b-d01e-009e-68e5-644931000000", + "x-ms-client-request-id" : "93697aa8-84a0-4fac-a31e-409f65739b88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c86b256-245a-49e7-8d4c-6a60950f50c9", + "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" : "\"0x8D732FCA45B04D2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1d3f-d01e-009e-07e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "1c86b256-245a-49e7-8d4c-6a60950f50c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9/javablobsynccopydestac2blobapitestsynccopydestac50b45076481", + "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" : "ba28418c-875d-4f3b-ba5e-1bb8dc36e47b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA460D75F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1d70-d01e-009e-34e5-644931000000", + "x-ms-client-request-id" : "ba28418c-875d-4f3b-ba5e-1bb8dc36e47b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9/javablobsynccopydestac2blobapitestsynccopydestac50b45076481", + "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" : "973a37fd-d8bf-4a60-8e10-a65b6925ee4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "8df6a753-91c6-404c-9367-205c4f9bd62e", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "ETag" : "\"0x8D732FCA46A8350\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c1d8a-d01e-009e-4ce5-644931000000", + "x-ms-client-request-id" : "973a37fd-d8bf-4a60-8e10-a65b6925ee4a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c43d0ab-a5d1-4946-be5a-6497f878a4be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1e29-d01e-009e-64e5-644931000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9Fri, 06 Sep 2019 19:01:36 GMT\"0x8D732FCA45B04D2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "4c43d0ab-a5d1-4946-be5a-6497f878a4be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9?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" : "6d35b87a-095a-4aec-96ef-4ad9adc38b7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c1e57-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "6d35b87a-095a-4aec-96ef-4ad9adc38b7e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac50b467468f3dc9", "javablobsynccopydestac1blobapitestsynccopydestac50b97208a9f", "javablobsynccopydestac2blobapitestsynccopydestac50b45076481" ] +} \ 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..eb4c462c6112 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4?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" : "f1083e3a-6bfd-4a12-bea6-9bb1090bc953" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA489AB30\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c1e9d-d01e-009e-4fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "f1083e3a-6bfd-4a12-bea6-9bb1090bc953" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4/javablobsynccopydestac1blobapitestsynccopydestac72e7587423b", + "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" : "cf0acce8-96a8-471b-9a1e-b4abbe298031", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA48F9394\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1ed3-d01e-009e-7ee5-644931000000", + "x-ms-client-request-id" : "cf0acce8-96a8-471b-9a1e-b4abbe298031" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a99393a3-4a92-44fd-a190-810265b6a364", + "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" : "\"0x8D732FCA494E769\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1f0b-d01e-009e-32e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "a99393a3-4a92-44fd-a190-810265b6a364" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4/javablobsynccopydestac2blobapitestsynccopydestac72e19275392", + "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" : "22b9aac5-97ac-41da-9dd5-7c1fc1125570", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA4A5E000\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1faa-d01e-009e-47e5-644931000000", + "x-ms-client-request-id" : "22b9aac5-97ac-41da-9dd5-7c1fc1125570" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4/javablobsynccopydestac2blobapitestsynccopydestac72e19275392?comp=lease", + "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" : "c8e1b881-d6b0-4334-b942-102239983a78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA4A5E000\"", + "x-ms-lease-id" : "538a9547-b65e-462c-9091-40430a71a8dd", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c1fd6-d01e-009e-6fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "x-ms-client-request-id" : "c8e1b881-d6b0-4334-b942-102239983a78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4/javablobsynccopydestac2blobapitestsynccopydestac72e19275392", + "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" : "b442e661-8245-404c-a049-1ad9e50333c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "6d6e1289-5634-4417-b4fc-a5abb58e52d3", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:36 GMT", + "ETag" : "\"0x8D732FCA4B643AE\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c2017-d01e-009e-2be5-644931000000", + "x-ms-client-request-id" : "b442e661-8245-404c-a049-1ad9e50333c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5dc8eeac-8326-4fd9-9a96-1532d05397a3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c20fc-d01e-009e-5ae5-644931000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4Fri, 06 Sep 2019 19:01:37 GMT\"0x8D732FCA494E769\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "5dc8eeac-8326-4fd9-9a96-1532d05397a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4?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" : "bb8f97cf-fa61-4518-90cd-c8b33c021a37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c212a-d01e-009e-80e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "bb8f97cf-fa61-4518-90cd-c8b33c021a37" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac72e3274402d5b4", "javablobsynccopydestac1blobapitestsynccopydestac72e7587423b", "javablobsynccopydestac2blobapitestsynccopydestac72e19275392" ] +} \ 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..2433bddec6ef --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130?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" : "4f72c42d-644e-406b-a698-1435d2e533c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA4D6A45A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c216e-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "4f72c42d-644e-406b-a698-1435d2e533c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130/javablobsynccopydestacfail147948125bc2a0cdf9410", + "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" : "0b11e704-8417-4db8-831f-776e046cc181", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA4DC8D61\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2196-d01e-009e-5fe5-644931000000", + "x-ms-client-request-id" : "0b11e704-8417-4db8-831f-776e046cc181" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "06674863-417e-497c-ba04-7876df920fb0", + "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" : "\"0x8D732FCA4E1E172\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c21c1-d01e-009e-02e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "06674863-417e-497c-ba04-7876df920fb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130/javablobsynccopydestacfail240026808b16a90a534b4", + "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" : "f330970e-897b-4f27-8849-c2f36099f32c", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA4E73E46\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c21de-d01e-009e-1ae5-644931000000", + "x-ms-client-request-id" : "f330970e-897b-4f27-8849-c2f36099f32c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130/javablobsynccopydestacfail240026808b16a90a534b4", + "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" : "79502f94-10dc-4d55-b0e1-94a44ba06ac5" + }, + "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" : "b92c2205-d01e-009e-3ae5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c2205-d01e-009e-3ae5-644931000000\nTime:2019-09-06T19:01:37.6643689Z", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "79502f94-10dc-4d55-b0e1-94a44ba06ac5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "21b9ff0d-f50b-4ca6-940e-97cf19aca69f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2278-d01e-009e-21e5-644931000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130Fri, 06 Sep 2019 19:01:37 GMT\"0x8D732FCA4E1E172\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "21b9ff0d-f50b-4ca6-940e-97cf19aca69f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130?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" : "1ecb751d-ea8e-41f0-9815-928b77742301" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c229f-d01e-009e-43e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "1ecb751d-ea8e-41f0-9815-928b77742301" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail5799538130", "javablobsynccopydestacfail147948125bc2a0cdf9410", "javablobsynccopydestacfail240026808b16a90a534b4" ] +} \ 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..1cfe1c7bcbbf --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737?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" : "449d063b-f601-4a2a-acbd-2ce4257b7e4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA50623B0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c22c4-d01e-009e-63e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "449d063b-f601-4a2a-acbd-2ce4257b7e4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737/javablobsynccopydestacfail125658a6755fd15e8c494", + "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" : "79653ab6-779a-45b7-a11c-a86dc8705af2", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA50CD097\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c22f3-d01e-009e-08e5-644931000000", + "x-ms-client-request-id" : "79653ab6-779a-45b7-a11c-a86dc8705af2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a8b352c9-3afd-40d5-a965-82ecdfd0e079", + "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" : "\"0x8D732FCA515CF48\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c232a-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "a8b352c9-3afd-40d5-a965-82ecdfd0e079" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737/javablobsynccopydestacfail25913344dd9b76ce89436", + "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" : "1ff174cf-9c3f-44aa-86e5-704f7bb835ff", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA51B52FB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2350-d01e-009e-53e5-644931000000", + "x-ms-client-request-id" : "1ff174cf-9c3f-44aa-86e5-704f7bb835ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737/javablobsynccopydestacfail25913344dd9b76ce89436", + "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" : "b6b41131-42c1-4dd0-b66f-1a51dd7ab37d" + }, + "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" : "b92c237b-d01e-009e-7ce5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c237b-d01e-009e-7ce5-644931000000\nTime:2019-09-06T19:01:38.0316981Z", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "b6b41131-42c1-4dd0-b66f-1a51dd7ab37d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "34437649-c41f-413c-807e-4600951ad41e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2456-d01e-009e-2ce5-644931000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737Fri, 06 Sep 2019 19:01:37 GMT\"0x8D732FCA515CF48\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "34437649-c41f-413c-807e-4600951ad41e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737?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" : "52212196-e93a-4aaa-9b40-d3bd4158460f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c2485-d01e-009e-55e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "52212196-e93a-4aaa-9b40-d3bd4158460f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail7b04775737", "javablobsynccopydestacfail125658a6755fd15e8c494", "javablobsynccopydestacfail25913344dd9b76ce89436" ] +} \ 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..5f9a6a776539 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500?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" : "e54acaae-5507-4426-8d00-32761b7112d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA544C1AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c24d2-d01e-009e-18e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "e54acaae-5507-4426-8d00-32761b7112d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500/javablobsynccopydestacfail195407b98d7d29cc4e434", + "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" : "ec6a55f8-e641-4fd7-9d49-f30e96e74f7b", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA54AD2BA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c24fb-d01e-009e-3ee5-644931000000", + "x-ms-client-request-id" : "ec6a55f8-e641-4fd7-9d49-f30e96e74f7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fff63263-fe88-447d-8e51-a026c1101ec3", + "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" : "\"0x8D732FCA5502739\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2529-d01e-009e-6ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "x-ms-client-request-id" : "fff63263-fe88-447d-8e51-a026c1101ec3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500/javablobsynccopydestacfail22868454c34115fd504d6", + "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" : "a0b813fd-8c3f-4ade-8770-5534672dd239", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA555839B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2549-d01e-009e-07e5-644931000000", + "x-ms-client-request-id" : "a0b813fd-8c3f-4ade-8770-5534672dd239" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500/javablobsynccopydestacfail22868454c34115fd504d6", + "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" : "6c0463f0-c2a3-4d84-8952-0ce2ef704335" + }, + "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" : "b92c2570-d01e-009e-2ae5-644931000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c2570-d01e-009e-2ae5-644931000000\nTime:2019-09-06T19:01:38.3569897Z", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "6c0463f0-c2a3-4d84-8952-0ce2ef704335", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e6107b66-b35d-47a6-b834-e09225fadd66" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c259d-d01e-009e-55e5-644931000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500Fri, 06 Sep 2019 19:01:38 GMT\"0x8D732FCA5502739\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "e6107b66-b35d-47a6-b834-e09225fadd66", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500?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" : "997808c3-4372-4bb1-b3ed-497cd5145bc5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c25ca-d01e-009e-7fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "997808c3-4372-4bb1-b3ed-497cd5145bc5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail0cc2610500", "javablobsynccopydestacfail195407b98d7d29cc4e434", "javablobsynccopydestacfail22868454c34115fd504d6" ] +} \ 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..8ac693e45c68 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e?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" : "5b7378c7-92aa-4ee1-8088-7381dabc378b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA5781278\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2648-d01e-009e-72e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "5b7378c7-92aa-4ee1-8088-7381dabc378b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e/javablobsynccopydestacfail1236282ea0389f53b6429", + "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" : "a100a253-aeee-4eb3-a270-88573309d4b4", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA57DFCD0\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2670-d01e-009e-12e5-644931000000", + "x-ms-client-request-id" : "a100a253-aeee-4eb3-a270-88573309d4b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9fbe229c-70b6-41fc-ab0e-3b5fd11ec739", + "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" : "\"0x8D732FCA583EDF8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c26b4-d01e-009e-4ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "9fbe229c-70b6-41fc-ab0e-3b5fd11ec739" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e/javablobsynccopydestacfail202135e6e200d6a4f5447", + "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" : "359c7c57-0ce4-493a-9a31-56d2c8394f36", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA58B4674\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c26f2-d01e-009e-08e5-644931000000", + "x-ms-client-request-id" : "359c7c57-0ce4-493a-9a31-56d2c8394f36" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e/javablobsynccopydestacfail202135e6e200d6a4f5447", + "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" : "d0f43b52-de82-4a1a-9c61-6db1ad2b59fc" + }, + "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" : "Fri, 06 Sep 2019 19:01:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FCA58B4674\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:38 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c2718-d01e-009e-2be5-644931000000", + "x-ms-client-request-id" : "d0f43b52-de82-4a1a-9c61-6db1ad2b59fc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e/javablobsynccopydestacfail202135e6e200d6a4f5447", + "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" : "f04d035d-17e9-4d71-a6ff-c70380398bef" + }, + "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" : "b92c273f-d01e-009e-4fe5-644931000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c273f-d01e-009e-4fe5-644931000000\nTime:2019-09-06T19:01:38.8164039Z", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "f04d035d-17e9-4d71-a6ff-c70380398bef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eb12d05a-1246-440d-b6f8-ddf3c0f1cf02" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2827-d01e-009e-18e5-644931000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472eFri, 06 Sep 2019 19:01:38 GMT\"0x8D732FCA583EDF8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "eb12d05a-1246-440d-b6f8-ddf3c0f1cf02", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e?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" : "bde9ee8d-f460-4038-b521-1c1994d6bc15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c2855-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "bde9ee8d-f460-4038-b521-1c1994d6bc15" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfailb5b861472e", "javablobsynccopydestacfail1236282ea0389f53b6429", "javablobsynccopydestacfail202135e6e200d6a4f5447" ] +} \ 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..10d4f77063ae --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3?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" : "24ecf085-bf6a-4d8f-a303-a85d8d0dcbcf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA5C42128\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2883-d01e-009e-69e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "24ecf085-bf6a-4d8f-a303-a85d8d0dcbcf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3/javablobsynccopydestacfail113702ae3a6d62db8f4eb", + "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" : "65991c2d-3eab-4aef-9786-65fa822c2854", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA5CB6C00\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c28be-d01e-009e-17e5-644931000000", + "x-ms-client-request-id" : "65991c2d-3eab-4aef-9786-65fa822c2854" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f7e55ad-60d8-40d1-b5a6-0ca534fab265", + "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" : "\"0x8D732FCA5D15D63\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c28f3-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "8f7e55ad-60d8-40d1-b5a6-0ca534fab265" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3/javablobsynccopydestacfail2122089ba70e0d07d5457", + "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" : "3a5eb156-03ea-4e7c-8134-099e399de4ae", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA5D70790\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2914-d01e-009e-60e5-644931000000", + "x-ms-client-request-id" : "3a5eb156-03ea-4e7c-8134-099e399de4ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3/javablobsynccopydestacfail2122089ba70e0d07d5457?comp=lease", + "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" : "1e602284-9c54-4f78-858c-1484ae10b0f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA5D70790\"", + "x-ms-lease-id" : "76bfff7b-3061-4024-8a69-86cfc22cafbf", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2930-d01e-009e-7ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "1e602284-9c54-4f78-858c-1484ae10b0f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3/javablobsynccopydestacfail2122089ba70e0d07d5457", + "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" : "c485e23d-30fb-4e30-8bd7-4a5140086cae" + }, + "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" : "b92c2958-d01e-009e-1ce5-644931000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b92c2958-d01e-009e-1ce5-644931000000\nTime:2019-09-06T19:01:39.3318691Z", + "Date" : "Fri, 06 Sep 2019 19:01:38 GMT", + "x-ms-client-request-id" : "c485e23d-30fb-4e30-8bd7-4a5140086cae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f3062db6-3771-44a3-b166-005fcef81de0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c29ee-d01e-009e-26e5-644931000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3Fri, 06 Sep 2019 19:01:39 GMT\"0x8D732FCA5D15D63\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "f3062db6-3771-44a3-b166-005fcef81de0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3?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" : "4b0ce5a8-f69f-4d47-bf74-d4113523a3af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c2a19-d01e-009e-4ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "4b0ce5a8-f69f-4d47-bf74-d4113523a3af" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail1bc54387e3", "javablobsynccopydestacfail113702ae3a6d62db8f4eb", "javablobsynccopydestacfail2122089ba70e0d07d5457" ] +} \ 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..bf8d6d729dc2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerrord7e94927a363ab0?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" : "ad24edd8-a4f5-4ea1-b529-a726e206a0e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA6030D73\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c2a64-d01e-009e-0de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "ad24edd8-a4f5-4ea1-b529-a726e206a0e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerrord7e94927a363ab0/javablobsynccopyerror1blobapitestsynccopyerrord7e02628443e", + "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" : "75edfce9-e996-4225-8d85-59c7cf7d2cf5", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA60C7C27\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c2a8b-d01e-009e-2de5-644931000000", + "x-ms-client-request-id" : "75edfce9-e996-4225-8d85-59c7cf7d2cf5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerrord7e94927a363ab0/javablobsynccopyerror2blobapitestsynccopyerrord7e89576cb6c", + "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" : "6adb170e-b9f5-40bd-9cdf-2aa22a952fda" + }, + "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" : "b92c2ac3-d01e-009e-59e5-644931000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:b92c2ac3-d01e-009e-59e5-644931000000\nTime:2019-09-06T19:01:39.5700826Z", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "6adb170e-b9f5-40bd-9cdf-2aa22a952fda", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ba8c77d9-5fbd-4d97-a774-7a273bf30dee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c2afb-d01e-009e-0ae5-644931000000", + "Body" : "jtcsynccopyerrorjtcsynccopyerror0blobapitestsynccopyerrord7e94927a363ab0Fri, 06 Sep 2019 19:01:39 GMT\"0x8D732FCA6030D73\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "ba8c77d9-5fbd-4d97-a774-7a273bf30dee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerrord7e94927a363ab0?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" : "02d8fe36-b854-4bce-8d2d-757789f02b47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c2b27-d01e-009e-33e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:39 GMT", + "x-ms-client-request-id" : "02d8fe36-b854-4bce-8d2d-757789f02b47" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopyerror0blobapitestsynccopyerrord7e94927a363ab0", "javablobsynccopyerror1blobapitestsynccopyerrord7e02628443e", "javablobsynccopyerror2blobapitestsynccopyerrord7e89576cb6c" ] +} \ 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..ff5cdef1b2ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed?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" : "59b4e1d2-d6d9-4d92-a72b-abc86384edf9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA090853D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c02d4-d01e-009e-37e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "59b4e1d2-d6d9-4d92-a72b-abc86384edf9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed/javablobsynccopymetadata1blobapitestsynccopymetadataa4f24554b", + "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" : "b341f3fb-d40f-4bf6-868e-19c6ce23bb47", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA0970228\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c0302-d01e-009e-5ee5-644931000000", + "x-ms-client-request-id" : "b341f3fb-d40f-4bf6-868e-19c6ce23bb47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "689ceb3f-6e8b-4467-a122-aeb8337cb3fa", + "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" : "\"0x8D732FCA09CC758\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0323-d01e-009e-7de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "689ceb3f-6e8b-4467-a122-aeb8337cb3fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed/javablobsynccopymetadata2blobapitestsynccopymetadataa4f560022", + "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" : "3b23ff84-74ad-4199-a339-0e02b7b603b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "38ea2786-b9ad-405d-b861-0289af5aeb2d", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "ETag" : "\"0x8D732FCA0A6F890\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c033e-d01e-009e-17e5-644931000000", + "x-ms-client-request-id" : "3b23ff84-74ad-4199-a339-0e02b7b603b0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed/javablobsynccopymetadata2blobapitestsynccopymetadataa4f560022", + "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" : "54c3c5ca-7d04-41d2-87f8-18522b42dcda" + }, + "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" : "Fri, 06 Sep 2019 19:01:30 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" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c03b5-d01e-009e-05e5-644931000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "38ea2786-b9ad-405d-b861-0289af5aeb2d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed/javablobsynccopymetadata1blobapitestsynccopymetadataa4f24554b", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FCA0A6F890\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "54c3c5ca-7d04-41d2-87f8-18522b42dcda" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e3816984-b299-41a6-9e23-c7606f2c8221" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c03d2-d01e-009e-22e5-644931000000", + "Body" : "jtcsynccopymetadatajtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4edFri, 06 Sep 2019 19:01:30 GMT\"0x8D732FCA09CC758\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "e3816984-b299-41a6-9e23-c7606f2c8221", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed?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" : "34188e85-8e31-4574-9135-9aaf61a4305e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c03ef-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "34188e85-8e31-4574-9135-9aaf61a4305e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymetadata0blobapitestsynccopymetadataa4f15171c4ed", "javablobsynccopymetadata1blobapitestsynccopymetadataa4f24554b", "javablobsynccopymetadata2blobapitestsynccopymetadataa4f560022" ] +} \ 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..3a8650a406ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff?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" : "facf9d63-fa87-4938-9c1e-c13b23da57c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA0D84D17\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c049e-d01e-009e-60e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "facf9d63-fa87-4938-9c1e-c13b23da57c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff/javablobsynccopymetadata1blobapitestsynccopymetadata8e3499961", + "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" : "9c8609cf-6474-4d33-841b-c34b8b29121f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA0DF18CB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c04cf-d01e-009e-0ae5-644931000000", + "x-ms-client-request-id" : "9c8609cf-6474-4d33-841b-c34b8b29121f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "87b4b049-6b21-45df-a0a1-34c947a2c8cf", + "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" : "\"0x8D732FCA0E5A1B3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c04ee-d01e-009e-27e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "87b4b049-6b21-45df-a0a1-34c947a2c8cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff/javablobsynccopymetadata2blobapitestsynccopymetadata8e337378c", + "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" : "5c7ef259-0714-4337-838b-40dd8492f9db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "979ef498-228a-451a-aefe-0b2ef1313f27", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "ETag" : "\"0x8D732FCA0EDD5DE\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c0516-d01e-009e-49e5-644931000000", + "x-ms-client-request-id" : "5c7ef259-0714-4337-838b-40dd8492f9db" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff/javablobsynccopymetadata2blobapitestsynccopymetadata8e337378c", + "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" : "7de6471e-fd1b-4a09-9a85-4a092eebe531" + }, + "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" : "Fri, 06 Sep 2019 19:01:30 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" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c05be-d01e-009e-61e5-644931000000", + "x-ms-meta-fizz" : "buzz", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "979ef498-228a-451a-aefe-0b2ef1313f27", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff/javablobsynccopymetadata1blobapitestsynccopymetadata8e3499961", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-meta-foo" : "bar", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FCA0EDD5DE\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "7de6471e-fd1b-4a09-9a85-4a092eebe531" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4663ec0d-5daa-445d-be12-f2298ca5d83a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c05f3-d01e-009e-12e5-644931000000", + "Body" : "jtcsynccopymetadatajtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ffFri, 06 Sep 2019 19:01:30 GMT\"0x8D732FCA0E5A1B3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "4663ec0d-5daa-445d-be12-f2298ca5d83a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff?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" : "6d196f42-3c0e-4ee7-af8b-5c5274e1b7ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c0622-d01e-009e-3de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "6d196f42-3c0e-4ee7-af8b-5c5274e1b7ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymetadata0blobapitestsynccopymetadata8e309244e8ff", "javablobsynccopymetadata1blobapitestsynccopymetadata8e3499961", "javablobsynccopymetadata2blobapitestsynccopymetadata8e337378c" ] +} \ 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..d5b1818a3393 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6?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" : "b6e7eeed-04f3-45e6-bdf2-449f2ef8a977" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA04932BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c0109-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "b6e7eeed-04f3-45e6-bdf2-449f2ef8a977" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6/javablobsynccopymin1blobapitestsynccopymin2ef536868f7cfd", + "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" : "ae70f7a4-e425-4a93-9b5d-641300c1162c", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA04F87F3\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c0131-d01e-009e-40e5-644931000000", + "x-ms-client-request-id" : "ae70f7a4-e425-4a93-9b5d-641300c1162c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8e3c5835-310a-44cb-aaf1-30e4fcd14648", + "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" : "\"0x8D732FCA055C21A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0167-d01e-009e-6fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "8e3c5835-310a-44cb-aaf1-30e4fcd14648" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6/javablobsynccopymin2blobapitestsynccopymin2ef69642a75a8e", + "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" : "e7bc955a-d481-40f4-99a8-f61f2b8565da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "54106e46-fdf8-458c-9d4f-60bc755ff204", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:30 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "ETag" : "\"0x8D732FCA079EACA\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c017f-d01e-009e-06e5-644931000000", + "x-ms-client-request-id" : "e7bc955a-d481-40f4-99a8-f61f2b8565da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "14298cf5-d297-4d71-87cf-746543608a14" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c028a-d01e-009e-72e5-644931000000", + "Body" : "jtcsynccopyminjtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6Fri, 06 Sep 2019 19:01:29 GMT\"0x8D732FCA055C21A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "14298cf5-d297-4d71-87cf-746543608a14", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6?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" : "cd0f7cea-e1d4-41d5-b030-ebc5bd10e5fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c02a8-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:29 GMT", + "x-ms-client-request-id" : "cd0f7cea-e1d4-41d5-b030-ebc5bd10e5fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymin0blobapitestsynccopymin2ef643735911db9e6", "javablobsynccopymin1blobapitestsynccopymin2ef536868f7cfd", "javablobsynccopymin2blobapitestsynccopymin2ef69642a75a8e" ] +} \ 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..6b5fba7703e3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6?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" : "4afd9212-49d8-4c75-9993-fba7054c7a41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA1164EAE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c0677-d01e-009e-0ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "4afd9212-49d8-4c75-9993-fba7054c7a41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6/javablobsynccopysourceac1blobapitestsynccopysourceac6d7031342", + "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" : "536ca451-e7d5-488f-86a8-e558e445d09f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA11CCCB2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c06a8-d01e-009e-39e5-644931000000", + "x-ms-client-request-id" : "536ca451-e7d5-488f-86a8-e558e445d09f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "49e2a120-6207-414b-be48-3d1f4f3b2ffc", + "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" : "\"0x8D732FCA1226B2F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c06d6-d01e-009e-64e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:30 GMT", + "x-ms-client-request-id" : "49e2a120-6207-414b-be48-3d1f4f3b2ffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6/javablobsynccopysourceac2blobapitestsynccopysourceac6d782069b", + "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" : "a8d01752-11e3-4bcd-a679-e26574d9c443" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ac5c47cf-bcd3-4845-9a20-41da558b4f9e", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:31 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "ETag" : "\"0x8D732FCA12BFE8C\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c0702-d01e-009e-0de5-644931000000", + "x-ms-client-request-id" : "a8d01752-11e3-4bcd-a679-e26574d9c443" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d19493a4-a2d8-435e-b5fe-59515b8c7141" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0789-d01e-009e-11e5-644931000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6Fri, 06 Sep 2019 19:01:31 GMT\"0x8D732FCA1226B2F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "d19493a4-a2d8-435e-b5fe-59515b8c7141", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6?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" : "65593d99-7fa6-48a1-b279-fe4f7340c4d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c07ae-d01e-009e-35e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "65593d99-7fa6-48a1-b279-fe4f7340c4d3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac6d74522646d6", "javablobsynccopysourceac1blobapitestsynccopysourceac6d7031342", "javablobsynccopysourceac2blobapitestsynccopysourceac6d782069b" ] +} \ 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..0d272965da07 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfb?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" : "3ac6df1b-4b6a-4869-bd9f-73235c792b01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA15057B3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c07e7-d01e-009e-67e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "3ac6df1b-4b6a-4869-bd9f-73235c792b01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfb/javablobsynccopysourceac1blobapitestsynccopysourceac33912969c", + "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" : "5c46e15e-62cd-4f62-bd44-b166e7ca8bdc", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA1616013\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c088d-d01e-009e-7ee5-644931000000", + "x-ms-client-request-id" : "5c46e15e-62cd-4f62-bd44-b166e7ca8bdc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "085e18f1-7c2b-4287-8362-5c0da581b84e", + "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" : "\"0x8D732FCA1677411\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c08b0-d01e-009e-20e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "085e18f1-7c2b-4287-8362-5c0da581b84e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfb/javablobsynccopysourceac2blobapitestsynccopysourceac33980693d", + "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" : "1123e2f8-3239-4a93-a2e1-dae774b0e662" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "2dd0b332-8dd1-4056-aa6b-2e140e82d8b3", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:31 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "ETag" : "\"0x8D732FCA1706A32\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c08d3-d01e-009e-3de5-644931000000", + "x-ms-client-request-id" : "1123e2f8-3239-4a93-a2e1-dae774b0e662" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2abb0d3f-cd6f-4150-bc2c-7f9746537dd4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0923-d01e-009e-05e5-644931000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfbFri, 06 Sep 2019 19:01:31 GMT\"0x8D732FCA1677411\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "2abb0d3f-cd6f-4150-bc2c-7f9746537dd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfb?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" : "4d546d28-09c3-4f24-b57c-7819a99f29a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c0945-d01e-009e-23e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "4d546d28-09c3-4f24-b57c-7819a99f29a9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac33975811cdfb", "javablobsynccopysourceac1blobapitestsynccopysourceac33912969c", "javablobsynccopysourceac2blobapitestsynccopysourceac33980693d" ] +} \ 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..f3c5edd055c2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac801082454189?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" : "93ecba5f-fc3c-48cc-bc1d-fd04279d94a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA192A00A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c09cd-d01e-009e-1ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "93ecba5f-fc3c-48cc-bc1d-fd04279d94a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac801082454189/javablobsynccopysourceac1blobapitestsynccopysourceac801736989", + "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" : "a44c79c1-2825-4b5c-96f5-e15965d9d0f7", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA19A09AC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c09f2-d01e-009e-3de5-644931000000", + "x-ms-client-request-id" : "a44c79c1-2825-4b5c-96f5-e15965d9d0f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac801082454189?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "204e8651-b0c0-4bb7-9544-40f33f91403b", + "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" : "\"0x8D732FCA1A0E177\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0a2b-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "204e8651-b0c0-4bb7-9544-40f33f91403b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac801082454189/javablobsynccopysourceac2blobapitestsynccopysourceac80128690a", + "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" : "b02a24ce-5030-4fe2-9f3b-274064082b73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f21ec352-03f8-4c74-9b7d-7e7aa32ed4ac", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "ETag" : "\"0x8D732FCA1A9FDF4\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c0a59-d01e-009e-16e5-644931000000", + "x-ms-client-request-id" : "b02a24ce-5030-4fe2-9f3b-274064082b73" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6f3b7c49-ab2f-4c46-bf0b-789e491925a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0aee-d01e-009e-1fe5-644931000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac801082454189Fri, 06 Sep 2019 19:01:32 GMT\"0x8D732FCA1A0E177\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "6f3b7c49-ab2f-4c46-bf0b-789e491925a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac801082454189?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" : "a3619c67-2df6-475e-9f3c-93b7297106c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c0b0e-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:31 GMT", + "x-ms-client-request-id" : "a3619c67-2df6-475e-9f3c-93b7297106c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac801082454189", "javablobsynccopysourceac1blobapitestsynccopysourceac801736989", "javablobsynccopysourceac2blobapitestsynccopysourceac80128690a" ] +} \ 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..ab1287f8efb2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49?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" : "a551a9b2-537c-4573-b865-bd741d7bf34f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA1CA85BD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c0b3e-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "a551a9b2-537c-4573-b865-bd741d7bf34f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49/javablobsynccopysourceac1blobapitestsynccopysourceacb9e256559", + "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" : "25e7d540-6081-4896-9ad6-eff9403e79a0", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA1D1EFD7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c0b82-d01e-009e-29e5-644931000000", + "x-ms-client-request-id" : "25e7d540-6081-4896-9ad6-eff9403e79a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2bb98bae-f3f5-43ad-98d8-0a8fb2c10a6e", + "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" : "\"0x8D732FCA1DC4B38\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0bc5-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "2bb98bae-f3f5-43ad-98d8-0a8fb2c10a6e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49/javablobsynccopysourceac1blobapitestsynccopysourceacb9e256559", + "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" : "b7ba8de0-f093-4fa5-b0fb-2df90fe725cc" + }, + "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" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FCA1D1EFD7\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:32 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c0bec-d01e-009e-07e5-644931000000", + "x-ms-client-request-id" : "b7ba8de0-f093-4fa5-b0fb-2df90fe725cc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49/javablobsynccopysourceac2blobapitestsynccopysourceacb9e436621", + "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" : "250738da-ff1d-4c29-830f-d8e9b4335621" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4d54cb72-31d2-4df4-81d0-49db2b231512", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "ETag" : "\"0x8D732FCA1F98FDF\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c0c16-d01e-009e-2fe5-644931000000", + "x-ms-client-request-id" : "250738da-ff1d-4c29-830f-d8e9b4335621" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a90cc53c-fe92-4263-a2ae-61d14e2b50fd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0cdd-d01e-009e-66e5-644931000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49Fri, 06 Sep 2019 19:01:32 GMT\"0x8D732FCA1DC4B38\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "a90cc53c-fe92-4263-a2ae-61d14e2b50fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49?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" : "e2c9131c-1a41-41e1-a29b-a66004a19d53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c0d01-d01e-009e-08e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "e2c9131c-1a41-41e1-a29b-a66004a19d53" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceacb9e08110fd49", "javablobsynccopysourceac1blobapitestsynccopysourceacb9e256559", "javablobsynccopysourceac2blobapitestsynccopysourceacb9e436621" ] +} \ 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..6f83ae4f5124 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642?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" : "01f5484e-d10c-4cb5-b9ac-b0d952a2aaaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA20F66D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c0d4a-d01e-009e-4be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "01f5484e-d10c-4cb5-b9ac-b0d952a2aaaf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642/javablobsynccopysourceac1blobapitestsynccopysourceac7f0533823", + "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" : "bbdbe7d6-2afb-441e-b7ae-8561bc01a569", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA21634F7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c0d86-d01e-009e-80e5-644931000000", + "x-ms-client-request-id" : "bbdbe7d6-2afb-441e-b7ae-8561bc01a569" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5d0e1422-dc54-42a7-b0af-25be506b8b45", + "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" : "\"0x8D732FCA21B8658\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0da1-d01e-009e-1ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "5d0e1422-dc54-42a7-b0af-25be506b8b45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642/javablobsynccopysourceac2blobapitestsynccopysourceac7f0887886", + "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" : "a0a29f8b-e1af-4e79-adbb-bee7018fe83d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "bbe6ec23-6104-4e70-aa42-1c42b51f21a9", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:32 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "ETag" : "\"0x8D732FCA2298489\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "b92c0dbf-d01e-009e-34e5-644931000000", + "x-ms-client-request-id" : "a0a29f8b-e1af-4e79-adbb-bee7018fe83d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cc7accc6-7ad8-40f9-8878-0161d855178d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0e27-d01e-009e-17e5-644931000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642Fri, 06 Sep 2019 19:01:32 GMT\"0x8D732FCA21B8658\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "cc7accc6-7ad8-40f9-8878-0161d855178d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642?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" : "9cb37f7e-7536-4c7b-b376-bf36d178c2c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c0e57-d01e-009e-43e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "9cb37f7e-7536-4c7b-b376-bf36d178c2c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac7f0250763642", "javablobsynccopysourceac1blobapitestsynccopysourceac7f0533823", "javablobsynccopysourceac2blobapitestsynccopysourceac7f0887886" ] +} \ 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..e6e6229a0647 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail096914232723553b294707a?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" : "6cb8917c-d7de-471a-826b-0501e0d0a743" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA23EBF22\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c0e93-d01e-009e-7ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "6cb8917c-d7de-471a-826b-0501e0d0a743" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail096914232723553b294707a/javablobsynccopysourceacfail134495c22b44a1107145", + "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" : "5b59ba5f-a462-42a3-84cf-895adad8cb2f", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA247D813\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c0eec-d01e-009e-49e5-644931000000", + "x-ms-client-request-id" : "5b59ba5f-a462-42a3-84cf-895adad8cb2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail096914232723553b294707a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b32df8ed-f9ec-45e4-a4ab-04f0219c65de", + "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" : "\"0x8D732FCA251978E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0f3b-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "b32df8ed-f9ec-45e4-a4ab-04f0219c65de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail096914232723553b294707a/javablobsynccopysourceacfail23805432ab978b630144", + "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" : "2a1e1aa2-1ca3-43dc-99e8-bf6c19f1b555" + }, + "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" : "b92c0f6b-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:32 GMT", + "x-ms-client-request-id" : "2a1e1aa2-1ca3-43dc-99e8-bf6c19f1b555" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "412aca35-d382-4576-8b60-23b7022f89b9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c0fa7-d01e-009e-7ae5-644931000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail096914232723553b294707aFri, 06 Sep 2019 19:01:33 GMT\"0x8D732FCA251978E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "412aca35-d382-4576-8b60-23b7022f89b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail096914232723553b294707a?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" : "ae768719-81d5-493d-9cc9-6262bdc9dde3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c0fd9-d01e-009e-2ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "ae768719-81d5-493d-9cc9-6262bdc9dde3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail096914232723553b294707a", "javablobsynccopysourceacfail134495c22b44a1107145", "javablobsynccopysourceacfail23805432ab978b630144" ] +} \ 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..f92cb66ceca5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail098613a2c6c7f4cb724c3fa?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" : "fdc43f76-cd93-4ef3-b308-d183b8c2450b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA2776860\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c101f-d01e-009e-6de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "fdc43f76-cd93-4ef3-b308-d183b8c2450b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail098613a2c6c7f4cb724c3fa/javablobsynccopysourceacfail163894b2a2bf9cca3645", + "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" : "9b7b8a54-ef5b-47ac-a3ae-2d0322386c40", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA28B59BB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1111-d01e-009e-4ee5-644931000000", + "x-ms-client-request-id" : "9b7b8a54-ef5b-47ac-a3ae-2d0322386c40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail098613a2c6c7f4cb724c3fa?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "081f5d1d-3992-4c67-a9c3-ae95f8170122", + "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" : "\"0x8D732FCA290AB98\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1134-d01e-009e-6ee5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "081f5d1d-3992-4c67-a9c3-ae95f8170122" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail098613a2c6c7f4cb724c3fa/javablobsynccopysourceacfail233135a141a107c5c041", + "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" : "095c6033-5247-47c8-8f8e-695fcd210e91" + }, + "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" : "b92c11ce-d01e-009e-76e5-644931000000", + "Body" : "CannotVerifyCopySourceThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c11ce-d01e-009e-76e5-644931000000\nTime:2019-09-06T19:01:33.8399383Z", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "095c6033-5247-47c8-8f8e-695fcd210e91", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c9e50105-dd30-4c05-a3c4-3cbe1850d0e4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c11f3-d01e-009e-18e5-644931000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail098613a2c6c7f4cb724c3faFri, 06 Sep 2019 19:01:33 GMT\"0x8D732FCA290AB98\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "c9e50105-dd30-4c05-a3c4-3cbe1850d0e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail098613a2c6c7f4cb724c3fa?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" : "7965b5fc-55a5-4e45-958f-49268d891202" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c121e-d01e-009e-42e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "7965b5fc-55a5-4e45-958f-49268d891202" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail098613a2c6c7f4cb724c3fa", "javablobsynccopysourceacfail163894b2a2bf9cca3645", "javablobsynccopysourceacfail233135a141a107c5c041" ] +} \ 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..85ad26fb6aa6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail0700072b308bd1c40c41c2a?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" : "ac4bc1be-fdcd-4457-9c16-79dff5de9df7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA2B9D7CE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c123d-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "ac4bc1be-fdcd-4457-9c16-79dff5de9df7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail0700072b308bd1c40c41c2a/javablobsynccopysourceacfail174291ffa3c9e008554c", + "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" : "81e7c2b5-df85-4380-802c-8ad6fbecb728", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA2BFBCA8\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c125d-d01e-009e-7ee5-644931000000", + "x-ms-client-request-id" : "81e7c2b5-df85-4380-802c-8ad6fbecb728" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail0700072b308bd1c40c41c2a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c93a70d8-721f-4c18-9ef4-3b528c1c839d", + "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" : "\"0x8D732FCA2C4E786\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1286-d01e-009e-24e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "c93a70d8-721f-4c18-9ef4-3b528c1c839d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail0700072b308bd1c40c41c2a/javablobsynccopysourceacfail24129901022413f69145", + "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" : "21d9c4ed-5667-4e1d-ba98-4ff809bdd4a6" + }, + "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" : "b92c12a4-d01e-009e-3de5-644931000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:b92c12a4-d01e-009e-3de5-644931000000\nTime:2019-09-06T19:01:34.0471227Z", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "21d9c4ed-5667-4e1d-ba98-4ff809bdd4a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1f2fbac3-8e33-451e-878a-8dd3d6cf1c1e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c12cb-d01e-009e-63e5-644931000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail0700072b308bd1c40c41c2aFri, 06 Sep 2019 19:01:34 GMT\"0x8D732FCA2C4E786\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "1f2fbac3-8e33-451e-878a-8dd3d6cf1c1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail0700072b308bd1c40c41c2a?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" : "6bc65420-44d2-4e70-91fd-ff1f88db9aa4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c12f1-d01e-009e-06e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "6bc65420-44d2-4e70-91fd-ff1f88db9aa4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail0700072b308bd1c40c41c2a", "javablobsynccopysourceacfail174291ffa3c9e008554c", "javablobsynccopysourceacfail24129901022413f69145" ] +} \ 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..8bd16512ca96 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail099202d823f451fe864c228?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" : "d6a8fccd-0c96-454a-8f59-3c661744234c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCA2DD1F52\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c1326-d01e-009e-36e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "x-ms-client-request-id" : "d6a8fccd-0c96-454a-8f59-3c661744234c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail099202d823f451fe864c228/javablobsynccopysourceacfail1066741050bbea787542", + "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" : "4380a84d-8d53-4d96-9e16-e6353f81282e", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCA2E3529F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c1360-d01e-009e-6de5-644931000000", + "x-ms-client-request-id" : "4380a84d-8d53-4d96-9e16-e6353f81282e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail099202d823f451fe864c228?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bdb72b75-b3c8-4653-bc8f-2d94afa827cf", + "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" : "\"0x8D732FCA2E8A4C1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1381-d01e-009e-0ae5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "bdb72b75-b3c8-4653-bc8f-2d94afa827cf" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail099202d823f451fe864c228/javablobsynccopysourceacfail1066741050bbea787542", + "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" : "9fdea648-25b3-4e81-9b44-98809b4b3a73" + }, + "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" : "Fri, 06 Sep 2019 19:01:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:01: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" : "\"0x8D732FCA2E3529F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:34 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92c1437-d01e-009e-38e5-644931000000", + "x-ms-client-request-id" : "9fdea648-25b3-4e81-9b44-98809b4b3a73", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail099202d823f451fe864c228/javablobsynccopysourceacfail285998a161a37df95545", + "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" : "c33b03fe-dda8-4e19-ae24-118244e5fda4" + }, + "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" : "b92c145f-d01e-009e-5fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "c33b03fe-dda8-4e19-ae24-118244e5fda4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c77aa169-586e-4203-ae30-858ff71d48ab" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92c1492-d01e-009e-10e5-644931000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail099202d823f451fe864c228Fri, 06 Sep 2019 19:01:34 GMT\"0x8D732FCA2E8A4C1\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "c77aa169-586e-4203-ae30-858ff71d48ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail099202d823f451fe864c228?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" : "4a62a0ed-3823-42bf-83b9-3feea90c62a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92c14c1-d01e-009e-3be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:34 GMT", + "x-ms-client-request-id" : "4a62a0ed-3823-42bf-83b9-3feea90c62a6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail099202d823f451fe864c228", "javablobsynccopysourceacfail1066741050bbea787542", "javablobsynccopysourceacfail285998a161a37df95545" ] +} \ 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..d609f3bca63c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json @@ -0,0 +1,220 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete1199497075f4580f61ca?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" : "07168463-777a-42fb-93b4-b21107355920" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCAEEDFC23\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:01:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92c6f9a-d01e-009e-78e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:54 GMT", + "x-ms-client-request-id" : "07168463-777a-42fb-93b4-b21107355920" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete1199497075f4580f61ca/javablobundelete1blobapitestundelete1196499773bcdb5fe", + "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" : "6d50881a-031b-4ffe-be1b-df0a1121a608", + "Content-Type" : "application/octet-stream" + }, + "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 19:01:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:01:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCAEF4BD11\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92c6fea-d01e-009e-45e5-644931000000", + "x-ms-client-request-id" : "6d50881a-031b-4ffe-be1b-df0a1121a608" + }, + "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" : "3d728962-9a90-499c-8da8-780be0868a89", + "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" : "b92c7031-d01e-009e-01e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:01:54 GMT", + "x-ms-client-request-id" : "3d728962-9a90-499c-8da8-780be0868a89" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete1199497075f4580f61ca/javablobundelete1blobapitestundelete1196499773bcdb5fe", + "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" : "7d068e90-5b6e-4a93-bbb8-45c148c926e8" + }, + "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" : "b92cf535-d01e-009e-11e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:24 GMT", + "x-ms-client-request-id" : "7d068e90-5b6e-4a93-bbb8-45c148c926e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete1199497075f4580f61ca/javablobundelete1blobapitestundelete1196499773bcdb5fe?comp=undelete", + "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" : "3c6aa92d-5c77-419c-847e-8db5dc6750ee" + }, + "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" : "b92cf63a-d01e-009e-7be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:24 GMT", + "x-ms-client-request-id" : "3c6aa92d-5c77-419c-847e-8db5dc6750ee" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete1199497075f4580f61ca/javablobundelete1blobapitestundelete1196499773bcdb5fe", + "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" : "d91f8dc0-a8ec-4b10-9e14-e279d0388a85" + }, + "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" : "Fri, 06 Sep 2019 19:01:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:02:24 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" : "\"0x8D732FCAEF4BD11\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:01:54 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b92cf690-d01e-009e-46e5-644931000000", + "x-ms-client-request-id" : "d91f8dc0-a8ec-4b10-9e14-e279d0388a85", + "Content-Type" : "application/octet-stream" + }, + "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" : "8d078e21-ee76-4292-96c7-8a603dc5f0d1", + "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" : "b92cf6b9-d01e-009e-6ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:24 GMT", + "x-ms-client-request-id" : "8d078e21-ee76-4292-96c7-8a603dc5f0d1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "39d91a17-57fa-402f-8405-3ed6a4772c70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92d7d3f-d01e-009e-2fe5-644931000000", + "Body" : "jtcundeletejtcundelete0blobapitestundelete1199497075f4580f61caFri, 06 Sep 2019 19:01:54 GMT\"0x8D732FCAEEDFC23\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcundelete0blobapitestundelete139031949f645b9a8119Fri, 06 Sep 2019 18:58:10 GMT\"0x8D732FC29345671\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:02:54 GMT", + "x-ms-client-request-id" : "39d91a17-57fa-402f-8405-3ed6a4772c70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete1199497075f4580f61ca?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" : "8d1f859f-f05d-4814-9f24-b490051c5eea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92d7d69-d01e-009e-57e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:54 GMT", + "x-ms-client-request-id" : "8d1f859f-f05d-4814-9f24-b490051c5eea" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete139031949f645b9a8119?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" : "c71fbcf6-fe43-4f5b-81ab-b7d1d8f0b6fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92d7d8c-d01e-009e-74e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:54 GMT", + "x-ms-client-request-id" : "c71fbcf6-fe43-4f5b-81ab-b7d1d8f0b6fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcundelete0blobapitestundelete1199497075f4580f61ca", "javablobundelete1blobapitestundelete1196499773bcdb5fe" ] +} \ 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..b111d3f36ee5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord6225962b49b3b1?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" : "b1ade5af-9930-40f5-9d90-7d8f69a7a43d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE580A759\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e02cb-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "b1ade5af-9930-40f5-9d90-7d8f69a7a43d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord6225962b49b3b1/javablobundeleteerror1blobapitestundeleteerrord62522463eba", + "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" : "dc2f30a0-76b4-4668-8f58-632a65252cbd", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE5877421\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e02fe-d01e-009e-4de5-644931000000", + "x-ms-client-request-id" : "dc2f30a0-76b4-4668-8f58-632a65252cbd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord6225962b49b3b1/javablobundeleteerror2blobapitestundeleteerrord620227802f0?comp=undelete", + "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" : "bb446f50-979f-4f16-90bb-c17a358861ae" + }, + "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" : "b92e03b6-d01e-009e-6de5-644931000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:b92e03b6-d01e-009e-6de5-644931000000\nTime:2019-09-06T19:03:26.1707570Z", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "bb446f50-979f-4f16-90bb-c17a358861ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "60b04cb2-be47-4042-8816-70d3a0d735f4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e03f1-d01e-009e-22e5-644931000000", + "Body" : "jtcundeleteerrorjtcundeleteerror0blobapitestundeleteerrord6225962b49b3b1Fri, 06 Sep 2019 19:03:25 GMT\"0x8D732FCE580A759\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "60b04cb2-be47-4042-8816-70d3a0d735f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord6225962b49b3b1?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" : "d5770344-bc3c-48a9-9f0d-a86a003a2f52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e0419-d01e-009e-48e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "d5770344-bc3c-48a9-9f0d-a86a003a2f52" + }, + "Exception" : null + } ], + "variables" : [ "jtcundeleteerror0blobapitestundeleteerrord6225962b49b3b1", "javablobundeleteerror1blobapitestundeleteerrord62522463eba", "javablobundeleteerror2blobapitestundeleteerrord620227802f0" ] +} \ 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..a6ca51d35a01 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeletemin01901298a0f80776a?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" : "bb247aef-e038-4b37-bc06-c17287800cc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCD357DBCB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:02:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92d7de0-d01e-009e-40e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:55 GMT", + "x-ms-client-request-id" : "bb247aef-e038-4b37-bc06-c17287800cc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeletemin01901298a0f80776a/javablobundeletemin1blobapitestundeletemin019160450fd4eb", + "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" : "3f592b74-5def-4ac0-a335-1aa3cbfe1632", + "Content-Type" : "application/octet-stream" + }, + "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 19:02:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:02:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCD35FBCB5\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92d7e18-d01e-009e-73e5-644931000000", + "x-ms-client-request-id" : "3f592b74-5def-4ac0-a335-1aa3cbfe1632" + }, + "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" : "1911454d-28a9-4fed-a02a-1c724f85856f", + "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" : "b92d7ed9-d01e-009e-1de5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:02:55 GMT", + "x-ms-client-request-id" : "1911454d-28a9-4fed-a02a-1c724f85856f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeletemin01901298a0f80776a/javablobundeletemin1blobapitestundeletemin019160450fd4eb", + "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" : "37ba8c62-e259-47be-8820-a7bf516db272" + }, + "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" : "b92e01f6-d01e-009e-62e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "37ba8c62-e259-47be-8820-a7bf516db272" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeletemin01901298a0f80776a/javablobundeletemin1blobapitestundeletemin019160450fd4eb?comp=undelete", + "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" : "c273231d-33b5-4a34-8f54-d679d610b209" + }, + "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" : "b92e0229-d01e-009e-0fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "c273231d-33b5-4a34-8f54-d679d610b209" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0c4c94bd-c5c9-403e-95e0-c9577d17730e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e0262-d01e-009e-3fe5-644931000000", + "Body" : "jtcundeleteminjtcundeletemin0blobapitestundeletemin01901298a0f80776aFri, 06 Sep 2019 19:02:55 GMT\"0x8D732FCD357DBCB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "0c4c94bd-c5c9-403e-95e0-c9577d17730e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeletemin01901298a0f80776a?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" : "ef1ff9f9-b25e-4df1-9b0d-50e219e315d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e027f-d01e-009e-5ce5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:25 GMT", + "x-ms-client-request-id" : "ef1ff9f9-b25e-4df1-9b0d-50e219e315d3" + }, + "Exception" : null + } ], + "variables" : [ "jtcundeletemin0blobapitestundeletemin01901298a0f80776a", "javablobundeletemin1blobapitestundeletemin019160450fd4eb" ] +} \ 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..1b6fe2dcb76d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload074626007c2a9a7d08467c9", "javablobasyncbufferedupload17238116fe69037c6e44f", "javablobasyncbufferedupload215742c042028f66a7476", "7390976d-5b9d-4a32-8ae2-3cf153418a27" ] +} \ 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..7a10aeda0639 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload074760c61c1bacadf14bf58", "javablobasyncbufferedupload157322ebb70bdbd2b1496", "javablobasyncbufferedupload227863b49d2fd5ad324b2", "49ce544f-3e29-412e-ad57-7daaa354ce0c" ] +} \ 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..637774477c6b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload086390a0f52a23f0db4a848", "javablobasyncbufferedupload171559647705a131ad418", "javablobasyncbufferedupload260860e722c55bff704f5", "94cde576-8158-4f47-a73a-e5cfeebd3cac" ] +} \ 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..9306e3e0c185 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload011635b31690211a8c4cc5a", "javablobasyncbufferedupload14820695cb5604868e4d2", "javablobasyncbufferedupload297970d756a7f19bda4f1", "54613d23-4ebf-4266-aa66-1589d8a7fe51" ] +} \ 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..7d427c552fd9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[4].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload0313360a99adf6c1d64b2e8", "javablobasyncbufferedupload119574c45ab93e43ae44b", "javablobasyncbufferedupload274380f9775c9f520547f", "025ce171-ea57-4946-ba8b-7b9f59100f1c" ] +} \ 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..230b2e183346 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[5].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload0408504e682ac8972c4b58a", "javablobasyncbufferedupload1214102b338f53e9a240e", "javablobasyncbufferedupload295661701b000b68fa4f4", "a295192d-f28d-418d-86ab-10dccd96ce3c" ] +} \ 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..2c909efe3660 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[6].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload006254eaebf211d17e4cd0b", "javablobasyncbufferedupload158678395e30ad2ca3405", "javablobasyncbufferedupload249561500e573a2796494", "4e60b21b-7bbe-4416-90ba-a4630381e9a9" ] +} \ 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..15c339ecf48b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[7].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload016862d4a0ce344868456ea", "javablobasyncbufferedupload148879079ecdfbf4dd41a", "javablobasyncbufferedupload232549d2e98a6494c441d", "f9d2e1c9-c1d5-4d56-afc9-ff4da0084665" ] +} \ 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..a41dc380f11c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac9c7320959", "javablobbuffereduploadac136293e206391012c94321", "javablobbuffereduploadac290545df38e777a8cb4a95", "50e12df5-5b4f-4988-9bd6-c2b752ee0ad2" ] +} \ 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..c898f9552320 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac15e98652b", "javablobbuffereduploadac146179cacb305d882b4ccf", "javablobbuffereduploadac2647465dccf9f779824aad", "eafa37eb-49e8-43b8-b4ec-a3444ef46655" ] +} \ 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..229878a9eb30 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac2d723534c", "javablobbuffereduploadac165394004378f0e6c448e6", "javablobbuffereduploadac294336b2a24d9491d1494d", "ecacdfd0-5c9d-4ff2-9d28-823476067fa7" ] +} \ 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..e354f35c17f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac3ab34779d", "javablobbuffereduploadac1594935e8b4eb5e36541f9", "javablobbuffereduploadac245111053f23f53af6420c", "8ae22210-8f73-434d-b01b-e773c4e2fc66" ] +} \ 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..ec8bd5a34a09 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[4].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadacb9053775a", "javablobbuffereduploadac1250913f446ed34e614559", "javablobbuffereduploadac21841586dde1b31de5461b", "c168adf7-1083-41e7-84d0-672039b22078" ] +} \ 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..dfaa5442761a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[5].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac34c100636", "javablobbuffereduploadac187989944235d5fb084383", "javablobbuffereduploadac287091dbc600aa49184ab1", "594d191b-81ce-45af-852b-aec424f672a1" ] +} \ 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..b78916f8a0df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail0856188cc7767e1b0141428", "javablobbuffereduploadacfail141664c06d572c822f41", "javablobbuffereduploadacfail29416900d7a1f50bfe47", "fc4eed92-d25c-4fad-bfa3-47ba39c7e682" ] +} \ 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..de595f8482ec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail010456657d38b9153c40258", "javablobbuffereduploadacfail14279254cee5c91eca43", "javablobbuffereduploadacfail291420201eeeb2751f4e", "4cdc6073-ff78-47ea-8399-d3d6fe4b29bb" ] +} \ 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..a91c8e9493ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail04332464bc17dc37a94434a", "javablobbuffereduploadacfail164238873b6706690e49", "javablobbuffereduploadacfail2223411debda1d1d284b", "61771715-5aec-4188-a62f-7f8c190b0686" ] +} \ 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..7d03c4588cb4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail052424ba01b3a221e14b2ba", "javablobbuffereduploadacfail175362067521b5350348", "javablobbuffereduploadacfail2345915768bb723b764e", "2bad98ff-a19d-470a-bd14-e4e5b0fecc09" ] +} \ 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..5f10c167b8d7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[4].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail052796bf6b6831416043858", "javablobbuffereduploadacfail100008c88eb527274146", "javablobbuffereduploadacfail218070e58d5b03ab4e41", "937fad55-f9fa-4b33-bb7d-2cd2d871e99f" ] +} \ 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..65b38e18da13 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource043903bdea1bc802b04", "javablobbuffereduploadchunkedsource1005906373ace597c", "javablobbuffereduploadchunkedsource223969543cbb75f88", "088a7c08-f5f6-4d3e-b546-d8f4cc8441a6", "2843a22d-1036-4549-9259-c00d309b383f" ] +} \ 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..d66ec7ce86a2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource0260626464057405314", "javablobbuffereduploadchunkedsource1971058189e106c40", "javablobbuffereduploadchunkedsource20218312220255c16", "afde3520-cb1c-4b7e-b06d-43ed974d7e78", "1a773848-96b8-4f78-bf23-b7b7e6d1d648", "59f0eda8-3ca6-4ec9-8e56-0ecdf31060ed", "bcd7ae00-52e2-46e5-914a-f08953d7d365", "9ca3557a-c2f7-4a15-9359-66d69497f188", "a6311ebc-de49-4c3f-ae8b-d60c7a201f81", "84882d54-4f9a-4ce8-8543-b6ae3e36d963" ] +} \ 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..fae18b2c4b20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource075271ecc21ccbadae4", "javablobbuffereduploadchunkedsource121999f3ef1fa76eb", "javablobbuffereduploadchunkedsource213027f1e1c3c32ff", "14be0ce3-e5fa-40ad-8c23-5afc5bf69b5c", "fdfcb34a-8b35-48db-87c3-a44ea543be89" ] +} \ 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..c26ff23ebd4b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource000666b76adea786484", "javablobbuffereduploadchunkedsource128054135fe8bfdd9", "javablobbuffereduploadchunkedsource239730dcbf8cbe0d2", "63a44171-465a-4278-b3a1-2787d96156a3", "307a9948-9656-48b7-a32c-2828c8e9010c", "089518b8-40cb-4b01-b3da-eada974c5747" ] +} \ 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..759b8028215a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadheaders033087605e83ba4cf645a1", "javablobbuffereduploadheaders1506628ec51bca48354b", "javablobbuffereduploadheaders24095764cf7b1613b64b" ] +} \ 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..f791f9e51df6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadheaders0969195c21e058a6084bf4", "javablobbuffereduploadheaders17941024a1340a51d64d", "javablobbuffereduploadheaders27087978247e3f413e44" ] +} \ 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..108b6b36c28e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds053206f4498c562?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" : "7f658444-7887-4b40-b8b7-ee433237a276" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD1679E3FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6325f9-001e-001f-7be5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:47 GMT", + "x-ms-client-request-id" : "7f658444-7887-4b40-b8b7-ee433237a276" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds053206f4498c562/javablobbuffereduploadillegalargsoutofbounds18397082da59", + "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" : "dfe40425-cb5f-40ac-8a7d-9355f46ab540", + "Content-Type" : "application/octet-stream" + }, + "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 19:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD16804476\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec632619-001e-001f-1ae5-64eb66000000", + "x-ms-client-request-id" : "dfe40425-cb5f-40ac-8a7d-9355f46ab540" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9c7a062b-e660-4068-a4c1-43b1131db5d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec632640-001e-001f-38e5-64eb66000000", + "Body" : "jtcbuffereduploadillegalargsoutofboundsjtcbuffereduploadillegalargsoutofbounds053206f4498c562Fri, 06 Sep 2019 19:04:48 GMT\"0x8D732FD1679E3FF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "9c7a062b-e660-4068-a4c1-43b1131db5d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds053206f4498c562?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" : "bb952441-c4d9-4355-bfe7-bdd7d8f1ad67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63265a-001e-001f-4fe5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "bb952441-c4d9-4355-bfe7-bdd7d8f1ad67" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargsoutofbounds053206f4498c562", "javablobbuffereduploadillegalargsoutofbounds18397082da59", "javablobbuffereduploadillegalargsoutofbounds2179118def01" ] +} \ 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..dcdea86472b7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds0943427057fc871?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" : "e66b7b32-296a-4dca-9660-4e1d6e1e242d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD16949E5A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec632677-001e-001f-6ae5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "e66b7b32-296a-4dca-9660-4e1d6e1e242d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds0943427057fc871/javablobbuffereduploadillegalargsoutofbounds15402198eab8", + "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" : "02de2294-7964-4bbe-a2be-6e58b9a09402", + "Content-Type" : "application/octet-stream" + }, + "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 19:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD169AD7A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec632698-001e-001f-0ae5-64eb66000000", + "x-ms-client-request-id" : "02de2294-7964-4bbe-a2be-6e58b9a09402" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "76464a7f-ab92-4269-9603-bfe95dd7296e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6326be-001e-001f-2ce5-64eb66000000", + "Body" : "jtcbuffereduploadillegalargsoutofboundsjtcbuffereduploadillegalargsoutofbounds0943427057fc871Fri, 06 Sep 2019 19:04:48 GMT\"0x8D732FD16949E5A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "76464a7f-ab92-4269-9603-bfe95dd7296e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds0943427057fc871?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" : "72ae6bc4-9a42-4967-90d9-f37a79e11fe7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6326e2-001e-001f-4be5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "72ae6bc4-9a42-4967-90d9-f37a79e11fe7" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargsoutofbounds0943427057fc871", "javablobbuffereduploadillegalargsoutofbounds15402198eab8", "javablobbuffereduploadillegalargsoutofbounds2931938f0ecd" ] +} \ 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..329914798d63 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds0184197ed61a0b9?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" : "a9143041-10eb-48e5-a47c-40af2d3b5347" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD16B1A33E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec632722-001e-001f-05e5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "a9143041-10eb-48e5-a47c-40af2d3b5347" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds0184197ed61a0b9/javablobbuffereduploadillegalargsoutofbounds157408312b11", + "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" : "bb3a239a-bcdd-474a-804f-ff25aefcc4a5", + "Content-Type" : "application/octet-stream" + }, + "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 19:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD16C0DF3B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec632767-001e-001f-41e5-64eb66000000", + "x-ms-client-request-id" : "bb3a239a-bcdd-474a-804f-ff25aefcc4a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "55ae861f-fedc-4933-b7ae-5214ced5a32c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec632789-001e-001f-61e5-64eb66000000", + "Body" : "jtcbuffereduploadillegalargsoutofboundsjtcbuffereduploadillegalargsoutofbounds0184197ed61a0b9Fri, 06 Sep 2019 19:04:48 GMT\"0x8D732FD16B1A33E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "55ae861f-fedc-4933-b7ae-5214ced5a32c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds0184197ed61a0b9?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" : "9a48e198-f787-4a30-bab7-2b5c66f48616" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63279f-001e-001f-75e5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:48 GMT", + "x-ms-client-request-id" : "9a48e198-f787-4a30-bab7-2b5c66f48616" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargsoutofbounds0184197ed61a0b9", "javablobbuffereduploadillegalargsoutofbounds157408312b11", "javablobbuffereduploadillegalargsoutofbounds25192627941c" ] +} \ 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..e4cc3fffafb6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargumentsnull.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargumentsnull052580ddc58e7a00?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" : "2e1cd0e1-84ca-4837-b9c9-94320394be3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD164E35A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:04:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63251b-001e-001f-37e5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:47 GMT", + "x-ms-client-request-id" : "2e1cd0e1-84ca-4837-b9c9-94320394be3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargumentsnull052580ddc58e7a00/javablobbuffereduploadillegalargumentsnull109984cc1b3b9", + "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" : "8f8688ec-bb44-44d0-98ff-00567f473b63", + "Content-Type" : "application/octet-stream" + }, + "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 19:04:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:04:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD165580D2\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec632558-001e-001f-68e5-64eb66000000", + "x-ms-client-request-id" : "8f8688ec-bb44-44d0-98ff-00567f473b63" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "67056bc6-6b64-4225-a1d1-124dd18954bb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec632573-001e-001f-01e5-64eb66000000", + "Body" : "jtcbuffereduploadillegalargumentsnulljtcbuffereduploadillegalargumentsnull052580ddc58e7a00Fri, 06 Sep 2019 19:04:47 GMT\"0x8D732FD164E35A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:04:47 GMT", + "x-ms-client-request-id" : "67056bc6-6b64-4225-a1d1-124dd18954bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadillegalargumentsnull052580ddc58e7a00?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" : "a31c711a-15e6-4420-b347-4fccddeb2ed4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6325d8-001e-001f-5be5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:47 GMT", + "x-ms-client-request-id" : "a31c711a-15e6-4420-b347-4fccddeb2ed4" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargumentsnull052580ddc58e7a00", "javablobbuffereduploadillegalargumentsnull109984cc1b3b9", "javablobbuffereduploadillegalargumentsnull224590b26a618" ] +} \ 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..74e0922f9935 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadmetadata0149780bb606050df44f9d", "javablobbuffereduploadmetadata17771146a4fecc8c7b4", "javablobbuffereduploadmetadata2741151aa4d6711b6a4", "70b62afe-9577-486b-be6e-ed0f5294f12f" ] +} \ 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..474cbf112228 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadmetadata057318fbebf5212f534641", "javablobbuffereduploadmetadata197415d4a42c34b2114", "javablobbuffereduploadmetadata2759662b0d34354fb64", "ebb12a4e-ff3e-482b-bef8-718d72773bcc" ] +} \ 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..1c6077c69660 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadnetworkerror.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadnetworkerror0820160093b36e280f4e?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" : "852a799f-1310-409f-98b3-9f17bf74c55c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD19DE2C77\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:04:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6336db-001e-001f-3de5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:53 GMT", + "x-ms-client-request-id" : "852a799f-1310-409f-98b3-9f17bf74c55c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadnetworkerror0820160093b36e280f4e/javablobbuffereduploadnetworkerror1385380537b8591be", + "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" : "d60f7863-50a7-4a0a-9f0a-15156cbe30fa", + "Content-Type" : "application/octet-stream" + }, + "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 19:04:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:04:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD19E4FE46\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec633713-001e-001f-6ae5-64eb66000000", + "x-ms-client-request-id" : "d60f7863-50a7-4a0a-9f0a-15156cbe30fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadnetworkerror0820160093b36e280f4e/javablobbuffereduploadnetworkerror22468963bef13b91d", + "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" : "335d7457-e38d-4606-95b3-143748f032ea", + "Content-Type" : "application/octet-stream" + }, + "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 19:04:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:04:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD19EBDDB5\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec633730-001e-001f-05e5-64eb66000000", + "x-ms-client-request-id" : "335d7457-e38d-4606-95b3-143748f032ea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadnetworkerror0820160093b36e280f4e/javablobbuffereduploadnetworkerror22468963bef13b91d", + "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" : "bbe2ee23-b588-4ac3-a0d6-b84bc4bdcb7f" + }, + "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" : "Fri, 06 Sep 2019 19:04:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:04:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD19EBDDB5\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:04:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ec633743-001e-001f-17e5-64eb66000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "bbe2ee23-b588-4ac3-a0d6-b84bc4bdcb7f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7aa229b3-125a-4500-9ae3-917e8ef3bc65" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec633d5d-001e-001f-5be5-64eb66000000", + "Body" : "jtcbuffereduploadnetworkerrorjtcbuffereduploadnetworkerror0820160093b36e280f4eFri, 06 Sep 2019 19:04:53 GMT\"0x8D732FD19DE2C77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:04:55 GMT", + "x-ms-client-request-id" : "7aa229b3-125a-4500-9ae3-917e8ef3bc65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbuffereduploadnetworkerror0820160093b36e280f4e?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" : "e7a134d5-39d3-448c-be30-8b1a931fc3d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec633d72-001e-001f-6de5-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:04:55 GMT", + "x-ms-client-request-id" : "e7a134d5-39d3-448c-be30-8b1a931fc3d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadnetworkerror0820160093b36e280f4e", "javablobbuffereduploadnetworkerror1385380537b8591be", "javablobbuffereduploadnetworkerror22468963bef13b91d", "jtcbuffereduploadnetworkerror360437f1efa28c8a0742", "javablobbuffereduploadnetworkerror415869ea183e48271" ] +} \ 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..f43551c00d1b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist0e32637828?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" : "a88aaa3f-9d98-403e-b5c5-3cde353b9afb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEDF24E94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a133b-c01e-00c5-64e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "a88aaa3f-9d98-403e-b5c5-3cde353b9afb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist0e32637828/javablobcommitblocklist1407810e488efa1f2948999", + "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" : "1942dfb1-bf32-49a1-8fb6-ae697f8a9301", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEDF8E22E\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1348-c01e-00c5-70e5-644e4d000000", + "x-ms-client-request-id" : "1942dfb1-bf32-49a1-8fb6-ae697f8a9301" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist0e32637828/javablobcommitblocklist1407810e488efa1f2948999?blockid=MzcwZTM0NjQtYWRhNi00NTIzLWFjYTktMDM1ZTJmNWVkYWUw&comp=block", + "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" : "2a9c430b-b723-4bd1-9d5f-9ba221cd02bc", + "Content-Type" : "application/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" : "412a1360-c01e-00c5-7fe5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "2a9c430b-b723-4bd1-9d5f-9ba221cd02bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist0e32637828/javablobcommitblocklist1407810e488efa1f2948999?comp=blocklist", + "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" : "de83899c-5b74-40d9-aeaa-42c6de106242", + "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" : "\"0x8D732FCEE0652E0\"", + "x-ms-content-crc64" : "To3CgExRSCA=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1371-c01e-00c5-0de5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "de83899c-5b74-40d9-aeaa-42c6de106242" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "053690a3-f002-4af5-be7e-2489f6e97206" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a137e-c01e-00c5-1ae5-644e4d000000", + "Body" : "jtccommitblocklistjtccommitblocklist0blockblobapitestcommitblocklist0e32637828Fri, 06 Sep 2019 19:03:40 GMT\"0x8D732FCEDF24E94\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "053690a3-f002-4af5-be7e-2489f6e97206", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist0e32637828?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" : "777d8485-4e40-47ec-9dc9-a2bf328c1754" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a138b-c01e-00c5-26e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "777d8485-4e40-47ec-9dc9-a2bf328c1754" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklist0blockblobapitestcommitblocklist0e32637828", "javablobcommitblocklist1407810e488efa1f2948999", "javablobcommitblocklist264357f5252d027b7d44378", "370e3464-ada6-4523-aca9-035e2f5edae0" ] +} \ 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..a2be002f55be --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacaf414023?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" : "9363d811-28d5-4f39-83ca-e0e163db88e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEF349207\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1690-c01e-00c5-22e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "9363d811-28d5-4f39-83ca-e0e163db88e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacaf414023/javablobcommitblocklistac164330a32aae9c42474408", + "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" : "ded17ffb-22dd-4039-9182-3df5681f975c", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEF3AD664\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a16a5-c01e-00c5-33e5-644e4d000000", + "x-ms-client-request-id" : "ded17ffb-22dd-4039-9182-3df5681f975c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacaf414023/javablobcommitblocklistac164330a32aae9c42474408?comp=blocklist", + "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" : "34dfda50-3042-42e4-814d-0d642b1629dc", + "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" : "\"0x8D732FCEF418EBD\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a16b4-c01e-00c5-3fe5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "34dfda50-3042-42e4-814d-0d642b1629dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0f8cbbaf-7f38-4455-97e3-21149db0ab57" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a16c7-c01e-00c5-50e5-644e4d000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistacaf414023Fri, 06 Sep 2019 19:03:42 GMT\"0x8D732FCEF349207\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "0f8cbbaf-7f38-4455-97e3-21149db0ab57", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacaf414023?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" : "ecdef566-dc85-41dd-b7d0-e1d369b34ffa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a16e0-c01e-00c5-64e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "ecdef566-dc85-41dd-b7d0-e1d369b34ffa" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistacaf414023", "javablobcommitblocklistac164330a32aae9c42474408", "javablobcommitblocklistac2939630e1e9d4a05504ce4" ] +} \ 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..d215fd8f37c6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac12860915?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" : "7aedfb68-b32c-4685-a5f2-1d4c25293c5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEF573D8E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a16fd-c01e-00c5-7ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "7aedfb68-b32c-4685-a5f2-1d4c25293c5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac12860915/javablobcommitblocklistac160462071e5331cb0e4fb0", + "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" : "8ef23998-a767-47ef-a763-56fb4228b439", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEF615348\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1722-c01e-00c5-1fe5-644e4d000000", + "x-ms-client-request-id" : "8ef23998-a767-47ef-a763-56fb4228b439" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac12860915/javablobcommitblocklistac160462071e5331cb0e4fb0?comp=blocklist", + "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" : "0c29e298-c811-4f59-92dc-b0e1ec06a45c", + "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" : "\"0x8D732FCEF6C0437\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1736-c01e-00c5-32e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "0c29e298-c811-4f59-92dc-b0e1ec06a45c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "138b8cd1-5084-45ca-9d5e-f8bad6b93e10" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a174a-c01e-00c5-43e5-644e4d000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac12860915Fri, 06 Sep 2019 19:03:42 GMT\"0x8D732FCEF573D8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "138b8cd1-5084-45ca-9d5e-f8bad6b93e10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac12860915?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" : "13e6f2cb-be85-4f66-ad9c-5c2643b407b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a175e-c01e-00c5-54e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "13e6f2cb-be85-4f66-ad9c-5c2643b407b9" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac12860915", "javablobcommitblocklistac160462071e5331cb0e4fb0", "javablobcommitblocklistac240537d5c5985f06514e82" ] +} \ 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..3c2d5b2135da --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistaceee38494?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" : "80e56e2c-8b87-4b4f-90d3-b744119b6ade" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEF829DC9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1778-c01e-00c5-6ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "80e56e2c-8b87-4b4f-90d3-b744119b6ade" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistaceee38494/javablobcommitblocklistac1562272d1648b441be46f1", + "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" : "13a1236d-f709-48bc-8426-6abd03a57ff9", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEF89A55C\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1784-c01e-00c5-74e5-644e4d000000", + "x-ms-client-request-id" : "13a1236d-f709-48bc-8426-6abd03a57ff9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistaceee38494/javablobcommitblocklistac1562272d1648b441be46f1?comp=blocklist", + "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" : "9955d686-1cba-49fb-8dcf-744d07eb23ae", + "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" : "\"0x8D732FCEF90D2F9\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a179c-c01e-00c5-08e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "9955d686-1cba-49fb-8dcf-744d07eb23ae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac953cbf-536e-4ead-893d-ac99edb17ece" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a17b8-c01e-00c5-20e5-644e4d000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistaceee38494Fri, 06 Sep 2019 19:03:42 GMT\"0x8D732FCEF829DC9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "ac953cbf-536e-4ead-893d-ac99edb17ece", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistaceee38494?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" : "990efd57-7e53-4a0e-8fbe-eef412fd579d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a17cc-c01e-00c5-2fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "990efd57-7e53-4a0e-8fbe-eef412fd579d" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistaceee38494", "javablobcommitblocklistac1562272d1648b441be46f1", "javablobcommitblocklistac2234150c1f59d94cd449ec" ] +} \ 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..dfcae7b0fab7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac90416097?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" : "529a8bd9-2f85-4088-8763-bfe7cce96ac6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEFAA5399\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a17f8-c01e-00c5-52e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "529a8bd9-2f85-4088-8763-bfe7cce96ac6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac90416097/javablobcommitblocklistac1496258d565c22c1bd4ead", + "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" : "d54baf67-12f3-4313-81c1-32f1740ad0e9", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEFBF4117\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1843-c01e-00c5-12e5-644e4d000000", + "x-ms-client-request-id" : "d54baf67-12f3-4313-81c1-32f1740ad0e9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac90416097/javablobcommitblocklistac1496258d565c22c1bd4ead", + "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" : "6220438e-fe44-484d-9335-3af8b94dd9a8" + }, + "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" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCEFBF4117\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:43 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a1850-c01e-00c5-1de5-644e4d000000", + "x-ms-client-request-id" : "6220438e-fe44-484d-9335-3af8b94dd9a8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac90416097/javablobcommitblocklistac1496258d565c22c1bd4ead?comp=blocklist", + "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" : "8429c249-1cf0-49bb-ae47-7e649583b2a3", + "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" : "\"0x8D732FCEFCBEE43\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a186c-c01e-00c5-32e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "8429c249-1cf0-49bb-ae47-7e649583b2a3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a9597118-6660-41f3-a5d2-ca5790789179" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1888-c01e-00c5-48e5-644e4d000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac90416097Fri, 06 Sep 2019 19:03:43 GMT\"0x8D732FCEFAA5399\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "a9597118-6660-41f3-a5d2-ca5790789179", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac90416097?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" : "ea24d92e-b377-4307-ac82-71411b6b1a76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a189e-c01e-00c5-5ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "ea24d92e-b377-4307-ac82-71411b6b1a76" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac90416097", "javablobcommitblocklistac1496258d565c22c1bd4ead", "javablobcommitblocklistac219953981e7adc20a4445f" ] +} \ 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..5f5694704077 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac2cb30636?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" : "2f90fef9-bd0c-417a-bb4c-ed0110ce9755" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEFE2FD58\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a18cc-c01e-00c5-03e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "2f90fef9-bd0c-417a-bb4c-ed0110ce9755" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac2cb30636/javablobcommitblocklistac1356281fd89476e9b74540", + "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" : "39a3df74-4c1d-4c40-b80f-1347791fe6fa", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEFE8F302\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a18e3-c01e-00c5-18e5-644e4d000000", + "x-ms-client-request-id" : "39a3df74-4c1d-4c40-b80f-1347791fe6fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac2cb30636/javablobcommitblocklistac1356281fd89476e9b74540?comp=blocklist", + "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" : "e56666d3-0791-48ac-adff-807957acabf5", + "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" : "\"0x8D732FCEFEF0EF1\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a18fb-c01e-00c5-30e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "e56666d3-0791-48ac-adff-807957acabf5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3fafab0b-3c42-413a-87ca-1be916f9fccb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a190e-c01e-00c5-42e5-644e4d000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac2cb30636Fri, 06 Sep 2019 19:03:43 GMT\"0x8D732FCEFE2FD58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "3fafab0b-3c42-413a-87ca-1be916f9fccb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac2cb30636?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" : "b6057c40-45c7-49df-9d37-e1f7f8209f78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a191c-c01e-00c5-4fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "b6057c40-45c7-49df-9d37-e1f7f8209f78" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac2cb30636", "javablobcommitblocklistac1356281fd89476e9b74540", "javablobcommitblocklistac271980cc5fcc278dbb4754" ] +} \ 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..31b2db9f2e65 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac7af37514?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" : "7f5cedfe-1f57-406f-b413-bbd2387fc9da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF0029ACC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1937-c01e-00c5-67e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "7f5cedfe-1f57-406f-b413-bbd2387fc9da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac7af37514/javablobcommitblocklistac1950193b881539b66243e9", + "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" : "c411b1f0-caa6-4352-b67d-520080811f53", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF0092CD7\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1955-c01e-00c5-02e5-644e4d000000", + "x-ms-client-request-id" : "c411b1f0-caa6-4352-b67d-520080811f53" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac7af37514/javablobcommitblocklistac1950193b881539b66243e9?comp=lease", + "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" : "1ba8a18f-23f4-40c6-b055-d8e091094e1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF0092CD7\"", + "x-ms-lease-id" : "d7074d35-2637-43eb-8be1-f27f923268ca", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1964-c01e-00c5-10e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "1ba8a18f-23f4-40c6-b055-d8e091094e1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac7af37514/javablobcommitblocklistac1950193b881539b66243e9?comp=blocklist", + "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" : "a6f0ba1f-55f6-4179-86b7-58fb2ddf3b8a", + "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" : "\"0x8D732FCF0151687\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1973-c01e-00c5-1ce5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "a6f0ba1f-55f6-4179-86b7-58fb2ddf3b8a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d8e0a1e2-176c-45ae-892b-cb576893dc3c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a198d-c01e-00c5-34e5-644e4d000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac7af37514Fri, 06 Sep 2019 19:03:43 GMT\"0x8D732FCF0029ACC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "d8e0a1e2-176c-45ae-892b-cb576893dc3c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac7af37514?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" : "1b7f9716-b522-4eb6-98a8-c0d0c63923a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a19a3-c01e-00c5-4ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:42 GMT", + "x-ms-client-request-id" : "1b7f9716-b522-4eb6-98a8-c0d0c63923a9" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac7af37514", "javablobcommitblocklistac1950193b881539b66243e9", "javablobcommitblocklistac25685863c0ba1c4a6047a0" ] +} \ 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..c186f54edbbd --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail038095de4fdae91f2340a9?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" : "f30e7ee1-aee6-4f32-9753-7d74ea808bf7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF02C9B0A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a19c4-c01e-00c5-64e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "f30e7ee1-aee6-4f32-9753-7d74ea808bf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail038095de4fdae91f2340a9/javablobcommitblocklistacfail1897502c6ceb24ad5b41", + "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" : "5033d952-5d8b-4508-9c41-e4e36d7e60c7", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF03CF356\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1a01-c01e-00c5-1de5-644e4d000000", + "x-ms-client-request-id" : "5033d952-5d8b-4508-9c41-e4e36d7e60c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail038095de4fdae91f2340a9/javablobcommitblocklistacfail1897502c6ceb24ad5b41?comp=blocklist", + "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" : "ebc2ea44-6d3c-40a2-b753-cd4de6a3032f", + "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" : "412a1a13-c01e-00c5-2be5-644e4d000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:412a1a13-c01e-00c5-2be5-644e4d000000\nTime:2019-09-06T19:03:44.0298419Z", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "ebc2ea44-6d3c-40a2-b753-cd4de6a3032f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5c55e91e-fa7a-402a-a3e4-6218b8d13e2a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1a29-c01e-00c5-3ce5-644e4d000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail038095de4fdae91f2340a9Fri, 06 Sep 2019 19:03:43 GMT\"0x8D732FCF02C9B0A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "5c55e91e-fa7a-402a-a3e4-6218b8d13e2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail038095de4fdae91f2340a9?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" : "27244b07-8118-4c26-b51c-ebeb6e97611c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1a46-c01e-00c5-53e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "27244b07-8118-4c26-b51c-ebeb6e97611c" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail038095de4fdae91f2340a9", "javablobcommitblocklistacfail1897502c6ceb24ad5b41", "javablobcommitblocklistacfail2359742b6e41c2bb4f40" ] +} \ 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..61b14c6b198b --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail020813d865bea12bc84017?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" : "c0d40db5-e57f-4e06-a5e0-1e9108bb4c03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF0590CF5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1a6a-c01e-00c5-75e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "c0d40db5-e57f-4e06-a5e0-1e9108bb4c03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail020813d865bea12bc84017/javablobcommitblocklistacfail142139455637a2df404b", + "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" : "2595ed1d-5d53-4b9b-ad88-24a39f9c192f", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF06BAF8A\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1abe-c01e-00c5-3fe5-644e4d000000", + "x-ms-client-request-id" : "2595ed1d-5d53-4b9b-ad88-24a39f9c192f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail020813d865bea12bc84017/javablobcommitblocklistacfail142139455637a2df404b?comp=blocklist", + "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" : "ab51cc5c-d5af-4fad-b112-19e61228eae3", + "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" : "412a1ad4-c01e-00c5-53e5-644e4d000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:412a1ad4-c01e-00c5-53e5-644e4d000000\nTime:2019-09-06T19:03:44.3881799Z", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "ab51cc5c-d5af-4fad-b112-19e61228eae3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ce758ad2-2b0a-4760-948b-2a290d7f1b5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1afb-c01e-00c5-78e5-644e4d000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail020813d865bea12bc84017Fri, 06 Sep 2019 19:03:44 GMT\"0x8D732FCF0590CF5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "ce758ad2-2b0a-4760-948b-2a290d7f1b5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail020813d865bea12bc84017?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" : "0ff1df87-9288-476a-99a4-b7e14da31658" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1b0c-c01e-00c5-08e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "0ff1df87-9288-476a-99a4-b7e14da31658" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail020813d865bea12bc84017", "javablobcommitblocklistacfail142139455637a2df404b", "javablobcommitblocklistacfail271224bb110367645741" ] +} \ 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..1af442b31a25 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0559810c98f282573a49bc?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" : "655a15bf-4d49-414c-a111-631cc64f7523" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF08D6FF7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1b2e-c01e-00c5-28e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "655a15bf-4d49-414c-a111-631cc64f7523" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0559810c98f282573a49bc/javablobcommitblocklistacfail131414ca0b6592468841", + "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" : "84845f24-dc50-423f-8620-435d43f71944", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF0956191\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1b3e-c01e-00c5-35e5-644e4d000000", + "x-ms-client-request-id" : "84845f24-dc50-423f-8620-435d43f71944" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0559810c98f282573a49bc/javablobcommitblocklistacfail131414ca0b6592468841?comp=blocklist", + "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" : "df897d6d-706e-4e55-9114-52edb9a2b80f", + "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" : "412a1b4b-c01e-00c5-41e5-644e4d000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:412a1b4b-c01e-00c5-41e5-644e4d000000\nTime:2019-09-06T19:03:44.6053835Z", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "df897d6d-706e-4e55-9114-52edb9a2b80f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "204e6e07-3174-47b2-b964-d7a3ef30882f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1b56-c01e-00c5-4ae5-644e4d000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail0559810c98f282573a49bcFri, 06 Sep 2019 19:03:44 GMT\"0x8D732FCF08D6FF7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "204e6e07-3174-47b2-b964-d7a3ef30882f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0559810c98f282573a49bc?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" : "1515341f-631c-465a-8277-4787f31b413d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1b63-c01e-00c5-57e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "1515341f-631c-465a-8277-4787f31b413d" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail0559810c98f282573a49bc", "javablobcommitblocklistacfail131414ca0b6592468841", "javablobcommitblocklistacfail2185995b191bf0323549" ] +} \ 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..2286eef3dea8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail02678630bbdb8399bf4433?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" : "491c1039-9055-407d-bca2-b4b29d81a65a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF0AD5BB5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1b76-c01e-00c5-67e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "x-ms-client-request-id" : "491c1039-9055-407d-bca2-b4b29d81a65a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail02678630bbdb8399bf4433/javablobcommitblocklistacfail1902034da5ed03224f42", + "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" : "a46d17dd-814a-4dd7-b4ae-ae987699bbe2", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF0B4D7D8\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1b9a-c01e-00c5-7fe5-644e4d000000", + "x-ms-client-request-id" : "a46d17dd-814a-4dd7-b4ae-ae987699bbe2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail02678630bbdb8399bf4433/javablobcommitblocklistacfail1902034da5ed03224f42", + "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" : "05c059e0-aa62-4deb-a0ab-9609ef7ba142" + }, + "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" : "Fri, 06 Sep 2019 19:03:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCF0B4D7D8\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:44 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a1ba8-c01e-00c5-0ce5-644e4d000000", + "x-ms-client-request-id" : "05c059e0-aa62-4deb-a0ab-9609ef7ba142", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail02678630bbdb8399bf4433/javablobcommitblocklistacfail1902034da5ed03224f42?comp=blocklist", + "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" : "c6d537a3-8dcd-49d4-ac76-5a4aa58790fd", + "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" : "412a1bb5-c01e-00c5-15e5-644e4d000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:412a1bb5-c01e-00c5-15e5-644e4d000000\nTime:2019-09-06T19:03:44.8616246Z", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "c6d537a3-8dcd-49d4-ac76-5a4aa58790fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "92d0c809-1ff1-4775-94d1-5b44257e63ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1bc0-c01e-00c5-1de5-644e4d000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail02678630bbdb8399bf4433Fri, 06 Sep 2019 19:03:44 GMT\"0x8D732FCF0AD5BB5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "92d0c809-1ff1-4775-94d1-5b44257e63ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail02678630bbdb8399bf4433?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" : "020974ac-1bad-4999-96b2-09d6e5498180" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1bca-c01e-00c5-24e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "020974ac-1bad-4999-96b2-09d6e5498180" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail02678630bbdb8399bf4433", "javablobcommitblocklistacfail1902034da5ed03224f42", "javablobcommitblocklistacfail243379b50b8c87a6c14d" ] +} \ 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..1b7395825a07 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail072516555cc5a3f6a5453c?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" : "b71a2946-edf3-4cdc-b0d1-778275864e87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF0E9D70A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1c12-c01e-00c5-5ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "b71a2946-edf3-4cdc-b0d1-778275864e87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail072516555cc5a3f6a5453c/javablobcommitblocklistacfail149822d235b340a3a149", + "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" : "3ce035a9-00af-49ad-92bc-728ba7b2ebb1", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF0F0DDA7\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1c1e-c01e-00c5-66e5-644e4d000000", + "x-ms-client-request-id" : "3ce035a9-00af-49ad-92bc-728ba7b2ebb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail072516555cc5a3f6a5453c/javablobcommitblocklistacfail149822d235b340a3a149?comp=lease", + "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" : "127909c5-2508-45ef-a1f6-ad98ead422df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF0F0DDA7\"", + "x-ms-lease-id" : "0045bb5e-a8ab-4a73-83f2-55386f946a59", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1c2d-c01e-00c5-6fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "127909c5-2508-45ef-a1f6-ad98ead422df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail072516555cc5a3f6a5453c/javablobcommitblocklistacfail149822d235b340a3a149?comp=blocklist", + "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" : "86967c16-b490-4894-b469-b460dd0ff00a", + "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" : "412a1c3c-c01e-00c5-7de5-644e4d000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:412a1c3c-c01e-00c5-7de5-644e4d000000\nTime:2019-09-06T19:03:45.2529930Z", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "86967c16-b490-4894-b469-b460dd0ff00a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "99c72d62-74aa-42e1-9dc1-0bb56db5024f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1c4b-c01e-00c5-0ce5-644e4d000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail072516555cc5a3f6a5453cFri, 06 Sep 2019 19:03:45 GMT\"0x8D732FCF0E9D70A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "99c72d62-74aa-42e1-9dc1-0bb56db5024f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail072516555cc5a3f6a5453c?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" : "03ad997d-ffba-4521-be21-58c5d412a306" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1c5b-c01e-00c5-1be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "03ad997d-ffba-4521-be21-58c5d412a306" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail072516555cc5a3f6a5453c", "javablobcommitblocklistacfail149822d235b340a3a149", "javablobcommitblocklistacfail2014688e2c3fa7e7764b" ] +} \ 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..7cc9705fd717 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror09217747b7cc080edf41f7a?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" : "ac6f5257-31e4-4343-9f11-9f2321241a76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF112022E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1c77-c01e-00c5-32e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "ac6f5257-31e4-4343-9f11-9f2321241a76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror09217747b7cc080edf41f7a/javablobcommitblocklisterror136225e547aa75c9c74a", + "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" : "16e497c5-e4cb-4b66-a77b-8fafe48b6f33", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF119A50D\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1c8f-c01e-00c5-46e5-644e4d000000", + "x-ms-client-request-id" : "16e497c5-e4cb-4b66-a77b-8fafe48b6f33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror09217747b7cc080edf41f7a/javablobcommitblocklisterror306525c26185c31b4a42?comp=blocklist", + "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" : "d839d305-302e-4818-8d09-065feec28c95", + "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" : "412a1c9e-c01e-00c5-52e5-644e4d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:412a1c9e-c01e-00c5-52e5-644e4d000000\nTime:2019-09-06T19:03:45.4742017Zx-ms-lease-idgarbage", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "d839d305-302e-4818-8d09-065feec28c95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac0bd462-62cf-4ae2-926a-fc9144b1b589" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1cad-c01e-00c5-5fe5-644e4d000000", + "Body" : "jtccommitblocklisterrorjtccommitblocklisterror09217747b7cc080edf41f7aFri, 06 Sep 2019 19:03:45 GMT\"0x8D732FCF112022E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "ac0bd462-62cf-4ae2-926a-fc9144b1b589", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror09217747b7cc080edf41f7a?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" : "77e5d919-0816-41a9-89ac-28936ef72434" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1cbe-c01e-00c5-6be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "77e5d919-0816-41a9-89ac-28936ef72434" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklisterror09217747b7cc080edf41f7a", "javablobcommitblocklisterror136225e547aa75c9c74a", "javablobcommitblocklisterror268226a68f3e7996bd43", "javablobcommitblocklisterror306525c26185c31b4a42" ] +} \ 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..f0ddc634f539 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0865945794a9875026460c?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" : "00c93dbd-48b1-4287-b39b-aa668b04f93d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEE6C08B2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1484-c01e-00c5-6ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "00c93dbd-48b1-4287-b39b-aa668b04f93d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0865945794a9875026460c/javablobcommitblocklistheaders154456bd1c92d6c38a4", + "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" : "50bfb9c1-e409-4ad4-8368-f9995521b17f", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEE86C4F8\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a14d0-c01e-00c5-31e5-644e4d000000", + "x-ms-client-request-id" : "50bfb9c1-e409-4ad4-8368-f9995521b17f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0865945794a9875026460c/javablobcommitblocklistheaders154456bd1c92d6c38a4?blockid=MDBhZTFkMTUtMmRhZC00YmU2LTg1ZWQtMWYyYThmMTk4MDYw&comp=block", + "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" : "17a924cb-8afe-4f49-b34a-6cca761c588b", + "Content-Type" : "application/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" : "412a14e2-c01e-00c5-42e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "17a924cb-8afe-4f49-b34a-6cca761c588b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0865945794a9875026460c/javablobcommitblocklistheaders154456bd1c92d6c38a4?comp=blocklist", + "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" : "59f6bdd6-f277-4ea1-b498-e4b9273c53f7", + "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" : "\"0x8D732FCEE934B16\"", + "x-ms-content-crc64" : "PDCmtJEI8EU=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a14f5-c01e-00c5-52e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "59f6bdd6-f277-4ea1-b498-e4b9273c53f7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0865945794a9875026460c/javablobcommitblocklistheaders154456bd1c92d6c38a4", + "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" : "fc99bd89-a41d-41a1-a335-4874ba83b0a4" + }, + "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" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCEE934B16\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a150b-c01e-00c5-65e5-644e4d000000", + "x-ms-client-request-id" : "fc99bd89-a41d-41a1-a335-4874ba83b0a4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c3d1db3b-4c3a-486e-a1a9-4812d678af23" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a151a-c01e-00c5-73e5-644e4d000000", + "Body" : "jtccommitblocklistheadersjtccommitblocklistheaders0865945794a9875026460cFri, 06 Sep 2019 19:03:40 GMT\"0x8D732FCEE6C08B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "c3d1db3b-4c3a-486e-a1a9-4812d678af23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0865945794a9875026460c?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" : "2bc35c97-bdcb-4df1-883c-5c7a45964b7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1520-c01e-00c5-77e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "2bc35c97-bdcb-4df1-883c-5c7a45964b7e" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistheaders0865945794a9875026460c", "javablobcommitblocklistheaders154456bd1c92d6c38a4", "javablobcommitblocklistheaders2114526d62bbef6c404", "00ae1d15-2dad-4be6-85ed-1f2a8f198060" ] +} \ 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..b2bcc315b3f8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0704790d71d36d7efe4a36?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" : "38b53d51-5bab-47cf-80b8-20c1767b02df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEEAE0396\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1532-c01e-00c5-07e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "38b53d51-5bab-47cf-80b8-20c1767b02df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0704790d71d36d7efe4a36/javablobcommitblocklistheaders19210218470af86c474", + "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" : "57405300-d240-45bf-8653-99583049d7fc", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEEB532F5\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a154b-c01e-00c5-1de5-644e4d000000", + "x-ms-client-request-id" : "57405300-d240-45bf-8653-99583049d7fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0704790d71d36d7efe4a36/javablobcommitblocklistheaders19210218470af86c474?blockid=NTQ4ZDgyODAtNTk4Ny00YTU3LWE5YTEtNGVlN2U5YWI2YmIz&comp=block", + "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" : "4da9511a-7a90-445d-9713-c0f8d672c6f3", + "Content-Type" : "application/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" : "412a1564-c01e-00c5-2ee5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "4da9511a-7a90-445d-9713-c0f8d672c6f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0704790d71d36d7efe4a36/javablobcommitblocklistheaders19210218470af86c474?comp=blocklist", + "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" : "44467e8c-7d24-4bf0-a86d-5a8b42030f4f", + "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" : "\"0x8D732FCEEC2A3A6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a156e-c01e-00c5-36e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "44467e8c-7d24-4bf0-a86d-5a8b42030f4f", + "Content-MD5" : "9Y0uIC9y6SobNJS6t05RRQ==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0704790d71d36d7efe4a36/javablobcommitblocklistheaders19210218470af86c474", + "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" : "773b6c40-aa31-4d21-94ab-45b3d72a3814" + }, + "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" : "Fri, 06 Sep 2019 19:03: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" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a1577-c01e-00c5-3fe5-644e4d000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D732FCEEC2A3A6\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "773b6c40-aa31-4d21-94ab-45b3d72a3814", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "43ca7ea4-e0cd-4236-8632-0b9f864f95cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a158d-c01e-00c5-52e5-644e4d000000", + "Body" : "jtccommitblocklistheadersjtccommitblocklistheaders0704790d71d36d7efe4a36Fri, 06 Sep 2019 19:03:41 GMT\"0x8D732FCEEAE0396\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "43ca7ea4-e0cd-4236-8632-0b9f864f95cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0704790d71d36d7efe4a36?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" : "55eb644a-bd61-40c2-8082-8a369d791589" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a15a0-c01e-00c5-61e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "55eb644a-bd61-40c2-8082-8a369d791589" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistheaders0704790d71d36d7efe4a36", "javablobcommitblocklistheaders19210218470af86c474", "javablobcommitblocklistheaders29636873256e24e3414", "548d8280-5987-4a57-a9a1-4ee7e9ab6bb3" ] +} \ 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..8791ac46e9f9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata079059c5d0bb42609c4b5?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" : "fcd6bbd9-ee79-4b73-8c87-7f855b037556" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEEE01C2B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a15ba-c01e-00c5-76e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "fcd6bbd9-ee79-4b73-8c87-7f855b037556" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata079059c5d0bb42609c4b5/javablobcommitblocklistmetadata13321951c55383c5144", + "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" : "f0055105-aa1a-48ae-b6e9-f30ffba4cee2", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEEE77280\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a15d2-c01e-00c5-0be5-644e4d000000", + "x-ms-client-request-id" : "f0055105-aa1a-48ae-b6e9-f30ffba4cee2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata079059c5d0bb42609c4b5/javablobcommitblocklistmetadata13321951c55383c5144?comp=blocklist", + "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" : "f7cd0148-79ed-4e36-aab9-67e50e4b7739", + "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" : "\"0x8D732FCEEEF6399\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a15e3-c01e-00c5-19e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "f7cd0148-79ed-4e36-aab9-67e50e4b7739" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata079059c5d0bb42609c4b5/javablobcommitblocklistmetadata13321951c55383c5144", + "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" : "2873f6ef-5231-4bb4-ab13-6f5bbd5a1104" + }, + "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" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:41 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" : "\"0x8D732FCEEEF6399\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "412a15ed-c01e-00c5-21e5-644e4d000000", + "x-ms-client-request-id" : "2873f6ef-5231-4bb4-ab13-6f5bbd5a1104", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c1c8743e-4ed7-424d-a7e7-e84d62b58376" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1601-c01e-00c5-2fe5-644e4d000000", + "Body" : "jtccommitblocklistmetadatajtccommitblocklistmetadata079059c5d0bb42609c4b5Fri, 06 Sep 2019 19:03:41 GMT\"0x8D732FCEEE01C2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "c1c8743e-4ed7-424d-a7e7-e84d62b58376", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata079059c5d0bb42609c4b5?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" : "ba04b72d-9490-4a59-bd61-7c2e14b8598b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a160d-c01e-00c5-3ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "ba04b72d-9490-4a59-bd61-7c2e14b8598b" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmetadata079059c5d0bb42609c4b5", "javablobcommitblocklistmetadata13321951c55383c5144", "javablobcommitblocklistmetadata2544928bf74a54d9c54" ] +} \ 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..ab00c55f1ef0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata04836518c751a18d4d49e?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" : "f81ad0fc-d295-44d0-af1c-ca277d7c0d77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEF0A1C76\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a161c-c01e-00c5-48e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "f81ad0fc-d295-44d0-af1c-ca277d7c0d77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata04836518c751a18d4d49e/javablobcommitblocklistmetadata18437591bf1d0439174", + "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" : "f9f4b85b-1a4b-4af2-bbfc-6579b2831230", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEF120F07\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1633-c01e-00c5-59e5-644e4d000000", + "x-ms-client-request-id" : "f9f4b85b-1a4b-4af2-bbfc-6579b2831230" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata04836518c751a18d4d49e/javablobcommitblocklistmetadata18437591bf1d0439174?comp=blocklist", + "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" : "823c7bac-e78b-4a53-8d8e-0f991d4cfec1", + "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" : "\"0x8D732FCEF191593\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a164d-c01e-00c5-6ce5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "823c7bac-e78b-4a53-8d8e-0f991d4cfec1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata04836518c751a18d4d49e/javablobcommitblocklistmetadata18437591bf1d0439174", + "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" : "890ff865-01c4-4c8c-a4a4-20ab7ed511e7" + }, + "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" : "Fri, 06 Sep 2019 19:03:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:41 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" : "\"0x8D732FCEF191593\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:42 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "412a1661-c01e-00c5-7be5-644e4d000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "890ff865-01c4-4c8c-a4a4-20ab7ed511e7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9cfe9c3f-b99f-45d3-af19-2874654843c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1673-c01e-00c5-0ae5-644e4d000000", + "Body" : "jtccommitblocklistmetadatajtccommitblocklistmetadata04836518c751a18d4d49eFri, 06 Sep 2019 19:03:41 GMT\"0x8D732FCEF0A1C76\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "9cfe9c3f-b99f-45d3-af19-2874654843c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata04836518c751a18d4d49e?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" : "d50757a2-1f90-4f4d-bc5f-4f712bd302f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a167d-c01e-00c5-12e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:41 GMT", + "x-ms-client-request-id" : "d50757a2-1f90-4f4d-bc5f-4f712bd302f0" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmetadata04836518c751a18d4d49e", "javablobcommitblocklistmetadata18437591bf1d0439174", "javablobcommitblocklistmetadata254321b76b7a022dfe4" ] +} \ 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..9b0bf5f935eb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin072850e18d9291d96049c580?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" : "d28d3cdd-f40a-4196-94dd-8f8f325f460d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEE1C00A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a13a3-c01e-00c5-39e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "d28d3cdd-f40a-4196-94dd-8f8f325f460d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin072850e18d9291d96049c580/javablobcommitblocklistmin10273503332e9d8f9e459", + "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" : "06be3ec0-6ee2-4171-a417-7bee9d6a343e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEE233088\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a13b0-c01e-00c5-45e5-644e4d000000", + "x-ms-client-request-id" : "06be3ec0-6ee2-4171-a417-7bee9d6a343e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin072850e18d9291d96049c580/javablobcommitblocklistmin10273503332e9d8f9e459?blockid=NmJhNGI3YzItZjg0NC00YWJhLTkwNzQtN2UyYWVhZWU2MDhk&comp=block", + "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" : "9a5e7023-600a-4056-bf07-c06baee90e62", + "Content-Type" : "application/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" : "412a13ca-c01e-00c5-5ae5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "9a5e7023-600a-4056-bf07-c06baee90e62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin072850e18d9291d96049c580/javablobcommitblocklistmin10273503332e9d8f9e459?comp=blocklist", + "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" : "c5f15da2-f9ab-4a71-a414-20e6aa880de3", + "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" : "\"0x8D732FCEE342486\"", + "x-ms-content-crc64" : "KeYYvb/joeM=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a13d7-c01e-00c5-65e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "c5f15da2-f9ab-4a71-a414-20e6aa880de3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0da241ff-9cd9-41e7-82ce-2ed09899ad71" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a13f5-c01e-00c5-7ee5-644e4d000000", + "Body" : "jtccommitblocklistminjtccommitblocklistmin072850e18d9291d96049c580Fri, 06 Sep 2019 19:03:40 GMT\"0x8D732FCEE1C00A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "0da241ff-9cd9-41e7-82ce-2ed09899ad71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin072850e18d9291d96049c580?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" : "f1c0e053-6b69-451a-8d7a-8d719ce0261a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1402-c01e-00c5-09e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "f1c0e053-6b69-451a-8d7a-8d719ce0261a" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmin072850e18d9291d96049c580", "javablobcommitblocklistmin10273503332e9d8f9e459", "javablobcommitblocklistmin266973a1d87b73f43749d", "6ba4b7c2-f844-4aba-9074-7e2aeaee608d" ] +} \ 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..41297b384eaf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull06525959d6b27494614434a?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" : "12dd7bd7-0c49-4d10-a25b-5fbf866922f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEE4760E3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1420-c01e-00c5-1be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "12dd7bd7-0c49-4d10-a25b-5fbf866922f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull06525959d6b27494614434a/javablobcommitblocklistnull18421621b3d01a21f7412", + "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" : "b04ac6b5-e454-4e74-9839-825bfecb1b7c", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEE4E697A\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1433-c01e-00c5-2ce5-644e4d000000", + "x-ms-client-request-id" : "b04ac6b5-e454-4e74-9839-825bfecb1b7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull06525959d6b27494614434a/javablobcommitblocklistnull18421621b3d01a21f7412?comp=blocklist", + "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" : "c39515c5-3f1e-4db0-a5b7-6de70edefea9", + "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" : "\"0x8D732FCEE565AA1\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a144d-c01e-00c5-3ee5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "c39515c5-3f1e-4db0-a5b7-6de70edefea9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1f0ece50-243a-4dc9-b44d-b6d3fd4ae480" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1460-c01e-00c5-4be5-644e4d000000", + "Body" : "jtccommitblocklistnulljtccommitblocklistnull06525959d6b27494614434aFri, 06 Sep 2019 19:03:40 GMT\"0x8D732FCEE4760E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "1f0ece50-243a-4dc9-b44d-b6d3fd4ae480", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull06525959d6b27494614434a?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" : "c834adef-cef5-4adb-a035-b4037b2e51c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a146d-c01e-00c5-56e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:40 GMT", + "x-ms-client-request-id" : "c834adef-cef5-4adb-a035-b4037b2e51c8" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistnull06525959d6b27494614434a", "javablobcommitblocklistnull18421621b3d01a21f7412", "javablobcommitblocklistnull282324362ee9429ed3464" ] +} \ 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..fcc96ec81202 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b?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" : "383ec7c0-fc16-473e-b0f0-145faaf93ad7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF138581B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1cda-c01e-00c5-03e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "x-ms-client-request-id" : "383ec7c0-fc16-473e-b0f0-145faaf93ad7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431", + "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" : "2ca9d5f2-fde0-4d01-8d25-b0caeff47f0b", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF15583C5\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1d27-c01e-00c5-42e5-644e4d000000", + "x-ms-client-request-id" : "2ca9d5f2-fde0-4d01-8d25-b0caeff47f0b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431?blockid=NDU4NjZiN2YtYjZjOC00ZjhhLWE4MjEtNzk5YzUyMTI4MmU4&comp=block", + "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" : "ad01a42b-cfaf-4811-bc26-1bbc245d1612", + "Content-Type" : "application/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" : "412a1d3a-c01e-00c5-50e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "ad01a42b-cfaf-4811-bc26-1bbc245d1612" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431?blockid=ZmUzZmJmNDYtODhmYi00ZTU3LWFlZjYtNzBhZDU5NTgxYmQ3&comp=block", + "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" : "ec68f713-3563-41fb-8c56-14ec7a0d3f03", + "Content-Type" : "application/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" : "412a1d4b-c01e-00c5-5ee5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "ec68f713-3563-41fb-8c56-14ec7a0d3f03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431?comp=blocklist", + "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" : "a4e97a28-1ad6-4f6b-b106-e3578ba77546", + "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" : "\"0x8D732FCF168C237\"", + "x-ms-content-crc64" : "4kbUw2LgLrE=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1d5c-c01e-00c5-6de5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "a4e97a28-1ad6-4f6b-b106-e3578ba77546" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431?blockid=NjU2Yzg5MzItMTUzYy00ODk4LWE3YjMtMTMxOTYzY2E2YjQ4&comp=block", + "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" : "af807133-579e-4043-b711-d44181c63c53", + "Content-Type" : "application/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" : "412a1d6d-c01e-00c5-7be5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "af807133-579e-4043-b711-d44181c63c53" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431?blockid=MjY0ZGM5NjktNDE2NC00Y2QyLTliZDUtOGYyOWYxNjFhMThl&comp=block", + "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" : "430bdff9-0d75-4ecd-9359-41bb1ffc9565", + "Content-Type" : "application/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" : "412a1d81-c01e-00c5-0ce5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "430bdff9-0d75-4ecd-9359-41bb1ffc9565" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b/javablobgetblocklist1blockblobapitestgetblocklist8bb04587431?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "117a0c20-5204-4c7b-89c2-fbff8763fdfa" + }, + "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" : "Fri, 06 Sep 2019 19:03:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "ETag" : "\"0x8D732FCF168C237\"", + "x-ms-request-id" : "412a1dac-c01e-00c5-31e5-644e4d000000", + "Body" : "NDU4NjZiN2YtYjZjOC00ZjhhLWE4MjEtNzk5YzUyMTI4MmU47ZmUzZmJmNDYtODhmYi00ZTU3LWFlZjYtNzBhZDU5NTgxYmQ37MjY0ZGM5NjktNDE2NC00Y2QyLTliZDUtOGYyOWYxNjFhMThl7NjU2Yzg5MzItMTUzYy00ODk4LWE3YjMtMTMxOTYzY2E2YjQ47", + "x-ms-client-request-id" : "117a0c20-5204-4c7b-89c2-fbff8763fdfa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2a11413d-59ce-402a-ac03-cd63436e12cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1dd7-c01e-00c5-56e5-644e4d000000", + "Body" : "jtcgetblocklistjtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25bFri, 06 Sep 2019 19:03:45 GMT\"0x8D732FCF138581B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "2a11413d-59ce-402a-ac03-cd63436e12cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b?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" : "e2f84939-fdb2-42d9-a6c8-db18d28cf74a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1de2-c01e-00c5-60e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "e2f84939-fdb2-42d9-a6c8-db18d28cf74a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklist0blockblobapitestgetblocklist8bb31325ab25b", "javablobgetblocklist1blockblobapitestgetblocklist8bb04587431", "javablobgetblocklist2blockblobapitestgetblocklist8bb735352b6", "45866b7f-b6c8-4f8a-a821-799c521282e8", "fe3fbf46-88fb-4e57-aef6-70ad59581bd7", "656c8932-153c-4898-a7b3-131963ca6b48", "264dc969-4164-4cd2-9bd5-8f29f161a18e" ] +} \ 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..a3f29de5740c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterrorc7660577?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" : "53888560-3eea-4db1-adb9-484616b5d12c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF318AF11\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a2278-c01e-00c5-4be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "53888560-3eea-4db1-adb9-484616b5d12c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterrorc7660577/javablobgetblocklisterror1153067c9b20e2235546b7", + "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" : "9dd4ff90-dad1-483c-aa28-a53af000356a", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF31FDB72\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a2293-c01e-00c5-62e5-644e4d000000", + "x-ms-client-request-id" : "9dd4ff90-dad1-483c-aa28-a53af000356a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterrorc7660577/javablobgetblocklisterror308410a4c7bd1db9094b91?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d603438e-e006-4890-a1a6-7958bb626284" + }, + "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" : "412a22aa-c01e-00c5-74e5-644e4d000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:412a22aa-c01e-00c5-74e5-644e4d000000\nTime:2019-09-06T19:03:48.8753934Z", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "d603438e-e006-4890-a1a6-7958bb626284", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b3ac904a-6ed1-45fb-b72d-71d6500e50f8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a22c4-c01e-00c5-0ae5-644e4d000000", + "Body" : "jtcgetblocklisterrorjtcgetblocklisterror0blockblobapitestgetblocklisterrorc7660577Fri, 06 Sep 2019 19:03:48 GMT\"0x8D732FCF318AF11\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "b3ac904a-6ed1-45fb-b72d-71d6500e50f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterrorc7660577?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" : "2ff8e2d0-1185-43a3-b42c-8145dfdf98b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a22d1-c01e-00c5-17e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "2ff8e2d0-1185-43a3-b42c-8145dfdf98b4" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisterror0blockblobapitestgetblocklisterrorc7660577", "javablobgetblocklisterror1153067c9b20e2235546b7", "javablobgetblocklisterror2176393edfed99447149f3", "javablobgetblocklisterror308410a4c7bd1db9094b91" ] +} \ 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..111548755018 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528?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" : "8f6f3fec-76d8-4490-99f7-901ca55541bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF2C2B229\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a214f-c01e-00c5-4ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "8f6f3fec-76d8-4490-99f7-901ca55541bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528/javablobgetblocklistlease1118988cb102161b6f4a94", + "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" : "fb2255b5-6995-4cb3-b72a-29fd86e4a9b3", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF2CA5405\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a2171-c01e-00c5-65e5-644e4d000000", + "x-ms-client-request-id" : "fb2255b5-6995-4cb3-b72a-29fd86e4a9b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528/javablobgetblocklistlease1118988cb102161b6f4a94?comp=lease", + "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" : "52cd45bd-cab6-4f75-856f-f0038fd1272b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF2CA5405\"", + "x-ms-lease-id" : "f8745044-c793-4eaf-863d-5a55d3a088b0", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a2180-c01e-00c5-74e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "52cd45bd-cab6-4f75-856f-f0038fd1272b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528/javablobgetblocklistlease1118988cb102161b6f4a94?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1a52d9e1-ff08-4ecb-8193-c4233e8d7b41" + }, + "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" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "ETag" : "\"0x8D732FCF2CA5405\"", + "x-ms-request-id" : "412a2196-c01e-00c5-07e5-644e4d000000", + "Body" : "", + "x-ms-client-request-id" : "1a52d9e1-ff08-4ecb-8193-c4233e8d7b41", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e80742da-ba4e-4176-8cb5-f2a7c09091ec" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a21a4-c01e-00c5-15e5-644e4d000000", + "Body" : "jtcgetblocklistleasejtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528Fri, 06 Sep 2019 19:03:48 GMT\"0x8D732FCF2C2B229\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "e80742da-ba4e-4176-8cb5-f2a7c09091ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528?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" : "15eea3bf-9503-4dfd-bdc3-b3364ec890f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a21af-c01e-00c5-1de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "15eea3bf-9503-4dfd-bdc3-b3364ec890f1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistlease0blockblobapitestgetblocklistleasee5264528", "javablobgetblocklistlease1118988cb102161b6f4a94", "javablobgetblocklistlease2745530177f5a971b246d9" ] +} \ 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..068e81054209 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail041644402fdd20e6584f80?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" : "c9492cb7-b1bf-4c95-b7c4-39af6a6980bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF2ED00A7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a21c7-c01e-00c5-34e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "c9492cb7-b1bf-4c95-b7c4-39af6a6980bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail041644402fdd20e6584f80/javablobgetblocklistleasefail153596337d033af8974e", + "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" : "902e9ec6-b069-4c00-907e-210af8901581", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF2F3B7D7\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a21df-c01e-00c5-48e5-644e4d000000", + "x-ms-client-request-id" : "902e9ec6-b069-4c00-907e-210af8901581" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail041644402fdd20e6584f80/javablobgetblocklistleasefail153596337d033af8974e?comp=lease", + "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" : "1342c7fd-b8b7-44ab-b6fc-d698ec049197" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF2F3B7D7\"", + "x-ms-lease-id" : "cc9413ab-6703-4e5b-9d7f-ad3af6bd21c5", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a21f2-c01e-00c5-59e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "1342c7fd-b8b7-44ab-b6fc-d698ec049197" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail041644402fdd20e6584f80/javablobgetblocklistleasefail153596337d033af8974e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3bdd385d-2923-4fde-8db3-b05f6a0d2da6" + }, + "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" : "412a2217-c01e-00c5-7ae5-644e4d000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:412a2217-c01e-00c5-7ae5-644e4d000000\nTime:2019-09-06T19:03:48.6311641Z", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "3bdd385d-2923-4fde-8db3-b05f6a0d2da6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "249c378b-1c48-4f38-85a0-ae2457f7f4ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a223a-c01e-00c5-19e5-644e4d000000", + "Body" : "jtcgetblocklistleasefailjtcgetblocklistleasefail041644402fdd20e6584f80Fri, 06 Sep 2019 19:03:48 GMT\"0x8D732FCF2ED00A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "249c378b-1c48-4f38-85a0-ae2457f7f4ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail041644402fdd20e6584f80?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" : "4a4930ab-83de-41ed-9b88-f3c9877ae3b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a224c-c01e-00c5-28e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "4a4930ab-83de-41ed-9b88-f3c9877ae3b7" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistleasefail041644402fdd20e6584f80", "javablobgetblocklistleasefail153596337d033af8974e", "javablobgetblocklistleasefail2617383fb95530616641" ] +} \ 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..494e3f11b07e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmin26974142b8?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" : "a8456b8d-6fac-476f-a6d1-f0725c83dc71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF1A00C79\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1df2-c01e-00c5-6de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "a8456b8d-6fac-476f-a6d1-f0725c83dc71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmin26974142b8/javablobgetblocklistmin1066615319c9da4794409c8", + "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" : "e04b6200-8348-4186-b022-587fc00adfcc", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF1A760B6\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1e01-c01e-00c5-79e5-644e4d000000", + "x-ms-client-request-id" : "e04b6200-8348-4186-b022-587fc00adfcc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmin26974142b8/javablobgetblocklistmin1066615319c9da4794409c8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "08e6ccf6-7671-4fb4-a846-c72bbfb89540" + }, + "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" : "Fri, 06 Sep 2019 19:03:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "ETag" : "\"0x8D732FCF1A760B6\"", + "x-ms-request-id" : "412a1e1e-c01e-00c5-0fe5-644e4d000000", + "Body" : "", + "x-ms-client-request-id" : "08e6ccf6-7671-4fb4-a846-c72bbfb89540", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3453e9e0-9b9c-4fce-b643-55a6b3c7aa15" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1e29-c01e-00c5-18e5-644e4d000000", + "Body" : "jtcgetblocklistminjtcgetblocklistmin0blockblobapitestgetblocklistmin26974142b8Fri, 06 Sep 2019 19:03:46 GMT\"0x8D732FCF1A00C79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "3453e9e0-9b9c-4fce-b643-55a6b3c7aa15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmin26974142b8?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" : "c29165b2-7efe-42b3-abe6-2096f289fc16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1e40-c01e-00c5-2de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "c29165b2-7efe-42b3-abe6-2096f289fc16" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistmin0blockblobapitestgetblocklistmin26974142b8", "javablobgetblocklistmin1066615319c9da4794409c8", "javablobgetblocklistmin2859532be4e0c1f4224c6c9" ] +} \ 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..8524e0f128f5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970?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" : "10de04b9-c0b6-4d91-af0d-4a28f77087cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF1C269C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1e58-c01e-00c5-43e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "10de04b9-c0b6-4d91-af0d-4a28f77087cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970/javablobgetblocklisttype10863452746390c1f34f07", + "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" : "5fdf7039-50a7-4360-b6d0-6621ac03a8cd", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF1C9218C\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1e6e-c01e-00c5-56e5-644e4d000000", + "x-ms-client-request-id" : "5fdf7039-50a7-4360-b6d0-6621ac03a8cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970/javablobgetblocklisttype10863452746390c1f34f07?blockid=N2RlZTkxM2QtMzI5Ni00ZDY5LWFhZTMtNTUzZjZjOTk0ODZl&comp=block", + "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" : "3d211206-904b-466a-9516-466898d782cb", + "Content-Type" : "application/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" : "412a1e73-c01e-00c5-5be5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "3d211206-904b-466a-9516-466898d782cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970/javablobgetblocklisttype10863452746390c1f34f07?comp=blocklist", + "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" : "56af0ca9-0377-4e24-8e80-9efc31804af1", + "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" : "\"0x8D732FCF1D7F21F\"", + "x-ms-content-crc64" : "9ULKR1QvjgQ=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1e8a-c01e-00c5-6fe5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "56af0ca9-0377-4e24-8e80-9efc31804af1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970/javablobgetblocklisttype10863452746390c1f34f07?blockid=YjViYjA3NDUtN2RiMy00NGJlLWJlNGUtMzc2ODU0YTRjYmMx&comp=block", + "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" : "b127f570-3333-4b6a-87f4-97b68063d920", + "Content-Type" : "application/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" : "412a1e9f-c01e-00c5-01e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "b127f570-3333-4b6a-87f4-97b68063d920" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970/javablobgetblocklisttype10863452746390c1f34f07?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8a0bddf3-2ff4-4d84-a9eb-35e16418dbd9" + }, + "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" : "Fri, 06 Sep 2019 19:03:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "ETag" : "\"0x8D732FCF1D7F21F\"", + "x-ms-request-id" : "412a1eac-c01e-00c5-0ee5-644e4d000000", + "Body" : "N2RlZTkxM2QtMzI5Ni00ZDY5LWFhZTMtNTUzZjZjOTk0ODZl7YjViYjA3NDUtN2RiMy00NGJlLWJlNGUtMzc2ODU0YTRjYmMx7", + "x-ms-client-request-id" : "8a0bddf3-2ff4-4d84-a9eb-35e16418dbd9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ca13fd43-3028-457f-8189-90a1dd8dfdfd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1ec1-c01e-00c5-1ee5-644e4d000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970Fri, 06 Sep 2019 19:03:46 GMT\"0x8D732FCF1C269C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:45 GMT", + "x-ms-client-request-id" : "ca13fd43-3028-457f-8189-90a1dd8dfdfd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970?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" : "3af86143-fabe-41a3-8c66-215249240901" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1ed2-c01e-00c5-2be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "3af86143-fabe-41a3-8c66-215249240901" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttype3f5797970", "javablobgetblocklisttype10863452746390c1f34f07", "javablobgetblocklisttype207684ad372fc8ba3f49d2", "7dee913d-3296-4d69-aae3-553f6c99486e", "b5bb0745-7db3-44be-be4e-376854a4cbc1" ] +} \ 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..10778b869359 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613?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" : "494a03e0-2692-4325-b2e7-1c35b97bd67a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF2026864\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1ef8-c01e-00c5-4be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "494a03e0-2692-4325-b2e7-1c35b97bd67a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613/javablobgetblocklisttype191210cb91f11bbc28445e", + "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" : "0b9dbe98-f460-4894-8c2e-85870c291d6e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF20A0A8D\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1f12-c01e-00c5-61e5-644e4d000000", + "x-ms-client-request-id" : "0b9dbe98-f460-4894-8c2e-85870c291d6e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613/javablobgetblocklisttype191210cb91f11bbc28445e?blockid=YjlkOGM0ZDEtYmVjYy00MzljLTg5YjQtZGJhYTI4NGI3OWRh&comp=block", + "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" : "1ff0376b-414a-4618-822b-322570b6753f", + "Content-Type" : "application/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" : "412a1f30-c01e-00c5-7ce5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "1ff0376b-414a-4618-822b-322570b6753f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613/javablobgetblocklisttype191210cb91f11bbc28445e?comp=blocklist", + "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" : "4407190e-2ad5-47e9-889a-43daf2cba5ba", + "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" : "\"0x8D732FCF21C102C\"", + "x-ms-content-crc64" : "7BZaDOEOBho=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1f4b-c01e-00c5-11e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "4407190e-2ad5-47e9-889a-43daf2cba5ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613/javablobgetblocklisttype191210cb91f11bbc28445e?blockid=MTRjMDM2NTUtODIwOS00ZjQ1LTgzZWYtMWNmM2IwMzM5ODgy&comp=block", + "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" : "b950f33b-88d3-462d-9b38-f436329c319f", + "Content-Type" : "application/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" : "412a1f59-c01e-00c5-1fe5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "b950f33b-88d3-462d-9b38-f436329c319f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613/javablobgetblocklisttype191210cb91f11bbc28445e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5b06d66b-4466-4eb7-a7a2-ce710f341015" + }, + "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" : "Fri, 06 Sep 2019 19:03:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "ETag" : "\"0x8D732FCF21C102C\"", + "x-ms-request-id" : "412a1f65-c01e-00c5-29e5-644e4d000000", + "Body" : "YjlkOGM0ZDEtYmVjYy00MzljLTg5YjQtZGJhYTI4NGI3OWRh7", + "x-ms-client-request-id" : "5b06d66b-4466-4eb7-a7a2-ce710f341015", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5fed1b4a-3686-4391-8226-69ad47c1ad81" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1f75-c01e-00c5-37e5-644e4d000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttype470016613Fri, 06 Sep 2019 19:03:46 GMT\"0x8D732FCF2026864\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "5fed1b4a-3686-4391-8226-69ad47c1ad81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613?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" : "e3c89156-24c8-43e4-857b-6dec7a771f01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1f87-c01e-00c5-45e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "e3c89156-24c8-43e4-857b-6dec7a771f01" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttype470016613", "javablobgetblocklisttype191210cb91f11bbc28445e", "javablobgetblocklisttype260376f850f241d9764762", "b9d8c4d1-becc-439c-89b4-dbaa284b79da", "14c03655-8209-4f45-83ef-1cf3b0339882" ] +} \ 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..e2e261e433a3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490?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" : "14879b40-8ed8-4ab5-bf90-a92e8ca660bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF2435186\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1fb1-c01e-00c5-65e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "14879b40-8ed8-4ab5-bf90-a92e8ca660bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490/javablobgetblocklisttype1250139467e2911e964420", + "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" : "65d55ae6-3261-4d99-a723-21aa48618b6d", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF260CAA3\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a2016-c01e-00c5-3ee5-644e4d000000", + "x-ms-client-request-id" : "65d55ae6-3261-4d99-a723-21aa48618b6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490/javablobgetblocklisttype1250139467e2911e964420?blockid=OThkNmNkZTEtZTdlOS00MmE4LTliNDMtMTBiMGY5ODdlY2Ux&comp=block", + "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" : "3395c689-a0d4-464b-a2c2-cc58028ee4b8", + "Content-Type" : "application/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" : "412a202c-c01e-00c5-52e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "3395c689-a0d4-464b-a2c2-cc58028ee4b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490/javablobgetblocklisttype1250139467e2911e964420?comp=blocklist", + "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" : "c1dee5f5-2ec8-4a2d-a085-425981bbd1eb", + "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" : "\"0x8D732FCF26D9EE9\"", + "x-ms-content-crc64" : "ORFoRyv/ZYg=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a203c-c01e-00c5-5fe5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "c1dee5f5-2ec8-4a2d-a085-425981bbd1eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490/javablobgetblocklisttype1250139467e2911e964420?blockid=NzM5NDAxYzQtMjM5Mi00Y2RiLWJjMjUtNmJkMDlhMzU2ODEy&comp=block", + "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" : "0e8e20ee-0d1c-4698-8c34-d7ad5f6799dd", + "Content-Type" : "application/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" : "412a2057-c01e-00c5-75e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "x-ms-client-request-id" : "0e8e20ee-0d1c-4698-8c34-d7ad5f6799dd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490/javablobgetblocklisttype1250139467e2911e964420?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dda635e5-487a-4f5c-bf5d-933a6a92a680" + }, + "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" : "Fri, 06 Sep 2019 19:03:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:46 GMT", + "ETag" : "\"0x8D732FCF26D9EE9\"", + "x-ms-request-id" : "412a2067-c01e-00c5-01e5-644e4d000000", + "Body" : "NzM5NDAxYzQtMjM5Mi00Y2RiLWJjMjUtNmJkMDlhMzU2ODEy7", + "x-ms-client-request-id" : "dda635e5-487a-4f5c-bf5d-933a6a92a680", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1a298a9f-06b1-4a2a-9a19-d9f3ff9cdede" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a20a2-c01e-00c5-36e5-644e4d000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490Fri, 06 Sep 2019 19:03:47 GMT\"0x8D732FCF2435186\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "1a298a9f-06b1-4a2a-9a19-d9f3ff9cdede", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490?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" : "027e9a77-b595-400f-b02d-0643cf4e9442" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a20b8-c01e-00c5-48e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "027e9a77-b595-400f-b02d-0643cf4e9442" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttypee48266490", "javablobgetblocklisttype1250139467e2911e964420", "javablobgetblocklisttype221191a28ed1b7a3834a9e", "98d6cde1-e7e9-42a8-9b43-10b0f987ece1", "739401c4-2392-4cdb-bc25-6bd09a356812" ] +} \ 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..1ff84b8bd272 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull09027530c9f453b4f84a96a?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" : "a4e55f82-8b90-44b5-8298-60d7185360c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF29AD538\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a20cc-c01e-00c5-59e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "a4e55f82-8b90-44b5-8298-60d7185360c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull09027530c9f453b4f84a96a/javablobgetblocklisttypenull1622687bddef52bcbf42", + "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" : "6283e8d3-859f-4666-8c67-84ca06d4c446", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF2A18C93\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a20da-c01e-00c5-64e5-644e4d000000", + "x-ms-client-request-id" : "6283e8d3-859f-4666-8c67-84ca06d4c446" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull09027530c9f453b4f84a96a/javablobgetblocklisttypenull1622687bddef52bcbf42?comp=blocklist", + "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" : "b17ad5b3-d542-47e5-8d80-6db4c837025f" + }, + "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" : "Fri, 06 Sep 2019 19:03:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "ETag" : "\"0x8D732FCF2A18C93\"", + "x-ms-request-id" : "412a2100-c01e-00c5-06e5-644e4d000000", + "Body" : "", + "x-ms-client-request-id" : "b17ad5b3-d542-47e5-8d80-6db4c837025f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ad76b06e-bba8-40f1-b55a-90aa54b0f33a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a211b-c01e-00c5-1de5-644e4d000000", + "Body" : "jtcgetblocklisttypenulljtcgetblocklisttypenull09027530c9f453b4f84a96aFri, 06 Sep 2019 19:03:47 GMT\"0x8D732FCF29AD538\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "ad76b06e-bba8-40f1-b55a-90aa54b0f33a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull09027530c9f453b4f84a96a?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" : "cc8f9d38-3800-48c9-abc9-f67b7424a64b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a2133-c01e-00c5-32e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:47 GMT", + "x-ms-client-request-id" : "cc8f9d38-3800-48c9-abc9-f67b7424a64b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttypenull09027530c9f453b4f84a96a", "javablobgetblocklisttypenull1622687bddef52bcbf42", "javablobgetblocklisttypenull26348064a8f34ec4114f" ] +} \ 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..a8c898e67f82 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblockc48550355ac2a6d?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" : "76bd3f2d-0cc4-467c-8f06-c93b809e4697" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE62DB100\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e0847-d01e-009e-19e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "76bd3f2d-0cc4-467c-8f06-c93b809e4697" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblockc48550355ac2a6d/javablobstageblock1blockblobapiteststageblockc48954099918e", + "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" : "73a6dc8d-321d-4f01-9fb6-b06f803ee218", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE634CD3E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e087b-d01e-009e-48e5-644931000000", + "x-ms-client-request-id" : "73a6dc8d-321d-4f01-9fb6-b06f803ee218" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblockc48550355ac2a6d/javablobstageblock1blockblobapiteststageblockc48954099918e?blockid=MWYwNzEwZTktMTY1NS00MGIwLTk4MDgtM2QwZWU2ZTI5MGUx&comp=block", + "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" : "865ae431-a74e-402a-9e82-9d74151f89f0", + "Content-Type" : "application/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" : "b92e0929-d01e-009e-64e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "865ae431-a74e-402a-9e82-9d74151f89f0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2f79ffc3-de7d-484a-91ce-551f892640c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e0974-d01e-009e-29e5-644931000000", + "Body" : "jtcstageblockjtcstageblock0blockblobapiteststageblockc48550355ac2a6dFri, 06 Sep 2019 19:03:27 GMT\"0x8D732FCE62DB100\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "2f79ffc3-de7d-484a-91ce-551f892640c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblockc48550355ac2a6d?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" : "3b6e3237-8d58-4c95-a0e4-c73ac5ba22b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e09a9-d01e-009e-5be5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:26 GMT", + "x-ms-client-request-id" : "3b6e3237-8d58-4c95-a0e4-c73ac5ba22b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblock0blockblobapiteststageblockc48550355ac2a6d", "javablobstageblock1blockblobapiteststageblockc48954099918e", "javablobstageblock2blockblobapiteststageblockc480260027e09", "1f0710e9-1655-40b0-9808-3d0ee6e290e1" ] +} \ 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..23f93467ff2b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody014849b5c146e69fea47ceb?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" : "9a6cd9b3-6f90-400e-b87f-054561c810c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE787605E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4129fedf-c01e-00c5-16e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "9a6cd9b3-6f90-400e-b87f-054561c810c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody014849b5c146e69fea47ceb/javablobstageblockemptybody184906d2a48e5d439248d", + "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" : "49bad2cd-0f45-4e6c-b62b-82303c2ca59f", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE791C9E9\"", + "Content-Length" : "0", + "x-ms-request-id" : "4129ff09-c01e-00c5-39e5-644e4d000000", + "x-ms-client-request-id" : "49bad2cd-0f45-4e6c-b62b-82303c2ca59f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody014849b5c146e69fea47ceb/javablobstageblockemptybody184906d2a48e5d439248d?blockid=ODU0Mjc3ZWUtZmVhOC00NGRhLWIzNjQtNzc4ZDUyZmQ0MDgy&comp=block", + "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" : "537c0276-f84b-4900-8bb9-afaf087bbc0b", + "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" : "4129ff20-c01e-00c5-4fe5-644e4d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:4129ff20-c01e-00c5-4fe5-644e4d000000\nTime:2019-09-06T19:03:29.4871877ZContent-Length0", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "537c0276-f84b-4900-8bb9-afaf087bbc0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "24ef4d02-7a09-4f60-a122-abb56fca86a3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4129ff2d-c01e-00c5-5ce5-644e4d000000", + "Body" : "jtcstageblockemptybodyjtcstageblockemptybody014849b5c146e69fea47cebFri, 06 Sep 2019 19:03:29 GMT\"0x8D732FCE787605E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "24ef4d02-7a09-4f60-a122-abb56fca86a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody014849b5c146e69fea47ceb?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" : "debb4311-a8d8-42ec-83c0-557b7c09a5b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4129ff40-c01e-00c5-6ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "debb4311-a8d8-42ec-83c0-557b7c09a5b7" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockemptybody014849b5c146e69fea47ceb", "javablobstageblockemptybody184906d2a48e5d439248d", "javablobstageblockemptybody277878587b82cd5d22480", "854277ee-fea8-44da-b364-778d52fd4082" ] +} \ 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..17d3abb1c3f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerrora500644903?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" : "8714b1c6-32b4-4645-a2f6-ca41c2de5ca5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE8357D88\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a014b-c01e-00c5-45e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "8714b1c6-32b4-4645-a2f6-ca41c2de5ca5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerrora500644903/javablobstageblockerror147486fec2b256a5984a999", + "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" : "1a83327f-b21c-43ed-b32e-61944954ea19", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE83C3C28\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a016a-c01e-00c5-5ee5-644e4d000000", + "x-ms-client-request-id" : "1a83327f-b21c-43ed-b32e-61944954ea19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerrora500644903/javablobstageblockerror361920acd17ae64da1467a9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b5a0f842-66c9-4ce2-b423-a06c7e22b7cc", + "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" : "412a017c-c01e-00c5-6fe5-644e4d000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:412a017c-c01e-00c5-6fe5-644e4d000000\nTime:2019-09-06T19:03:30.5982329ZblockididNot a valid base64 string.", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "b5a0f842-66c9-4ce2-b423-a06c7e22b7cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "caeabc12-27ec-4e5e-b37d-0cd407f6d576" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a018c-c01e-00c5-7fe5-644e4d000000", + "Body" : "jtcstageblockerrorjtcstageblockerror0blockblobapiteststageblockerrora500644903Fri, 06 Sep 2019 19:03:30 GMT\"0x8D732FCE8357D88\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "caeabc12-27ec-4e5e-b37d-0cd407f6d576", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerrora500644903?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" : "18002b60-defc-4e3c-aefe-e7e1020ee5ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0199-c01e-00c5-0ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "18002b60-defc-4e3c-aefe-e7e1020ee5ee" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockerror0blockblobapiteststageblockerrora500644903", "javablobstageblockerror147486fec2b256a5984a999", "javablobstageblockerror215247aa99e722662b4c8ea", "javablobstageblockerror361920acd17ae64da1467a9" ] +} \ 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..cea79f2dd1fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json @@ -0,0 +1,208 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994?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" : "be85b319-5570-443d-93a4-d0bb9d3ea2aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE854579A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a01b0-c01e-00c5-1ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "be85b319-5570-443d-93a4-d0bb9d3ea2aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994/javablobstageblockfromurl12049206db689dbb2448b8", + "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" : "ec8465d2-c0ac-4b05-87cf-319735539501", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE85A79B2\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a01bb-c01e-00c5-24e5-644e4d000000", + "x-ms-client-request-id" : "ec8465d2-c0ac-4b05-87cf-319735539501" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "edbb3355-f202-4b16-9449-4e8c3ca80a1c", + "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" : "\"0x8D732FCE8604AE7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a01ca-c01e-00c5-31e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "edbb3355-f202-4b16-9449-4e8c3ca80a1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994/javablobstageblockfromurl363675ba098506bb6b454c?blockid=OTUxYWM3ZDQtYmQzNy00YWI3LTg2NjItNjIwMjI0ZDI3ODBh&comp=block", + "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" : "3ff128f4-6ee2-4b3f-8fc1-17c6bd276e97" + }, + "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" : "412a01e3-c01e-00c5-46e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "3ff128f4-6ee2-4b3f-8fc1-17c6bd276e97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994/javablobstageblockfromurl363675ba098506bb6b454c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eb5143e5-7d63-4857-a39b-86a1d1dbb0d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a021d-c01e-00c5-7be5-644e4d000000", + "Body" : "OTUxYWM3ZDQtYmQzNy00YWI3LTg2NjItNjIwMjI0ZDI3ODBh7", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "eb5143e5-7d63-4857-a39b-86a1d1dbb0d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994/javablobstageblockfromurl363675ba098506bb6b454c?comp=blocklist", + "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" : "a0684442-d5fd-492e-8376-a65cb2a4fe47", + "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" : "\"0x8D732FCE883DD7D\"", + "x-ms-content-crc64" : "q38yaSn0e04=", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0224-c01e-00c5-02e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "a0684442-d5fd-492e-8376-a65cb2a4fe47" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994/javablobstageblockfromurl363675ba098506bb6b454c", + "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" : "e8de1709-5883-46ac-9cce-9aca04e14200" + }, + "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" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FCE883DD7D\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a0246-c01e-00c5-21e5-644e4d000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "e8de1709-5883-46ac-9cce-9aca04e14200", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0f284917-0d1d-4943-80df-2cbf5b06543d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0255-c01e-00c5-2fe5-644e4d000000", + "Body" : "jtcstageblockfromurljtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994Fri, 06 Sep 2019 19:03:30 GMT\"0x8D732FCE8604AE7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "0f284917-0d1d-4943-80df-2cbf5b06543d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994?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" : "c5fb2e18-c7c3-444a-ac5f-202a5faa33a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0264-c01e-00c5-3de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "c5fb2e18-c7c3-444a-ac5f-202a5faa33a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurl0blockblobapiteststageblockfromurlf9f63994", "javablobstageblockfromurl12049206db689dbb2448b8", "javablobstageblockfromurl23858144463ac41b6e45c4", "javablobstageblockfromurl363675ba098506bb6b454c", "951ac7d4-bd37-4ab7-8662-620224d2780a" ] +} \ 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..f9d1447a5ba1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror0203522402aa5c7163449f?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" : "8172b8a7-ec4d-42a8-a62e-d822bbc5a06c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEBA7F8AF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0be3-c01e-00c5-08e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "8172b8a7-ec4d-42a8-a62e-d822bbc5a06c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror0203522402aa5c7163449f/javablobstageblockfromurlerror1394568a185d3a320c4", + "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" : "cfad6d38-bd21-4fc8-97da-08d39bbb42b5", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEBAF030F\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0bf8-c01e-00c5-1ae5-644e4d000000", + "x-ms-client-request-id" : "cfad6d38-bd21-4fc8-97da-08d39bbb42b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror30862048a1ae6a37e145b0/javablobstageblockfromurlerror4564747a62ddfe29c04?blockid=OTc4ZjYyNWMtMzJmMy00ZTA1LWEwZDgtYjcxOGU4ZDg2ZWU0&comp=block", + "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" : "bb69c7f7-c145-4274-8711-7d929f496734" + }, + "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" : "412a0c27-c01e-00c5-44e5-644e4d000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:412a0c27-c01e-00c5-44e5-644e4d000000\nTime:2019-09-06T19:03:36.4136910Z", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "bb69c7f7-c145-4274-8711-7d929f496734", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cfcc9c7d-9cda-46f0-8e6f-ef06749dfefc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0c63-c01e-00c5-7ae5-644e4d000000", + "Body" : "jtcstageblockfromurlerrorjtcstageblockfromurlerror0203522402aa5c7163449fFri, 06 Sep 2019 19:03:36 GMT\"0x8D732FCEBA7F8AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "cfcc9c7d-9cda-46f0-8e6f-ef06749dfefc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror0203522402aa5c7163449f?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" : "1dc18bc1-a191-4deb-9f3c-b8325c9ac56f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0c77-c01e-00c5-0ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "1dc18bc1-a191-4deb-9f3c-b8325c9ac56f" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlerror0203522402aa5c7163449f", "javablobstageblockfromurlerror1394568a185d3a320c4", "javablobstageblockfromurlerror2463349a2b3f59f3f14", "jtcstageblockfromurlerror30862048a1ae6a37e145b0", "javablobstageblockfromurlerror4564747a62ddfe29c04", "978f625c-32f3-4e05-a0d8-b718e8d86ee4" ] +} \ 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..3ba10aabd64c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0919986fe5ce7aab1441fbb?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" : "69414d4d-fb9c-4183-bd20-56455456ae46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE8C16458\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a02e3-c01e-00c5-25e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "69414d4d-fb9c-4183-bd20-56455456ae46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0919986fe5ce7aab1441fbb/javablobstageblockfromurlia17698846cedfde8ff444a", + "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" : "6ff59cb6-5094-4aa6-ac90-5acbd5446514", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE8C78638\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a02f4-c01e-00c5-32e5-644e4d000000", + "x-ms-client-request-id" : "6ff59cb6-5094-4aa6-ac90-5acbd5446514" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0919986fe5ce7aab1441fbb/javablobstageblockfromurlia17698846cedfde8ff444a?comp=block", + "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" : "edea7710-1c2b-4bef-8be1-31292633cfbf" + }, + "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" : "412a0315-c01e-00c5-4ee5-644e4d000000", + "Body" : "MissingRequiredQueryParameterA query parameter that's mandatory for this request is not specified.\nRequestId:412a0315-c01e-00c5-4ee5-644e4d000000\nTime:2019-09-06T19:03:31.5160933Zblockid", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "edea7710-1c2b-4bef-8be1-31292633cfbf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "412cadb0-3fd2-4ad8-b36b-23c43bf384d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0333-c01e-00c5-64e5-644e4d000000", + "Body" : "jtcstageblockfromurliajtcstageblockfromurlia0919986fe5ce7aab1441fbbFri, 06 Sep 2019 19:03:31 GMT\"0x8D732FCE8C16458\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "412cadb0-3fd2-4ad8-b36b-23c43bf384d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0919986fe5ce7aab1441fbb?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" : "2fd17820-fdcb-4254-938c-01ac8889af11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0345-c01e-00c5-76e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "2fd17820-fdcb-4254-938c-01ac8889af11" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlia0919986fe5ce7aab1441fbb", "javablobstageblockfromurlia17698846cedfde8ff444a", "javablobstageblockfromurlia213086e9fa253d201c4a4" ] +} \ 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..be8e9352ef3c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0554675a545d9b1e114374b?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" : "88597edc-2c3c-4815-ae01-ccd727337c1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE8DFC919\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a036b-c01e-00c5-12e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "88597edc-2c3c-4815-ae01-ccd727337c1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0554675a545d9b1e114374b/javablobstageblockfromurlia140334d0f079ab251642f", + "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" : "7c51f1f0-06dd-4a3b-bfda-c5f58f001949", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE8E6AE63\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0387-c01e-00c5-29e5-644e4d000000", + "x-ms-client-request-id" : "7c51f1f0-06dd-4a3b-bfda-c5f58f001949" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0554675a545d9b1e114374b/javablobstageblockfromurlia140334d0f079ab251642f?blockid=YmU1NGRkNDAtZmVjYy00MWQzLTk0NmQtNWM3ZWNlYzEyMTAw&comp=block", + "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" : "6660f5f3-a0bc-4c39-842e-329b45aa5a06" + }, + "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" : "412a03a3-c01e-00c5-43e5-644e4d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:412a03a3-c01e-00c5-43e5-644e4d000000\nTime:2019-09-06T19:03:31.7212847ZContent-Length0", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "6660f5f3-a0bc-4c39-842e-329b45aa5a06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3b16a2b2-f8c4-4829-b9be-587bbb6cc957" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a03ba-c01e-00c5-59e5-644e4d000000", + "Body" : "jtcstageblockfromurliajtcstageblockfromurlia0554675a545d9b1e114374bFri, 06 Sep 2019 19:03:31 GMT\"0x8D732FCE8DFC919\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "3b16a2b2-f8c4-4829-b9be-587bbb6cc957", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia0554675a545d9b1e114374b?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" : "c4d3387c-06d9-4de2-bc49-f30efca1d160" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a03cc-c01e-00c5-6ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "c4d3387c-06d9-4de2-bc49-f30efca1d160" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlia0554675a545d9b1e114374b", "javablobstageblockfromurlia140334d0f079ab251642f", "javablobstageblockfromurlia29116156d6d1f4983b459", "be54dd40-fecc-41d3-946d-5c7ecec12100" ] +} \ 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..311b1d16a0f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json @@ -0,0 +1,155 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease0591895c630ae6c72e44e5?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" : "9b3d9993-48cf-4f9d-93c5-a440cf6cf693" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE9B28E07\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0606-c01e-00c5-66e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "9b3d9993-48cf-4f9d-93c5-a440cf6cf693" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease0591895c630ae6c72e44e5/javablobstageblockfromurllease199600fed425591ccc4", + "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" : "be694330-0665-44e1-b8f0-a23207435699", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE9B972B6\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0624-c01e-00c5-80e5-644e4d000000", + "x-ms-client-request-id" : "be694330-0665-44e1-b8f0-a23207435699" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease0591895c630ae6c72e44e5?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4cded2d1-6fcc-4fdd-984c-0c44c126e792", + "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" : "\"0x8D732FCE9C364E8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0655-c01e-00c5-2ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "4cded2d1-6fcc-4fdd-984c-0c44c126e792" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease0591895c630ae6c72e44e5/javablobstageblockfromurllease199600fed425591ccc4?comp=lease", + "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" : "38fdd481-d364-4b67-b76a-914256d28f25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE9B972B6\"", + "x-ms-lease-id" : "ea332791-000a-419c-8e75-a2c80c6f81bb", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0669-c01e-00c5-3de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "38fdd481-d364-4b67-b76a-914256d28f25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease0591895c630ae6c72e44e5/javablobstageblockfromurllease199600fed425591ccc4?blockid=NDU2MjJmN2MtZTRjNC00MjQ3LWEzOTMtMDI5ODJmN2RkNTM0&comp=block", + "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" : "711dfd93-e1f0-475d-a296-6366f9902e1d" + }, + "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" : "412a068b-c01e-00c5-5ee5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "711dfd93-e1f0-475d-a296-6366f9902e1d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8cff6faf-eb14-47d4-a313-e74fae86b0d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a06b6-c01e-00c5-05e5-644e4d000000", + "Body" : "jtcstageblockfromurlleasejtcstageblockfromurllease0591895c630ae6c72e44e5Fri, 06 Sep 2019 19:03:33 GMT\"0x8D732FCE9C364E8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "8cff6faf-eb14-47d4-a313-e74fae86b0d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease0591895c630ae6c72e44e5?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" : "d134d017-cfdc-4092-af3a-dd8a7c532fc5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a06c5-c01e-00c5-14e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "d134d017-cfdc-4092-af3a-dd8a7c532fc5" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurllease0591895c630ae6c72e44e5", "javablobstageblockfromurllease199600fed425591ccc4", "javablobstageblockfromurllease274395d6a7844ce8654", "45622f7c-e4c4-4247-a393-02982f7dd534" ] +} \ 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..1f8cfc76bda6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail040485759a022c2bb944?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" : "4de2e778-f8a9-46d3-8a0e-14606551e39b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE9F301DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a06dc-c01e-00c5-2ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "4de2e778-f8a9-46d3-8a0e-14606551e39b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail040485759a022c2bb944/javablobstageblockfromurlleasefail184408cb37f3f2e65", + "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" : "c6d463ef-b46d-4757-9732-8f0b38e31a1e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEA03D3D7\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a071c-c01e-00c5-5fe5-644e4d000000", + "x-ms-client-request-id" : "c6d463ef-b46d-4757-9732-8f0b38e31a1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail040485759a022c2bb944?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c6724d41-6195-43c7-8715-20e43380faf7", + "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" : "\"0x8D732FCEA0AB859\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0731-c01e-00c5-71e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "c6724d41-6195-43c7-8715-20e43380faf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail040485759a022c2bb944/javablobstageblockfromurlleasefail184408cb37f3f2e65?blockid=ZDRiMzdmNDMtZGExOC00YzdkLTkzMDQtMGU4MWNlM2Q0OGU0&comp=block", + "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" : "9bea2241-971f-40c2-b1dd-9b86535d161a" + }, + "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" : "412a074e-c01e-00c5-0ce5-644e4d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:412a074e-c01e-00c5-0ce5-644e4d000000\nTime:2019-09-06T19:03:36.1364299Zx-ms-lease-idgarbage", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "9bea2241-971f-40c2-b1dd-9b86535d161a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aeb60440-9a1e-41c5-a5e7-95cb4390b572" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0bab-c01e-00c5-54e5-644e4d000000", + "Body" : "jtcstageblockfromurlleasefailjtcstageblockfromurlleasefail040485759a022c2bb944Fri, 06 Sep 2019 19:03:33 GMT\"0x8D732FCEA0AB859\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "aeb60440-9a1e-41c5-a5e7-95cb4390b572", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail040485759a022c2bb944?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" : "f67fab21-9c0f-4bcf-840d-6c6dd14bef64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0bce-c01e-00c5-74e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "f67fab21-9c0f-4bcf-840d-6c6dd14bef64" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlleasefail040485759a022c2bb944", "javablobstageblockfromurlleasefail184408cb37f3f2e65", "javablobstageblockfromurlleasefail257782ffad6f34930", "d4b37f43-da18-4c7d-9304-0e81ce3d48e4" ] +} \ 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..14d6466f63ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5002290ce1009bf7cb24a5fa?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" : "2a119be4-0b01-4ffe-9d13-e9ce3238b939" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE947F2AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a04c2-c01e-00c5-49e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "2a119be4-0b01-4ffe-9d13-e9ce3238b939" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5002290ce1009bf7cb24a5fa/javablobstageblockfromurlmd5113991aae59f4b1bc84b", + "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" : "d3ebae54-a01b-4029-bafd-64cb40f11e05", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE94E6276\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a04d8-c01e-00c5-5ce5-644e4d000000", + "x-ms-client-request-id" : "d3ebae54-a01b-4029-bafd-64cb40f11e05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5002290ce1009bf7cb24a5fa?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b7a87b8d-9cb9-4167-bc83-18915e3c17f4", + "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" : "\"0x8D732FCE954A9DC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a04e6-c01e-00c5-69e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "b7a87b8d-9cb9-4167-bc83-18915e3c17f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5002290ce1009bf7cb24a5fa/javablobstageblockfromurlmd537261535c1d6de7bfc40?blockid=OGEwODgxOGItYjk3Yi00NmViLTlhZWYtNGRhMDUyNWQ2MjA3&comp=block", + "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" : "06863058-fe5a-4ef2-93f5-358d06bfbc67" + }, + "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" : "412a04f6-c01e-00c5-75e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "06863058-fe5a-4ef2-93f5-358d06bfbc67", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9fc90c41-c942-4637-aba4-9e061d8ad5c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0513-c01e-00c5-10e5-644e4d000000", + "Body" : "jtcstageblockfromurlmd5jtcstageblockfromurlmd5002290ce1009bf7cb24a5faFri, 06 Sep 2019 19:03:32 GMT\"0x8D732FCE954A9DC\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "9fc90c41-c942-4637-aba4-9e061d8ad5c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5002290ce1009bf7cb24a5fa?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" : "aab867a3-7d22-4947-8226-db38f23cc4ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0522-c01e-00c5-1de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "aab867a3-7d22-4947-8226-db38f23cc4ac" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmd5002290ce1009bf7cb24a5fa", "javablobstageblockfromurlmd5113991aae59f4b1bc84b", "javablobstageblockfromurlmd52932715eff2b25a5db4b", "javablobstageblockfromurlmd537261535c1d6de7bfc40", "8a08818b-b97b-46eb-9aef-4da0525d6207" ] +} \ 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..976cbc69929d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail043255611528feb69442e?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" : "a1074b6f-074e-4b45-a5c2-2cf8068725a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE973A111\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0537-c01e-00c5-2fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "a1074b6f-074e-4b45-a5c2-2cf8068725a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail043255611528feb69442e/javablobstageblockfromurlmd5fail1024733301a2712125", + "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" : "96af65b1-db3a-412e-aae1-952ddc16b270", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE97A5EE4\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0549-c01e-00c5-3be5-644e4d000000", + "x-ms-client-request-id" : "96af65b1-db3a-412e-aae1-952ddc16b270" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail043255611528feb69442e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "55761850-9bce-41a3-aed8-e64d2c1db375", + "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" : "\"0x8D732FCE980F4A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0564-c01e-00c5-50e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "55761850-9bce-41a3-aed8-e64d2c1db375" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail043255611528feb69442e/javablobstageblockfromurlmd5fail355245892d63ba0f07?blockid=MGEzNzVmMTQtZDQ3Zi00NTFlLWE2YmItMDYyMTE0ZTgyMzhk&comp=block", + "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" : "c8558523-d2cb-4f06-9988-fb6e6a7a1696" + }, + "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" : "412a057e-c01e-00c5-69e5-644e4d000000", + "Body" : "InvalidMd5The MD5 value specified in the request is invalid. MD5 value must be 128 bits and base64 encoded.\nRequestId:412a057e-c01e-00c5-69e5-644e4d000000\nTime:2019-09-06T19:03:32.7822814Z", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "c8558523-d2cb-4f06-9988-fb6e6a7a1696", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b42b3568-81ea-44e6-bc18-67bd36b611ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a05d9-c01e-00c5-3ee5-644e4d000000", + "Body" : "jtcstageblockfromurlmd5failjtcstageblockfromurlmd5fail043255611528feb69442eFri, 06 Sep 2019 19:03:32 GMT\"0x8D732FCE980F4A2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "b42b3568-81ea-44e6-bc18-67bd36b611ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail043255611528feb69442e?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" : "87ff83c9-6593-4a00-ac03-6a5215585217" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a05ea-c01e-00c5-4de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:32 GMT", + "x-ms-client-request-id" : "87ff83c9-6593-4a00-ac03-6a5215585217" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmd5fail043255611528feb69442e", "javablobstageblockfromurlmd5fail1024733301a2712125", "javablobstageblockfromurlmd5fail242629c73202497342", "javablobstageblockfromurlmd5fail355245892d63ba0f07", "0a375f14-d47f-451e-a6bb-062114e8238d" ] +} \ 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..05f2cb76aa43 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin02319811a71db51daa40489?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" : "75e8fffa-4d8c-4b08-a067-225b590a60cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE89CBC99\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a027b-c01e-00c5-4fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "75e8fffa-4d8c-4b08-a067-225b590a60cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin02319811a71db51daa40489/javablobstageblockfromurlmin1304578445e398b9624c", + "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" : "51eb90cb-7f0d-4845-aa51-162f7d080a5e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE8A305A4\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a028e-c01e-00c5-61e5-644e4d000000", + "x-ms-client-request-id" : "51eb90cb-7f0d-4845-aa51-162f7d080a5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin02319811a71db51daa40489?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b182bced-872c-459b-b1e6-1109ae839149", + "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" : "\"0x8D732FCE8A861D9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a029d-c01e-00c5-6fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "b182bced-872c-459b-b1e6-1109ae839149" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin02319811a71db51daa40489/javablobstageblockfromurlmin3134842fd160c25fad48?blockid=ODY0MzE5YmUtYzQyMy00ZWIwLTkzZGUtMmM0YmRjNDcxOGI3&comp=block", + "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" : "d668c56e-f1d2-4b75-8e0c-96f8c9645ce4" + }, + "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" : "412a02aa-c01e-00c5-78e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "d668c56e-f1d2-4b75-8e0c-96f8c9645ce4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "930f1af4-1e47-46b2-b357-de2bc7ae18c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a02ba-c01e-00c5-06e5-644e4d000000", + "Body" : "jtcstageblockfromurlminjtcstageblockfromurlmin02319811a71db51daa40489Fri, 06 Sep 2019 19:03:31 GMT\"0x8D732FCE8A861D9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "930f1af4-1e47-46b2-b357-de2bc7ae18c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin02319811a71db51daa40489?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" : "655b185b-159e-47e9-90be-c2e70d02c677" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a02d2-c01e-00c5-19e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:30 GMT", + "x-ms-client-request-id" : "655b185b-159e-47e9-90be-c2e70d02c677" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmin02319811a71db51daa40489", "javablobstageblockfromurlmin1304578445e398b9624c", "javablobstageblockfromurlmin2169563f84c7d5d03e43", "javablobstageblockfromurlmin3134842fd160c25fad48", "864319be-c423-4eb0-93de-2c4bdc4718b7" ] +} \ 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..4fb695e60223 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange04431997a3febe07aa4826?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" : "841e2e17-1ee8-43da-97f1-775117500f60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE8FFDBD6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a03de-c01e-00c5-7ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "841e2e17-1ee8-43da-97f1-775117500f60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange04431997a3febe07aa4826/javablobstageblockfromurlrange1873545a907313578e4", + "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" : "3402f2e8-e6a8-4eff-bd94-da11ba4df07f", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE9064BDC\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a03f5-c01e-00c5-0fe5-644e4d000000", + "x-ms-client-request-id" : "3402f2e8-e6a8-4eff-bd94-da11ba4df07f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange04431997a3febe07aa4826?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5a51cf35-3b57-477e-9fb5-979a7b765ed7", + "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" : "\"0x8D732FCE90C44D5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a03ff-c01e-00c5-19e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "5a51cf35-3b57-477e-9fb5-979a7b765ed7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange04431997a3febe07aa4826/javablobstageblockfromurlrange38315086e0fed5c25b4?blockid=NWY3YzEzY2YtNDIwYS00MzVmLWI2N2ItMWZhY2MxMjg4MGNh&comp=block", + "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" : "ba1642a4-b398-47be-ae04-d4887e24ed83" + }, + "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" : "412a0416-c01e-00c5-2ee5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "ba1642a4-b398-47be-ae04-d4887e24ed83" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange04431997a3febe07aa4826/javablobstageblockfromurlrange38315086e0fed5c25b4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "055e9fb8-5442-4e48-9099-f77414d5cbfb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0461-c01e-00c5-73e5-644e4d000000", + "Body" : "NWY3YzEzY2YtNDIwYS00MzVmLWI2N2ItMWZhY2MxMjg4MGNh3", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "055e9fb8-5442-4e48-9099-f77414d5cbfb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e977c834-bd4f-44be-bf9c-3381790e3b72" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0473-c01e-00c5-04e5-644e4d000000", + "Body" : "jtcstageblockfromurlrangejtcstageblockfromurlrange04431997a3febe07aa4826Fri, 06 Sep 2019 19:03:31 GMT\"0x8D732FCE90C44D5\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "e977c834-bd4f-44be-bf9c-3381790e3b72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange04431997a3febe07aa4826?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" : "5ffe947b-33d4-4423-84fb-3a30fb107f57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a047f-c01e-00c5-0de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:31 GMT", + "x-ms-client-request-id" : "5ffe947b-33d4-4423-84fb-3a30fb107f57" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlrange04431997a3febe07aa4826", "javablobstageblockfromurlrange1873545a907313578e4", "javablobstageblockfromurlrange2310966d93443096554", "javablobstageblockfromurlrange38315086e0fed5c25b4", "5f7c13cf-420a-435f-b67b-1facc12880ca" ] +} \ 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..b8aef48416c3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac003097ed9064cdb40d49?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" : "432e7183-286d-4d89-869d-f59c28bb71f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEBD72A5A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0c8d-c01e-00c5-21e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "432e7183-286d-4d89-869d-f59c28bb71f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac003097ed9064cdb40d49/javablobstageblockfromurlsourceac1649586323c807c88c", + "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" : "8bc8a6a3-7700-4c76-ae30-a8804838720d", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEBDE0D7A\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0cad-c01e-00c5-3be5-644e4d000000", + "x-ms-client-request-id" : "8bc8a6a3-7700-4c76-ae30-a8804838720d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac003097ed9064cdb40d49?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "72033fef-361e-4b8f-8ab8-319c5c7e9f98", + "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" : "\"0x8D732FCEBE56943\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0ccb-c01e-00c5-54e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "x-ms-client-request-id" : "72033fef-361e-4b8f-8ab8-319c5c7e9f98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac003097ed9064cdb40d49/javablobstageblockfromurlsourceac315344089867c2df9d", + "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" : "a3b0a770-a375-45af-8e4f-7e691dff7d52", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEBEDEFCF\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0cdf-c01e-00c5-66e5-644e4d000000", + "x-ms-client-request-id" : "a3b0a770-a375-45af-8e4f-7e691dff7d52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac003097ed9064cdb40d49/javablobstageblockfromurlsourceac1649586323c807c88c?blockid=ZWRiNzkwNmQtODg5OS00YWU2LTgxMDctODFlMGYyODhmMDhj&comp=block", + "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" : "1c6cad4e-ad97-4c9a-b1c4-46650e98a5ad" + }, + "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" : "412a0cff-c01e-00c5-7ee5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "1c6cad4e-ad97-4c9a-b1c4-46650e98a5ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "289682d9-cdc9-434a-afc8-7e4f327cd675" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0d27-c01e-00c5-26e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac003097ed9064cdb40d49Fri, 06 Sep 2019 19:03:36 GMT\"0x8D732FCEBE56943\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "289682d9-cdc9-434a-afc8-7e4f327cd675", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac003097ed9064cdb40d49?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" : "121d963f-ca97-4c6e-8e2c-d7bda8006519" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0d3f-c01e-00c5-3de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "121d963f-ca97-4c6e-8e2c-d7bda8006519" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac003097ed9064cdb40d49", "javablobstageblockfromurlsourceac1649586323c807c88c", "javablobstageblockfromurlsourceac239216a2a518ad8ede", "edb7906d-8899-4ae6-8107-81e0f288f08c", "javablobstageblockfromurlsourceac315344089867c2df9d" ] +} \ 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..b0129c3daf2e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac06897242623bf1e71f49?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" : "a26c612f-4994-43a2-951e-2fde8831f0e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEC135774\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0d51-c01e-00c5-4ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "a26c612f-4994-43a2-951e-2fde8831f0e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac06897242623bf1e71f49/javablobstageblockfromurlsourceac1304660e2a8431bd1b", + "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" : "d86fe089-510d-46af-b19a-323e0471cf55", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEC19EC4E\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0d5c-c01e-00c5-55e5-644e4d000000", + "x-ms-client-request-id" : "d86fe089-510d-46af-b19a-323e0471cf55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac06897242623bf1e71f49?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8ab0821e-ba66-4f57-a759-e8d920d3c401", + "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" : "\"0x8D732FCEC200F70\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0d73-c01e-00c5-69e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "8ab0821e-ba66-4f57-a759-e8d920d3c401" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac06897242623bf1e71f49/javablobstageblockfromurlsourceac36506031479cf98b4a", + "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" : "a7367385-edad-468d-80a1-73ca347a3c4e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEC269988\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0d81-c01e-00c5-76e5-644e4d000000", + "x-ms-client-request-id" : "a7367385-edad-468d-80a1-73ca347a3c4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac06897242623bf1e71f49/javablobstageblockfromurlsourceac1304660e2a8431bd1b?blockid=N2I4ZGIyYWMtOTA3NS00MmE0LWEyYjEtYjhhYzU2ZjViOWNj&comp=block", + "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" : "f1a3fa66-0720-45e4-9653-5d97558de8fd" + }, + "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" : "412a0d8f-c01e-00c5-01e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "f1a3fa66-0720-45e4-9653-5d97558de8fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "73c7e44f-6d5b-4171-a625-4e208a167b32" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0dcb-c01e-00c5-32e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac06897242623bf1e71f49Fri, 06 Sep 2019 19:03:37 GMT\"0x8D732FCEC200F70\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "73c7e44f-6d5b-4171-a625-4e208a167b32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac06897242623bf1e71f49?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" : "9bf50fc4-7e77-4c99-9528-59aa9cc8a3e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0dde-c01e-00c5-44e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "9bf50fc4-7e77-4c99-9528-59aa9cc8a3e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac06897242623bf1e71f49", "javablobstageblockfromurlsourceac1304660e2a8431bd1b", "javablobstageblockfromurlsourceac235376d2c7ec68a8d3", "7b8db2ac-9075-42a4-a2b1-b8ac56f5b9cc", "javablobstageblockfromurlsourceac36506031479cf98b4a" ] +} \ 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..f82e403b677a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac096635e4bf9c11c01648?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" : "bf0ec94f-702a-4e8a-bfa8-88ca9500cf0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEC537D2B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0dfb-c01e-00c5-59e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "bf0ec94f-702a-4e8a-bfa8-88ca9500cf0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac096635e4bf9c11c01648/javablobstageblockfromurlsourceac1791916372db650288", + "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" : "a17070e6-8631-442c-add0-055d89825a50", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEC649BBB\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0e2d-c01e-00c5-7be5-644e4d000000", + "x-ms-client-request-id" : "a17070e6-8631-442c-add0-055d89825a50" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac096635e4bf9c11c01648?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "46757c15-f9b2-4326-b2e2-8c19251af2cd", + "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" : "\"0x8D732FCEC6B0D43\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0e4f-c01e-00c5-13e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "46757c15-f9b2-4326-b2e2-8c19251af2cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac096635e4bf9c11c01648/javablobstageblockfromurlsourceac310889933c07615410", + "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" : "3582686c-e88f-4084-a5f0-cb5e4a5cd35d", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEC71700A\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0e65-c01e-00c5-24e5-644e4d000000", + "x-ms-client-request-id" : "3582686c-e88f-4084-a5f0-cb5e4a5cd35d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac096635e4bf9c11c01648/javablobstageblockfromurlsourceac1791916372db650288?blockid=NWRiYjQ4ZjItMjMxNC00NmExLTkwMmMtMGE0OWViNmY3ODhh&comp=block", + "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" : "4ec05c8f-231d-4d8b-8ae5-90f35269faaf" + }, + "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" : "412a0e7c-c01e-00c5-32e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "4ec05c8f-231d-4d8b-8ae5-90f35269faaf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eaec5d32-8a9c-478a-b0f2-fbc4b8dc75cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0e95-c01e-00c5-45e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac096635e4bf9c11c01648Fri, 06 Sep 2019 19:03:37 GMT\"0x8D732FCEC6B0D43\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "eaec5d32-8a9c-478a-b0f2-fbc4b8dc75cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac096635e4bf9c11c01648?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" : "72751e25-4745-41cc-be12-de2062c9befb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0ea6-c01e-00c5-50e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:36 GMT", + "x-ms-client-request-id" : "72751e25-4745-41cc-be12-de2062c9befb" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac096635e4bf9c11c01648", "javablobstageblockfromurlsourceac1791916372db650288", "javablobstageblockfromurlsourceac21987025331f257fa1", "5dbb48f2-2314-46a1-902c-0a49eb6f788a", "javablobstageblockfromurlsourceac310889933c07615410" ] +} \ 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..f2fb7784fe32 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745?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" : "4e5215c6-638d-4bcb-b202-82303948030b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEC926A12\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0ec8-c01e-00c5-6ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "4e5215c6-638d-4bcb-b202-82303948030b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745/javablobstageblockfromurlsourceac160739a16d2ec75fd2", + "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" : "6bb7afe1-dafb-4492-8465-6f8c9ea21c3d", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEC99C21D\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0edf-c01e-00c5-79e5-644e4d000000", + "x-ms-client-request-id" : "6bb7afe1-dafb-4492-8465-6f8c9ea21c3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "750b541d-3a5f-4401-abfc-b7e59e1fc2ed", + "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" : "\"0x8D732FCECA00CB5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0ef7-c01e-00c5-09e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "750b541d-3a5f-4401-abfc-b7e59e1fc2ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745/javablobstageblockfromurlsourceac339283129d654dc417", + "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" : "e8e822cd-d3bd-4e78-88fe-abb79ef39dfa", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCECA70BB7\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0f16-c01e-00c5-23e5-644e4d000000", + "x-ms-client-request-id" : "e8e822cd-d3bd-4e78-88fe-abb79ef39dfa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745/javablobstageblockfromurlsourceac339283129d654dc417", + "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" : "12d1e912-3734-482b-825f-2c80c1537f29" + }, + "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" : "Fri, 06 Sep 2019 19:03:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCECA70BB7\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:37 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a0f27-c01e-00c5-32e5-644e4d000000", + "x-ms-client-request-id" : "12d1e912-3734-482b-825f-2c80c1537f29", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745/javablobstageblockfromurlsourceac160739a16d2ec75fd2?blockid=YTYxMWFjZGItMjgzNS00ZDc3LWI1NWQtNzMwYjBmNTI2YWQ5&comp=block", + "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" : "3c1b88ac-2af1-4c33-b70c-4e5cb0e02522" + }, + "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" : "412a0f3e-c01e-00c5-41e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "3c1b88ac-2af1-4c33-b70c-4e5cb0e02522" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e189dfc-4b80-4e9e-b9fb-9f249aca6bf4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0fa9-c01e-00c5-15e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac036881a9b0c8dd41e745Fri, 06 Sep 2019 19:03:37 GMT\"0x8D732FCECA00CB5\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "3e189dfc-4b80-4e9e-b9fb-9f249aca6bf4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac036881a9b0c8dd41e745?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" : "e406c370-f7d9-4635-9a01-80c58dea8b1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0fb6-c01e-00c5-1ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "e406c370-f7d9-4635-9a01-80c58dea8b1b" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac036881a9b0c8dd41e745", "javablobstageblockfromurlsourceac160739a16d2ec75fd2", "javablobstageblockfromurlsourceac230447a4a19a000c5e", "a611acdb-2835-4d77-b55d-730b0f526ad9", "javablobstageblockfromurlsourceac339283129d654dc417" ] +} \ 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..5d5285f7c98e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac083300438c22a880c645?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" : "79b98846-dcaf-4f76-baa4-94bb31821c5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCECDF15E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0fda-c01e-00c5-39e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "79b98846-dcaf-4f76-baa4-94bb31821c5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac083300438c22a880c645/javablobstageblockfromurlsourceac135731810994afd9cb", + "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" : "fe4631c5-1f24-4168-8f20-64ae9dcabffc", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCECE5AA32\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0fed-c01e-00c5-46e5-644e4d000000", + "x-ms-client-request-id" : "fe4631c5-1f24-4168-8f20-64ae9dcabffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac083300438c22a880c645?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "78c84f09-12de-4532-92d2-2187b5872532", + "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" : "\"0x8D732FCECEB7FB7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1000-c01e-00c5-55e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "78c84f09-12de-4532-92d2-2187b5872532" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac083300438c22a880c645/javablobstageblockfromurlsourceac389399e57f867a4ad4", + "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" : "e30fe07b-beec-43c4-8140-bd1d30e101e0", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCECF193F4\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a100f-c01e-00c5-62e5-644e4d000000", + "x-ms-client-request-id" : "e30fe07b-beec-43c4-8140-bd1d30e101e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac083300438c22a880c645/javablobstageblockfromurlsourceac135731810994afd9cb?blockid=YzE5NjVlYmYtYmQ3Ny00MTU1LWJhNjctNjhlMGZhZTlkYmIy&comp=block", + "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" : "c6fbe077-b5d7-4d80-abc6-1374258ca496" + }, + "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" : "412a1020-c01e-00c5-71e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "c6fbe077-b5d7-4d80-abc6-1374258ca496" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "28a46f6f-414a-4be6-adc7-e08df9b1ffc3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1036-c01e-00c5-03e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac083300438c22a880c645Fri, 06 Sep 2019 19:03:38 GMT\"0x8D732FCECEB7FB7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "28a46f6f-414a-4be6-adc7-e08df9b1ffc3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac083300438c22a880c645?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" : "31835326-eae8-41b6-82b7-d620a19f486a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1051-c01e-00c5-16e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "31835326-eae8-41b6-82b7-d620a19f486a" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac083300438c22a880c645", "javablobstageblockfromurlsourceac135731810994afd9cb", "javablobstageblockfromurlsourceac2201594ed4556146fb", "c1965ebf-bd77-4155-ba67-68e0fae9dbb2", "javablobstageblockfromurlsourceac389399e57f867a4ad4" ] +} \ 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..12bc81616eca --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail03085872e9a4dd3398?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" : "0d94bddb-5e4c-41b5-96fa-e3810e41f83a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCED11CADF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1068-c01e-00c5-2ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "0d94bddb-5e4c-41b5-96fa-e3810e41f83a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail03085872e9a4dd3398/javablobstageblockfromurlsourceacfail1968929e4ec2fbfb", + "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" : "009d6148-5193-4bb6-8676-93c0fb38122b", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCED18D446\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1079-c01e-00c5-36e5-644e4d000000", + "x-ms-client-request-id" : "009d6148-5193-4bb6-8676-93c0fb38122b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail03085872e9a4dd3398?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c01089f8-5a44-4c07-894b-fb5dc54de25d", + "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" : "\"0x8D732FCED1FBBAF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a108b-c01e-00c5-43e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:37 GMT", + "x-ms-client-request-id" : "c01089f8-5a44-4c07-894b-fb5dc54de25d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail03085872e9a4dd3398/javablobstageblockfromurlsourceacfail36498260971510d3", + "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" : "432fb525-df6b-4276-a975-b3ba10615a0e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCED27F314\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a10a4-c01e-00c5-56e5-644e4d000000", + "x-ms-client-request-id" : "432fb525-df6b-4276-a975-b3ba10615a0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail03085872e9a4dd3398/javablobstageblockfromurlsourceacfail1968929e4ec2fbfb?blockid=ZjQxM2IzOTEtNzA3YS00M2I1LTlkZjUtNzZlMGM2ODMxNjUw&comp=block", + "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" : "f5533bea-02f5-40cb-bc48-ba62a00053ce" + }, + "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" : "412a10d3-c01e-00c5-7ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "f5533bea-02f5-40cb-bc48-ba62a00053ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "77bab654-7df2-41ad-8674-87c47322d2d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a10ed-c01e-00c5-15e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail03085872e9a4dd3398Fri, 06 Sep 2019 19:03:38 GMT\"0x8D732FCED1FBBAF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "77bab654-7df2-41ad-8674-87c47322d2d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail03085872e9a4dd3398?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" : "eadcc965-14e7-4814-970b-453c9a158a96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1103-c01e-00c5-26e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "eadcc965-14e7-4814-970b-453c9a158a96" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail03085872e9a4dd3398", "javablobstageblockfromurlsourceacfail1968929e4ec2fbfb", "javablobstageblockfromurlsourceacfail26626839fdbe024d", "f413b391-707a-43b5-9df5-76e0c6831650", "javablobstageblockfromurlsourceacfail36498260971510d3" ] +} \ 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..752d3283ca7d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail088727dbf92715886f?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" : "79f467bc-32e7-4ba1-bfcd-1aa8b3a8e0e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCED47B4E4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1112-c01e-00c5-32e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "79f467bc-32e7-4ba1-bfcd-1aa8b3a8e0e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail088727dbf92715886f/javablobstageblockfromurlsourceacfail1222059a050be748", + "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" : "44aedaca-6718-4e21-806a-4495d2293d0e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCED4F81AC\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1131-c01e-00c5-48e5-644e4d000000", + "x-ms-client-request-id" : "44aedaca-6718-4e21-806a-4495d2293d0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail088727dbf92715886f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0ca0c487-096c-4187-aaf2-947862b1d253", + "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" : "\"0x8D732FCED55CCE4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a1143-c01e-00c5-57e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "0ca0c487-096c-4187-aaf2-947862b1d253" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail088727dbf92715886f/javablobstageblockfromurlsourceacfail3042596f363ddb52", + "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" : "088be19b-09ce-4f8f-a718-4b6f0eef9b83", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCED5BE0A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1158-c01e-00c5-65e5-644e4d000000", + "x-ms-client-request-id" : "088be19b-09ce-4f8f-a718-4b6f0eef9b83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail088727dbf92715886f/javablobstageblockfromurlsourceacfail1222059a050be748?blockid=MWJiMjFkMTctOGRlYS00MGU4LWFhYmItYzE1ODgzZGUxODdl&comp=block", + "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" : "89318ba0-b373-4439-b25c-5a0ea7224b0d" + }, + "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" : "412a1177-c01e-00c5-01e5-644e4d000000", + "Body" : "CannotVerifyCopySourceThe condition specified using HTTP conditional header(s) is not met.\nRequestId:412a1177-c01e-00c5-01e5-644e4d000000\nTime:2019-09-06T19:03:39.2203308Z", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "89318ba0-b373-4439-b25c-5a0ea7224b0d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e34935a6-3d8e-47ba-981c-7d4a1dd0a098" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a119b-c01e-00c5-1ce5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail088727dbf92715886fFri, 06 Sep 2019 19:03:39 GMT\"0x8D732FCED55CCE4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "e34935a6-3d8e-47ba-981c-7d4a1dd0a098", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail088727dbf92715886f?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" : "d04ee6a3-9c19-4052-8b6c-c88c5b024145" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a11ae-c01e-00c5-2ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "d04ee6a3-9c19-4052-8b6c-c88c5b024145" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail088727dbf92715886f", "javablobstageblockfromurlsourceacfail1222059a050be748", "javablobstageblockfromurlsourceacfail297723fa9b342f89", "1bb21d17-8dea-40e8-aabb-c15883de187e", "javablobstageblockfromurlsourceacfail3042596f363ddb52" ] +} \ 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..c90336b79083 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail095760b5e3792d3dd5?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" : "235f390b-6da4-43c4-92b7-c0bac887b33b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCED7B5461\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a11d3-c01e-00c5-49e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "235f390b-6da4-43c4-92b7-c0bac887b33b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail095760b5e3792d3dd5/javablobstageblockfromurlsourceacfail19635960734c7754", + "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" : "f29f4ac2-5211-4e9a-adb4-49f9db2f88a1", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCED81E83F\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a11e7-c01e-00c5-59e5-644e4d000000", + "x-ms-client-request-id" : "f29f4ac2-5211-4e9a-adb4-49f9db2f88a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail095760b5e3792d3dd5?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b2084a29-8729-4789-ab89-cfdc17a9bdf3", + "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" : "\"0x8D732FCED872202\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a11fa-c01e-00c5-67e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "b2084a29-8729-4789-ab89-cfdc17a9bdf3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail095760b5e3792d3dd5/javablobstageblockfromurlsourceacfail314563f002977291", + "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" : "93cbcf9e-f4bb-4cba-be5b-4113a3d9f2fb", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCED8CC04E\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a1206-c01e-00c5-72e5-644e4d000000", + "x-ms-client-request-id" : "93cbcf9e-f4bb-4cba-be5b-4113a3d9f2fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail095760b5e3792d3dd5/javablobstageblockfromurlsourceacfail19635960734c7754?blockid=ZDVjNGY2MjAtMjFmNS00ZTM3LTk5OGMtNmZkODRiYjIyYWQ0&comp=block", + "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" : "701a3578-1ef4-4f26-b318-0f3ce98360d3" + }, + "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" : "412a121a-c01e-00c5-02e5-644e4d000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:412a121a-c01e-00c5-02e5-644e4d000000\nTime:2019-09-06T19:03:39.5206109Z", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "701a3578-1ef4-4f26-b318-0f3ce98360d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "03f29d35-96cf-48d6-bcaf-24fd50003558" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a122a-c01e-00c5-10e5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail095760b5e3792d3dd5Fri, 06 Sep 2019 19:03:39 GMT\"0x8D732FCED872202\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "03f29d35-96cf-48d6-bcaf-24fd50003558", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail095760b5e3792d3dd5?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" : "70bf46b7-4ed7-4b8d-b232-6fd0f2f81df7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1243-c01e-00c5-27e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "70bf46b7-4ed7-4b8d-b232-6fd0f2f81df7" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail095760b5e3792d3dd5", "javablobstageblockfromurlsourceacfail19635960734c7754", "javablobstageblockfromurlsourceacfail2796137dd3f101ba", "d5c4f620-21f5-4e37-998c-6fd84bb22ad4", "javablobstageblockfromurlsourceacfail314563f002977291" ] +} \ 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..e19ad4ec3b15 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48?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" : "897bc57c-be62-4641-bb2e-632a3de81d30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCEDA79F14\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a1268-c01e-00c5-3fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "897bc57c-be62-4641-bb2e-632a3de81d30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48/javablobstageblockfromurlsourceacfail1347934995c1acbb", + "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" : "fa899916-fb24-426e-84b8-11ecd7aff147", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEDADBD96\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a127d-c01e-00c5-4ee5-644e4d000000", + "x-ms-client-request-id" : "fa899916-fb24-426e-84b8-11ecd7aff147" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c5fee90-9c51-4bc2-add6-a5e22e094878", + "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" : "\"0x8D732FCEDB40940\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a128c-c01e-00c5-5ae5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "x-ms-client-request-id" : "1c5fee90-9c51-4bc2-add6-a5e22e094878" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48/javablobstageblockfromurlsourceacfail30096475e3109dc6", + "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" : "014ba6da-9f40-457c-b994-e565db42c11e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCEDBBA39A\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a12a9-c01e-00c5-70e5-644e4d000000", + "x-ms-client-request-id" : "014ba6da-9f40-457c-b994-e565db42c11e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48/javablobstageblockfromurlsourceacfail30096475e3109dc6", + "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" : "5ea1b016-5bec-4e90-8e6a-7e4c2a01a4ea" + }, + "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" : "Fri, 06 Sep 2019 19:03:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCEDBBA39A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:39 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a12bf-c01e-00c5-7fe5-644e4d000000", + "x-ms-client-request-id" : "5ea1b016-5bec-4e90-8e6a-7e4c2a01a4ea", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48/javablobstageblockfromurlsourceacfail1347934995c1acbb?blockid=ZTViM2I0ODQtZTljZC00MDM5LWFmZDAtYTM2M2VjOTBkNjFk&comp=block", + "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" : "33e2cbed-b31c-4531-ac4c-9faeaedb19bb" + }, + "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" : "412a12cb-c01e-00c5-08e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "33e2cbed-b31c-4531-ac4c-9faeaedb19bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "75b80cd0-fbc2-4573-b425-886e0f0870af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a12e7-c01e-00c5-1fe5-644e4d000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail02347443c4af48fd48Fri, 06 Sep 2019 19:03:39 GMT\"0x8D732FCEDB40940\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "75b80cd0-fbc2-4573-b425-886e0f0870af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail02347443c4af48fd48?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" : "2bf92494-d93e-4cfc-bfe7-81704378f2f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a1321-c01e-00c5-4ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:39 GMT", + "x-ms-client-request-id" : "2bf92494-d93e-4cfc-bfe7-81704378f2f1" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail02347443c4af48fd48", "javablobstageblockfromurlsourceacfail1347934995c1acbb", "javablobstageblockfromurlsourceacfail227987e7961478af", "e5b3b484-e9cd-4039-afd0-a363ec90d61d", "javablobstageblockfromurlsourceacfail30096475e3109dc6" ] +} \ 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..c7da5a472700 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments005167e2607be0ace54b?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" : "5b8e5b16-4629-46f0-b1e4-ed9be5a38656" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE6AF33C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e0c1f-d01e-009e-15e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "5b8e5b16-4629-46f0-b1e4-ed9be5a38656" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments005167e2607be0ace54b/javablobstageblockillegalarguments17251375b9d00f3c2", + "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" : "dac9617e-4523-43c7-8a4f-ead46cf2c2be", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE6C68174\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0d00-d01e-009e-65e5-644931000000", + "x-ms-client-request-id" : "dac9617e-4523-43c7-8a4f-ead46cf2c2be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments005167e2607be0ace54b/javablobstageblockillegalarguments17251375b9d00f3c2?comp=block", + "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" : "ae1d666a-42ae-418c-8a82-4d2d87954f92", + "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" : "b92e0d40-d01e-009e-1ce5-644931000000", + "Body" : "MissingRequiredQueryParameterA query parameter that's mandatory for this request is not specified.\nRequestId:b92e0d40-d01e-009e-1ce5-644931000000\nTime:2019-09-06T19:03:28.1515373Zblockid", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "ae1d666a-42ae-418c-8a82-4d2d87954f92", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "efd94660-af9c-45dd-a343-914b39184341" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e0d72-d01e-009e-4ae5-644931000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments005167e2607be0ace54bFri, 06 Sep 2019 19:03:27 GMT\"0x8D732FCE6AF33C6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "efd94660-af9c-45dd-a343-914b39184341", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments005167e2607be0ace54b?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" : "8eb74504-0acd-4717-bb43-1101e7be6805" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e0da5-d01e-009e-76e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "8eb74504-0acd-4717-bb43-1101e7be6805" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments005167e2607be0ace54b", "javablobstageblockillegalarguments17251375b9d00f3c2", "javablobstageblockillegalarguments227884188364d09ee" ] +} \ 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..d47d2db26892 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments086497fb2cac1858e54b?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" : "9d7902fe-cf11-456f-ba91-9912bc514ebb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE6E2ABAA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e0dec-d01e-009e-39e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "9d7902fe-cf11-456f-ba91-9912bc514ebb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments086497fb2cac1858e54b/javablobstageblockillegalarguments186388db0ba9b6220", + "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" : "888fe711-5da6-4c64-a0ae-73e6971da0bf", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE6EADAF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0e24-d01e-009e-6de5-644931000000", + "x-ms-client-request-id" : "888fe711-5da6-4c64-a0ae-73e6971da0bf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a35d0212-c7db-42c0-87bc-c476581f1fd4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e0e59-d01e-009e-1ce5-644931000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments086497fb2cac1858e54bFri, 06 Sep 2019 19:03:28 GMT\"0x8D732FCE6E2ABAA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "a35d0212-c7db-42c0-87bc-c476581f1fd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments086497fb2cac1858e54b?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" : "8c1a6470-c180-4190-a1a4-43e3f62c60fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e0e85-d01e-009e-45e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "8c1a6470-c180-4190-a1a4-43e3f62c60fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments086497fb2cac1858e54b", "javablobstageblockillegalarguments186388db0ba9b6220", "javablobstageblockillegalarguments254610649a1891cb2", "811c4a31-761f-4cbb-b9c9-3d07ea4f04bc" ] +} \ 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..13017dafa285 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments072603af94e5a9bb234b?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" : "78f92cdf-e536-444c-81d5-35f6978408b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE704BA62\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e0eda-d01e-009e-14e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "78f92cdf-e536-444c-81d5-35f6978408b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments072603af94e5a9bb234b/javablobstageblockillegalarguments1038241721eaa1640", + "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" : "26d689ed-ca0b-4148-9995-ff96985ca140", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE7163B03\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0f57-d01e-009e-03e5-644931000000", + "x-ms-client-request-id" : "26d689ed-ca0b-4148-9995-ff96985ca140" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments072603af94e5a9bb234b/javablobstageblockillegalarguments1038241721eaa1640?blockid=YzRlNDMyMjQtMmJjYi00NTJjLTgyMmMtMDUyNTAxNjU1Yjg4&comp=block", + "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" : "7b05c733-34fb-426f-8af7-5760895cc1a9", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2e7a775f-4201-4d83-bb78-259cd3150765" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "827773bf-d01e-0130-21e5-642c09000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments072603af94e5a9bb234bFri, 06 Sep 2019 19:03:28 GMT\"0x8D732FCE704BA62\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "2e7a775f-4201-4d83-bb78-259cd3150765", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments072603af94e5a9bb234b?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" : "29ffbfe4-72f9-4ce6-ac94-feb582f6520e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "827773c2-d01e-0130-23e5-642c09000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "29ffbfe4-72f9-4ce6-ac94-feb582f6520e" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments072603af94e5a9bb234b", "javablobstageblockillegalarguments1038241721eaa1640", "javablobstageblockillegalarguments24572351f86147c84", "c4e43224-2bcb-452c-822c-052501655b88" ] +} \ 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..62b63c97b9ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0121187145a9aa125c40?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" : "12ae3859-7de0-4489-816e-ed33e9f9e886" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE7477262\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "827773cd-d01e-0130-2de5-642c09000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "12ae3859-7de0-4489-816e-ed33e9f9e886" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0121187145a9aa125c40/javablobstageblockillegalarguments185987137827aa28a", + "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" : "f02078c1-0b66-4a22-9a36-8fd1a0d43f03", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE7532B73\"", + "Content-Length" : "0", + "x-ms-request-id" : "827773fd-d01e-0130-52e5-642c09000000", + "x-ms-client-request-id" : "f02078c1-0b66-4a22-9a36-8fd1a0d43f03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0121187145a9aa125c40/javablobstageblockillegalarguments185987137827aa28a?blockid=Nzg3YTY1MjMtZmY0Mi00MzY5LWJmYTktOTk2ZTcwNjNkYTkw&comp=block", + "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" : "a44dfbe7-d398-4873-80c8-c0b64b136a95", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f1d0349-11d8-4bb2-a869-eb9b48801946" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4129fe97-c01e-00c5-5ce5-644e4d000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments0121187145a9aa125c40Fri, 06 Sep 2019 19:03:28 GMT\"0x8D732FCE7477262\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "8f1d0349-11d8-4bb2-a869-eb9b48801946", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0121187145a9aa125c40?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" : "ae8773ec-0281-4faf-92a2-20ed28bcc666" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4129feb3-c01e-00c5-71e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "ae8773ec-0281-4faf-92a2-20ed28bcc666" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments0121187145a9aa125c40", "javablobstageblockillegalarguments185987137827aa28a", "javablobstageblockillegalarguments270399213a740a5f0", "787a6523-ff42-4369-bfa9-996e7063da90" ] +} \ 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..22eb4d5f3d02 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease0f1106859d?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" : "1801dbc4-3955-41bc-ac65-43ec226cd448" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE7D87A14\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0003-c01e-00c5-18e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "1801dbc4-3955-41bc-ac65-43ec226cd448" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease0f1106859d/javablobstageblocklease14244084ca30879fba407fa", + "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" : "d842c9f8-5e13-4c5c-8194-b42dd0ea83e2", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE7DF11E8\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a0016-c01e-00c5-2ae5-644e4d000000", + "x-ms-client-request-id" : "d842c9f8-5e13-4c5c-8194-b42dd0ea83e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease0f1106859d/javablobstageblocklease14244084ca30879fba407fa?comp=lease", + "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" : "ee188202-b055-408a-95ae-d19a1eb6ec28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE7DF11E8\"", + "x-ms-lease-id" : "07ff92ff-160a-4fb0-b04e-a66743c20729", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0030-c01e-00c5-40e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "ee188202-b055-408a-95ae-d19a1eb6ec28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease0f1106859d/javablobstageblocklease14244084ca30879fba407fa?blockid=MGQ5ZWVlM2ItZGNmMC00ODM0LWFkYTgtZmMwYjEzNGE3Nzlj&comp=block", + "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" : "dfb335c1-4ce4-4ad5-be7b-4afb926813e7", + "Content-Type" : "application/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" : "412a009c-c01e-00c5-24e5-644e4d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "dfb335c1-4ce4-4ad5-be7b-4afb926813e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eee15022-115f-46f6-a473-fc068dae5b3a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a00b7-c01e-00c5-3ee5-644e4d000000", + "Body" : "jtcstageblockleasejtcstageblocklease0blockblobapiteststageblocklease0f1106859dFri, 06 Sep 2019 19:03:29 GMT\"0x8D732FCE7D87A14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "eee15022-115f-46f6-a473-fc068dae5b3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease0f1106859d?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" : "61dddb35-a96b-4e68-b399-855739e1701d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a00c7-c01e-00c5-4ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "61dddb35-a96b-4e68-b399-855739e1701d" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblocklease0blockblobapiteststageblocklease0f1106859d", "javablobstageblocklease14244084ca30879fba407fa", "javablobstageblocklease2892941168bad251f0431eb", "0d9eee3b-dcf0-4834-ada8-fc0b134a779c" ] +} \ 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..5b9af0492621 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail0934845c052a32167841c69?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" : "4906483a-caab-4102-af9a-c15b67f49bc6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE80F9CE8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a00da-c01e-00c5-5ee5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "4906483a-caab-4102-af9a-c15b67f49bc6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail0934845c052a32167841c69/javablobstageblockleasefail170839a604c4a1e181414", + "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" : "2576cd9a-b18d-4d22-9702-5d5fa881538a", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE8160D77\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a00ea-c01e-00c5-6ce5-644e4d000000", + "x-ms-client-request-id" : "2576cd9a-b18d-4d22-9702-5d5fa881538a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail0934845c052a32167841c69/javablobstageblockleasefail170839a604c4a1e181414?comp=lease", + "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" : "32162d06-a1c8-4c4e-86e6-01c0100eced9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE8160D77\"", + "x-ms-lease-id" : "75929e68-411f-4cc3-b6d5-5e6b68c00707", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a0100-c01e-00c5-7fe5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "32162d06-a1c8-4c4e-86e6-01c0100eced9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail0934845c052a32167841c69/javablobstageblockleasefail170839a604c4a1e181414?blockid=YTQ2M2M5ZDYtM2U5OC00ZTg0LTlmZmUtMDMzNWNmNGM4ZDVj&comp=block", + "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" : "bbcb9bd5-84dc-4d4d-9c75-d6c6d7e84304", + "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" : "412a0117-c01e-00c5-14e5-644e4d000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:412a0117-c01e-00c5-14e5-644e4d000000\nTime:2019-09-06T19:03:30.3850321Z", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "bbcb9bd5-84dc-4d4d-9c75-d6c6d7e84304", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2471eb74-e438-4541-8a16-466ec18cc6d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a0129-c01e-00c5-24e5-644e4d000000", + "Body" : "jtcstageblockleasefailjtcstageblockleasefail0934845c052a32167841c69Fri, 06 Sep 2019 19:03:30 GMT\"0x8D732FCE80F9CE8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "2471eb74-e438-4541-8a16-466ec18cc6d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail0934845c052a32167841c69?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" : "c8e7c6f7-e339-4c56-9da4-94c12546b189" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a0137-c01e-00c5-32e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "c8e7c6f7-e339-4c56-9da4-94c12546b189" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockleasefail0934845c052a32167841c69", "javablobstageblockleasefail170839a604c4a1e181414", "javablobstageblockleasefail2176236078ee1228f94f1", "a463c9d6-3e98-4e84-9ffe-0335cf4c8d5c" ] +} \ 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..0d57671ff95b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmind8141541d428?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" : "1138fcda-d9ff-4e25-91b4-2f3545ca2bd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE672B92D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b92e0a14-d01e-009e-3fe5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "1138fcda-d9ff-4e25-91b4-2f3545ca2bd7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmind8141541d428/javablobstageblockmin1blockblobapiteststageblockmind81629322b", + "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" : "5a6d8734-7266-4420-aff1-d4d0a8c32a51", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE688A676\"", + "Content-Length" : "0", + "x-ms-request-id" : "b92e0b0a-d01e-009e-1ae5-644931000000", + "x-ms-client-request-id" : "5a6d8734-7266-4420-aff1-d4d0a8c32a51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmind8141541d428/javablobstageblockmin1blockblobapiteststageblockmind81629322b?blockid=ZDRmNjE0YWUtZGEzNC00ODI4LTg5Y2QtZTg1ZDI0YjdjNjBk&comp=block", + "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" : "18a65477-fa45-4580-9427-69e1b0a0e1aa", + "Content-Type" : "application/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" : "b92e0b36-d01e-009e-44e5-644931000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "18a65477-fa45-4580-9427-69e1b0a0e1aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmind8141541d428/javablobstageblockmin1blockblobapiteststageblockmind81629322b?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d065f7a-3c5b-4f22-8579-1f655b067639" + }, + "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" : "Fri, 06 Sep 2019 19:03:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "ETag" : "\"0x8D732FCE688A676\"", + "x-ms-request-id" : "b92e0b73-d01e-009e-78e5-644931000000", + "Body" : "ZDRmNjE0YWUtZGEzNC00ODI4LTg5Y2QtZTg1ZDI0YjdjNjBk7", + "x-ms-client-request-id" : "9d065f7a-3c5b-4f22-8579-1f655b067639", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cef9db80-6973-488d-b717-e853b35c73a1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b92e0bc3-d01e-009e-43e5-644931000000", + "Body" : "jtcstageblockminjtcstageblockmin0blockblobapiteststageblockmind8141541d428Fri, 06 Sep 2019 19:03:27 GMT\"0x8D732FCE672B92D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "cef9db80-6973-488d-b717-e853b35c73a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmind8141541d428?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" : "9bc32239-14e2-485d-828b-e69c72acc17f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b92e0be7-d01e-009e-61e5-644931000000", + "Date" : "Fri, 06 Sep 2019 19:03:27 GMT", + "x-ms-client-request-id" : "9bc32239-14e2-485d-828b-e69c72acc17f" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockmin0blockblobapiteststageblockmind8141541d428", "javablobstageblockmin1blockblobapiteststageblockmind81629322b", "javablobstageblockmin2blockblobapiteststageblockmind818407601", "d4f614ae-da34-4828-89cd-e85d24b7c60d" ] +} \ 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..363837401b68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody024094ecb91e390020459095?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" : "778afb33-7435-4685-af8e-8860b5ea7a7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCE7AFB28B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4129ff64-c01e-00c5-07e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "x-ms-client-request-id" : "778afb33-7435-4685-af8e-8860b5ea7a7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody024094ecb91e390020459095/javablobstageblocknullbody12351829798b3d4f2348d", + "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" : "d9c4de55-2d10-4010-a78e-041123748f9c", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCE7C0D45A\"", + "Content-Length" : "0", + "x-ms-request-id" : "4129ffa9-c01e-00c5-42e5-644e4d000000", + "x-ms-client-request-id" : "d9c4de55-2d10-4010-a78e-041123748f9c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "977378b7-7368-4e8f-baac-12eed2b7d57e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4129ffc9-c01e-00c5-60e5-644e4d000000", + "Body" : "jtcstageblocknullbodyjtcstageblocknullbody024094ecb91e390020459095Fri, 06 Sep 2019 19:03:29 GMT\"0x8D732FCE7AFB28B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "977378b7-7368-4e8f-baac-12eed2b7d57e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody024094ecb91e390020459095?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" : "d45653db-5958-415f-a285-e0b63aa88ca8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4129ffe7-c01e-00c5-7de5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:29 GMT", + "x-ms-client-request-id" : "d45653db-5958-415f-a285-e0b63aa88ca8" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblocknullbody024094ecb91e390020459095", "javablobstageblocknullbody12351829798b3d4f2348d", "javablobstageblocknullbody2786492ed9949574b94be", "0b61a4f2-8428-4059-894c-18b46caf3fde" ] +} \ 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..de9f67cea461 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploada8e829308c6b6655eb3?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" : "b66d0cd9-9268-487a-ab3d-2c6c6d90a48e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF33B0C60\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a22e0-c01e-00c5-24e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "b66d0cd9-9268-487a-ab3d-2c6c6d90a48e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploada8e829308c6b6655eb3/javablobupload1blockblobapitestuploada8e71145c82bbff14", + "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" : "7716d9b0-d9a7-4056-85bb-27547a5b5c29", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF34286E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a22ed-c01e-00c5-2fe5-644e4d000000", + "x-ms-client-request-id" : "7716d9b0-d9a7-4056-85bb-27547a5b5c29" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploada8e829308c6b6655eb3/javablobupload1blockblobapitestuploada8e71145c82bbff14", + "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" : "eb2ee65e-dc84-4525-ae09-f5fd7137e5f3", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF3493F2F\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a230f-c01e-00c5-4de5-644e4d000000", + "x-ms-client-request-id" : "eb2ee65e-dc84-4525-ae09-f5fd7137e5f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploada8e829308c6b6655eb3/javablobupload1blockblobapitestuploada8e71145c82bbff14", + "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" : "7885345f-5489-4cf7-9391-b0d803d9582c" + }, + "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" : "Fri, 06 Sep 2019 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FCF3493F2F\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:49 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a232c-c01e-00c5-65e5-644e4d000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "7885345f-5489-4cf7-9391-b0d803d9582c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e2fabe09-0745-4721-993a-182d032c7fca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a2334-c01e-00c5-6ce5-644e4d000000", + "Body" : "jtcuploadjtcupload0blockblobapitestuploada8e829308c6b6655eb3Fri, 06 Sep 2019 19:03:49 GMT\"0x8D732FCF33B0C60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "e2fabe09-0745-4721-993a-182d032c7fca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploada8e829308c6b6655eb3?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" : "d56b29c5-8735-491c-ac01-fded8a9b66e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a234a-c01e-00c5-7ce5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "d56b29c5-8735-491c-ac01-fded8a9b66e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcupload0blockblobapitestuploada8e829308c6b6655eb3", "javablobupload1blockblobapitestuploada8e71145c82bbff14", "javablobupload2blockblobapitestuploada8e625401965daa8c" ] +} \ 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..eb837c3a2c3b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac17e12689c93703e83?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" : "ad3495fe-a2b1-49ad-9222-bf4c05548da6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF590B226\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527ac9-801e-0086-31e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "ad3495fe-a2b1-49ad-9222-bf4c05548da6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac17e12689c93703e83/javablobuploadac1blockblobapitestuploadac17e7596701a7ad7", + "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" : "80e4c4c3-624c-4978-9ea7-fc1114e51099", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF5984F6E\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527ad9-801e-0086-3ce5-6464a4000000", + "x-ms-client-request-id" : "80e4c4c3-624c-4978-9ea7-fc1114e51099" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac17e12689c93703e83/javablobuploadac1blockblobapitestuploadac17e7596701a7ad7", + "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" : "a464c9f4-14ad-46b3-a881-d63cedb2440d", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF59EB994\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527ae6-801e-0086-46e5-6464a4000000", + "x-ms-client-request-id" : "a464c9f4-14ad-46b3-a881-d63cedb2440d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1beec003-86b5-4903-9e33-6a5ba3e6cdac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527af2-801e-0086-51e5-6464a4000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac17e12689c93703e83Fri, 06 Sep 2019 19:03:52 GMT\"0x8D732FCF590B226\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "1beec003-86b5-4903-9e33-6a5ba3e6cdac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac17e12689c93703e83?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" : "0bae52bc-93a2-4de6-8776-d6071082045d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527b05-801e-0086-5ee5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "0bae52bc-93a2-4de6-8776-d6071082045d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac17e12689c93703e83", "javablobuploadac1blockblobapitestuploadac17e7596701a7ad7", "javablobuploadac2blockblobapitestuploadac17e9566247e0f5e" ] +} \ 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..b9aac237e321 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2d66699637af9d3cd?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" : "c4e04a93-9a04-4ab9-8dc8-fc1e4286b50b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF5B3D328\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527b1e-801e-0086-70e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "c4e04a93-9a04-4ab9-8dc8-fc1e4286b50b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2d66699637af9d3cd/javablobuploadac1blockblobapitestuploadac2d6371799faf004", + "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" : "54e67d33-939f-4b53-8787-6b3a55228b8a", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF5BA5E73\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527b2d-801e-0086-79e5-6464a4000000", + "x-ms-client-request-id" : "54e67d33-939f-4b53-8787-6b3a55228b8a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2d66699637af9d3cd/javablobuploadac1blockblobapitestuploadac2d6371799faf004", + "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" : "9f64d5e9-1325-4da8-887c-b403a2694195", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF5C116D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527b39-801e-0086-03e5-6464a4000000", + "x-ms-client-request-id" : "9f64d5e9-1325-4da8-887c-b403a2694195" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2206795-232f-4dba-9cba-2e9217ae388c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527b44-801e-0086-0be5-6464a4000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac2d66699637af9d3cdFri, 06 Sep 2019 19:03:53 GMT\"0x8D732FCF5B3D328\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "d2206795-232f-4dba-9cba-2e9217ae388c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2d66699637af9d3cd?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" : "4809b4de-30e5-428a-ab6c-7aa022160517" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527b4c-801e-0086-10e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "4809b4de-30e5-428a-ab6c-7aa022160517" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac2d66699637af9d3cd", "javablobuploadac1blockblobapitestuploadac2d6371799faf004", "javablobuploadac2blockblobapitestuploadac2d65002385e3ab6" ] +} \ 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..14a1e43d7271 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac3292890391e375688?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" : "ac51b2d5-03a5-45ee-aa9a-c23b522f16c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF5D6F420\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527b58-801e-0086-19e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "ac51b2d5-03a5-45ee-aa9a-c23b522f16c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac3292890391e375688/javablobuploadac1blockblobapitestuploadac3296675047dff65", + "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" : "d07e221d-b890-45b8-8ec2-1bbadb3e82fb", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF5EA0544\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527b7d-801e-0086-36e5-6464a4000000", + "x-ms-client-request-id" : "d07e221d-b890-45b8-8ec2-1bbadb3e82fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac3292890391e375688/javablobuploadac1blockblobapitestuploadac3296675047dff65", + "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" : "9c9c0165-0311-4e65-aea5-ba9c76eb15a6", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF5F10BCF\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527b8b-801e-0086-43e5-6464a4000000", + "x-ms-client-request-id" : "9c9c0165-0311-4e65-aea5-ba9c76eb15a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bcd81258-50c4-4949-b8ff-3cc40fe91927" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527b98-801e-0086-4ee5-6464a4000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac3292890391e375688Fri, 06 Sep 2019 19:03:53 GMT\"0x8D732FCF5D6F420\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "bcd81258-50c4-4949-b8ff-3cc40fe91927", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac3292890391e375688?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" : "31bf0b3b-1178-42ab-8098-eabb694d46c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527ba1-801e-0086-55e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "31bf0b3b-1178-42ab-8098-eabb694d46c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac3292890391e375688", "javablobuploadac1blockblobapitestuploadac3296675047dff65", "javablobuploadac2blockblobapitestuploadac32943034f6c22d3" ] +} \ 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..ac33afeb97d3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacc7285274160cc5e12?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" : "b2c46447-b19d-4e30-b152-05ecf62e0810" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF604C627\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527bb6-801e-0086-63e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "b2c46447-b19d-4e30-b152-05ecf62e0810" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacc7285274160cc5e12/javablobuploadac1blockblobapitestuploadacc7213805ea9aad9", + "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" : "56b4cde7-5018-437b-9bdd-5282b7cc0b59", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF60B50CC\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527bc4-801e-0086-6ee5-6464a4000000", + "x-ms-client-request-id" : "56b4cde7-5018-437b-9bdd-5282b7cc0b59" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacc7285274160cc5e12/javablobuploadac1blockblobapitestuploadacc7213805ea9aad9", + "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" : "c65f49a5-d070-4538-a3aa-7231ed855f1d" + }, + "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" : "Fri, 06 Sep 2019 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:52 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" : "\"0x8D732FCF60B50CC\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ac527bce-801e-0086-78e5-6464a4000000", + "x-ms-client-request-id" : "c65f49a5-d070-4538-a3aa-7231ed855f1d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacc7285274160cc5e12/javablobuploadac1blockblobapitestuploadacc7213805ea9aad9", + "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" : "aee06309-a6c0-4013-982f-7d45d44ea85d", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6184C2F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527be3-801e-0086-08e5-6464a4000000", + "x-ms-client-request-id" : "aee06309-a6c0-4013-982f-7d45d44ea85d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c73de703-91dc-4211-8df0-35c70777067e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527bf3-801e-0086-15e5-6464a4000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadacc7285274160cc5e12Fri, 06 Sep 2019 19:03:53 GMT\"0x8D732FCF604C627\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "c73de703-91dc-4211-8df0-35c70777067e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacc7285274160cc5e12?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" : "a843c592-337e-4e2e-be13-b6c6789b68fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527c03-801e-0086-22e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:52 GMT", + "x-ms-client-request-id" : "a843c592-337e-4e2e-be13-b6c6789b68fa" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadacc7285274160cc5e12", "javablobuploadac1blockblobapitestuploadacc7213805ea9aad9", "javablobuploadac2blockblobapitestuploadacc72866636c0abb1" ] +} \ 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..a26358c0c91b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacb6300700d7214a53c?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" : "84694425-414e-4cb0-8e72-31f1594841b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF62CA34F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527c14-801e-0086-2de5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "84694425-414e-4cb0-8e72-31f1594841b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacb6300700d7214a53c/javablobuploadac1blockblobapitestuploadacb6367302b5bb449", + "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" : "6413fe4a-1cbb-49d5-85b1-777cfd2df6e2", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF634182E\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527c29-801e-0086-3fe5-6464a4000000", + "x-ms-client-request-id" : "6413fe4a-1cbb-49d5-85b1-777cfd2df6e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacb6300700d7214a53c/javablobuploadac1blockblobapitestuploadacb6367302b5bb449", + "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" : "88c2c1c0-c69e-4abf-b5cb-b24af90e559c", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF63AD086\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527c35-801e-0086-49e5-6464a4000000", + "x-ms-client-request-id" : "88c2c1c0-c69e-4abf-b5cb-b24af90e559c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6c150b59-033d-4e30-9d03-c44d2e147a10" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527c46-801e-0086-56e5-6464a4000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadacb6300700d7214a53cFri, 06 Sep 2019 19:03:53 GMT\"0x8D732FCF62CA34F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "6c150b59-033d-4e30-9d03-c44d2e147a10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacb6300700d7214a53c?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" : "ce1cb30f-80c2-48aa-ab5e-d30e21db7896" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527c5c-801e-0086-65e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "ce1cb30f-80c2-48aa-ab5e-d30e21db7896" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadacb6300700d7214a53c", "javablobuploadac1blockblobapitestuploadacb6367302b5bb449", "javablobuploadac2blockblobapitestuploadacb638190388103cb" ] +} \ 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..1231b6f06a8c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4?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" : "678f4d01-a676-4cd3-ac97-6d27ea5b3d2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF64FC464\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527c68-801e-0086-71e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "678f4d01-a676-4cd3-ac97-6d27ea5b3d2e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4/javablobuploadac1blockblobapitestuploadacdf046113045fc93", + "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" : "f1adedfb-8ac3-4a98-a643-14e61b80d8b1", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6567569\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527c83-801e-0086-04e5-6464a4000000", + "x-ms-client-request-id" : "f1adedfb-8ac3-4a98-a643-14e61b80d8b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4/javablobuploadac1blockblobapitestuploadacdf046113045fc93?comp=lease", + "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" : "d8716efc-3b93-4cf2-88ee-1dcf16b25aba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF6567569\"", + "x-ms-lease-id" : "41bce4c5-1427-4d8e-8b43-93d07aec62dc", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527c8d-801e-0086-0ee5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "d8716efc-3b93-4cf2-88ee-1dcf16b25aba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4/javablobuploadac1blockblobapitestuploadacdf046113045fc93", + "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" : "67f67c08-68f9-42e0-99a3-6bf35505ab74", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6619BA1\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527c96-801e-0086-17e5-6464a4000000", + "x-ms-client-request-id" : "67f67c08-68f9-42e0-99a3-6bf35505ab74" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1adf644e-3f0b-4eef-8d50-bd12a7bee3c2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527ca2-801e-0086-23e5-6464a4000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4Fri, 06 Sep 2019 19:03:54 GMT\"0x8D732FCF64FC464\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "1adf644e-3f0b-4eef-8d50-bd12a7bee3c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4?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" : "a7a0a899-dd64-4408-bf0d-50925b689067" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527cb2-801e-0086-31e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "a7a0a899-dd64-4408-bf0d-50925b689067" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadacdf086661d4e99ebd4", "javablobuploadac1blockblobapitestuploadacdf046113045fc93", "javablobuploadac2blockblobapitestuploadacdf037184d43a358" ] +} \ 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..b1abba715d7f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail55343235e0882?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" : "167fc843-3872-4410-964a-0f3eb7cdef9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF679EC16\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527cc2-801e-0086-3ce5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "167fc843-3872-4410-964a-0f3eb7cdef9e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail55343235e0882/javablobuploadacfail1blockblobapitestuploadacfail55373388ec2", + "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" : "e0257868-e2af-4a34-855a-3eb23281ea30", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6864364\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527cdf-801e-0086-51e5-6464a4000000", + "x-ms-client-request-id" : "e0257868-e2af-4a34-855a-3eb23281ea30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail55343235e0882/javablobuploadacfail1blockblobapitestuploadacfail55373388ec2", + "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" : "bd9b5376-5736-44a0-abfb-82e92976b000", + "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" : "ac527ce6-801e-0086-57e5-6464a4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ac527ce6-801e-0086-57e5-6464a4000000\nTime:2019-09-06T19:03:54.5768516Z", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "bd9b5376-5736-44a0-abfb-82e92976b000", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f522284f-d6e3-46f3-8ce8-75cc45404d5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527cee-801e-0086-5fe5-6464a4000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail55343235e0882Fri, 06 Sep 2019 19:03:54 GMT\"0x8D732FCF679EC16\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "f522284f-d6e3-46f3-8ce8-75cc45404d5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail55343235e0882?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" : "ad31a827-d416-4a99-a9cb-1858253b2f55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527cfd-801e-0086-69e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "ad31a827-d416-4a99-a9cb-1858253b2f55" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail55343235e0882", "javablobuploadacfail1blockblobapitestuploadacfail55373388ec2", "javablobuploadacfail2blockblobapitestuploadacfail5535943594f" ] +} \ 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..5f99cbed246d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5cc3988327a7d?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" : "24f8a2a2-8812-4688-9fee-ed924c6bea50" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF6A413C3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527d09-801e-0086-74e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "24f8a2a2-8812-4688-9fee-ed924c6bea50" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5cc3988327a7d/javablobuploadacfail1blockblobapitestuploadacfail5cc78299456", + "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" : "1bda0b03-9135-499a-bf03-f61c165df992", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6B1A35A\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527d2b-801e-0086-12e5-6464a4000000", + "x-ms-client-request-id" : "1bda0b03-9135-499a-bf03-f61c165df992" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5cc3988327a7d/javablobuploadacfail1blockblobapitestuploadacfail5cc78299456", + "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" : "8907fff8-e48e-46d6-95d4-956c47e6fa0b", + "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" : "ac527d46-801e-0086-2be5-6464a4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ac527d46-801e-0086-2be5-6464a4000000\nTime:2019-09-06T19:03:54.8931571Z", + "Date" : "Fri, 06 Sep 2019 19:03:53 GMT", + "x-ms-client-request-id" : "8907fff8-e48e-46d6-95d4-956c47e6fa0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9fcd006c-fa6a-44a1-b186-9276d9d0b86c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527d53-801e-0086-35e5-6464a4000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail5cc3988327a7dFri, 06 Sep 2019 19:03:54 GMT\"0x8D732FCF6A413C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "9fcd006c-fa6a-44a1-b186-9276d9d0b86c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5cc3988327a7d?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" : "7a71c9e2-2391-4084-aaa4-432ac69dabd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527d5d-801e-0086-3ee5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "7a71c9e2-2391-4084-aaa4-432ac69dabd5" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail5cc3988327a7d", "javablobuploadacfail1blockblobapitestuploadacfail5cc78299456", "javablobuploadacfail2blockblobapitestuploadacfail5cc841092f8" ] +} \ 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..fc4ab2123a10 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail99d75499c2baa?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" : "fee19045-3e21-45d3-9864-e558de7e522d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF6D0AD06\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527d69-801e-0086-48e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "fee19045-3e21-45d3-9864-e558de7e522d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail99d75499c2baa/javablobuploadacfail1blockblobapitestuploadacfail99d74048821", + "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" : "5c0f462c-eaf2-4c23-a1a5-e61cfe046138", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6D82042\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527d78-801e-0086-54e5-6464a4000000", + "x-ms-client-request-id" : "5c0f462c-eaf2-4c23-a1a5-e61cfe046138" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail99d75499c2baa/javablobuploadacfail1blockblobapitestuploadacfail99d74048821", + "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" : "ac260eda-22ee-4d2c-b0a4-deb4abe3edc9", + "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" : "ac527d89-801e-0086-60e5-6464a4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ac527d89-801e-0086-60e5-6464a4000000\nTime:2019-09-06T19:03:55.1073622Z", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "ac260eda-22ee-4d2c-b0a4-deb4abe3edc9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5f3cb5d2-4ccd-40bf-930d-1e0c06068f43" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527d94-801e-0086-6ae5-6464a4000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail99d75499c2baaFri, 06 Sep 2019 19:03:55 GMT\"0x8D732FCF6D0AD06\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "5f3cb5d2-4ccd-40bf-930d-1e0c06068f43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail99d75499c2baa?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" : "bfb33a52-3028-4680-91d8-be0719f0a840" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527d9d-801e-0086-72e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "bfb33a52-3028-4680-91d8-be0719f0a840" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail99d75499c2baa", "javablobuploadacfail1blockblobapitestuploadacfail99d74048821", "javablobuploadacfail2blockblobapitestuploadacfail99d88202d2a" ] +} \ 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..64bff42bde34 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail00632484872d2?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" : "e5f67537-b2b4-4aac-b952-e3d029876197" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF6F46A57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527db0-801e-0086-80e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "e5f67537-b2b4-4aac-b952-e3d029876197" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail00632484872d2/javablobuploadacfail1blockblobapitestuploadacfail006093093c5", + "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" : "8479848e-3641-49b6-8de6-e24366677bf8", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF6FC0484\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527dbb-801e-0086-06e5-6464a4000000", + "x-ms-client-request-id" : "8479848e-3641-49b6-8de6-e24366677bf8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail00632484872d2/javablobuploadacfail1blockblobapitestuploadacfail006093093c5", + "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" : "1f971b7a-84e1-4dbd-a396-b5809885c388" + }, + "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" : "Fri, 06 Sep 2019 19:03:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCF6FC0484\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:55 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ac527dd2-801e-0086-19e5-6464a4000000", + "x-ms-client-request-id" : "1f971b7a-84e1-4dbd-a396-b5809885c388", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail00632484872d2/javablobuploadacfail1blockblobapitestuploadacfail006093093c5", + "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" : "031dea56-c351-4800-9e8c-23f0cda4742d", + "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" : "ac527de4-801e-0086-25e5-6464a4000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ac527de4-801e-0086-25e5-6464a4000000\nTime:2019-09-06T19:03:55.4176605Z", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "031dea56-c351-4800-9e8c-23f0cda4742d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "20d47968-03a7-49ac-8021-0fddc67fd9be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527dee-801e-0086-2ce5-6464a4000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail00632484872d2Fri, 06 Sep 2019 19:03:55 GMT\"0x8D732FCF6F46A57\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "20d47968-03a7-49ac-8021-0fddc67fd9be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail00632484872d2?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" : "af1c9b0a-19cf-44cf-a92b-4b19c3ef4d05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527dfc-801e-0086-37e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "af1c9b0a-19cf-44cf-a92b-4b19c3ef4d05" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail00632484872d2", "javablobuploadacfail1blockblobapitestuploadacfail006093093c5", "javablobuploadacfail2blockblobapitestuploadacfail00665166175" ] +} \ 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..923662a04160 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71?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" : "225ed920-ea65-46db-ba87-c7477aa7b28c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF7252342\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527e11-801e-0086-44e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "225ed920-ea65-46db-ba87-c7477aa7b28c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71/javablobuploadacfail1blockblobapitestuploadacfaildb13257806e", + "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" : "b2c0b607-e553-441e-b592-6a2d97c7d7ed", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF72C2091\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527e2a-801e-0086-57e5-6464a4000000", + "x-ms-client-request-id" : "b2c0b607-e553-441e-b592-6a2d97c7d7ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71/javablobuploadacfail1blockblobapitestuploadacfaildb13257806e?comp=lease", + "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" : "16dff96b-6554-41d2-af3a-fc5376335bc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF72C2091\"", + "x-ms-lease-id" : "af05be3a-3d1b-4cbb-b753-df5d28bff75a", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527e3b-801e-0086-66e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "16dff96b-6554-41d2-af3a-fc5376335bc0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71/javablobuploadacfail1blockblobapitestuploadacfaildb13257806e", + "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" : "cc7da5fb-27fa-4c3d-bcda-7f6b3e02926b", + "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" : "ac527e49-801e-0086-73e5-6464a4000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:ac527e49-801e-0086-73e5-6464a4000000\nTime:2019-09-06T19:03:55.7189494Z", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "cc7da5fb-27fa-4c3d-bcda-7f6b3e02926b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0b22e0a5-b9e8-47fb-8da6-cff66d574b17" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527e57-801e-0086-80e5-6464a4000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71Fri, 06 Sep 2019 19:03:55 GMT\"0x8D732FCF7252342\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "0b22e0a5-b9e8-47fb-8da6-cff66d574b17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71?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" : "e0cadb78-4861-42cf-9ca0-e380332be116" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527e61-801e-0086-06e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "e0cadb78-4861-42cf-9ca0-e380332be116" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfaildb142249f8b71", "javablobuploadacfail1blockblobapitestuploadacfaildb13257806e", "javablobuploadacfail2blockblobapitestuploadacfaildb103002cd3" ] +} \ 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..e24891143652 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybody8684697216?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" : "4fc952b3-4f5f-4adb-a864-59e2eaf9b92e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF45BB6C4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527833-801e-0086-1de5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "4fc952b3-4f5f-4adb-a864-59e2eaf9b92e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybody8684697216/javablobuploademptybody19864622edc113e9124d51a", + "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" : "20141d6d-61c4-41a7-8772-485ec122713f", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF4641A18\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac52783a-801e-0086-23e5-6464a4000000", + "x-ms-client-request-id" : "20141d6d-61c4-41a7-8772-485ec122713f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybody8684697216/javablobuploademptybody19864622edc113e9124d51a", + "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" : "2513b8a7-c7f4-4d9f-b1c8-e7cb59d26263", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "\"0x8D732FCF46B47BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527842-801e-0086-2ae5-6464a4000000", + "x-ms-client-request-id" : "2513b8a7-c7f4-4d9f-b1c8-e7cb59d26263" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "07581dad-0bff-427c-8327-a4b5e0001596" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac52784b-801e-0086-31e5-6464a4000000", + "Body" : "jtcuploademptybodyjtcuploademptybody0blockblobapitestuploademptybody8684697216Fri, 06 Sep 2019 19:03:50 GMT\"0x8D732FCF45BB6C4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "07581dad-0bff-427c-8327-a4b5e0001596", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybody8684697216?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" : "dd4deac5-ff7a-4ed3-bba6-0b134a51f29e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527861-801e-0086-44e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "dd4deac5-ff7a-4ed3-bba6-0b134a51f29e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploademptybody0blockblobapitestuploademptybody8684697216", "javablobuploademptybody19864622edc113e9124d51a", "javablobuploademptybody200142275b22eeaff845d6b" ] +} \ 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..74a38613598a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderrore3f825904c31a5?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" : "98f5509c-9e26-409e-8906-855c8b976f83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF751955B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527e6f-801e-0086-10e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:54 GMT", + "x-ms-client-request-id" : "98f5509c-9e26-409e-8906-855c8b976f83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderrore3f825904c31a5/javablobuploaderror1blockblobapitestuploaderrore3f66660dc5d", + "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" : "0139c881-afde-478d-ba0c-c291dd3a48e9", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF7631C24\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527e9c-801e-0086-33e5-6464a4000000", + "x-ms-client-request-id" : "0139c881-afde-478d-ba0c-c291dd3a48e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderrore3f825904c31a5/javablobuploaderror3blockblobapitestuploaderrore3f6388736b7", + "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" : "cc6afe55-9390-4904-957e-dd6f7f0152a7", + "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" : "ac527ea2-801e-0086-38e5-6464a4000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ac527ea2-801e-0086-38e5-6464a4000000\nTime:2019-09-06T19:03:57.4986576Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:03:56 GMT", + "x-ms-client-request-id" : "cc6afe55-9390-4904-957e-dd6f7f0152a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "91205813-ceb0-4883-a569-e07068364f5f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac528068-801e-0086-16e5-6464a4000000", + "Body" : "jtcuploaderrorjtcuploaderror0blockblobapitestuploaderrore3f825904c31a5Fri, 06 Sep 2019 19:03:55 GMT\"0x8D732FCF751955B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:56 GMT", + "x-ms-client-request-id" : "91205813-ceb0-4883-a569-e07068364f5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderrore3f825904c31a5?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" : "a7937c86-f8c2-4504-97c0-09f4d963a2a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac528072-801e-0086-1ee5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:56 GMT", + "x-ms-client-request-id" : "a7937c86-f8c2-4504-97c0-09f4d963a2a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploaderror0blockblobapitestuploaderrore3f825904c31a5", "javablobuploaderror1blockblobapitestuploaderrore3f66660dc5d", "javablobuploaderror2blockblobapitestuploaderrore3f671262cf0", "javablobuploaderror3blockblobapitestuploaderrore3f6388736b7" ] +} \ 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..61c18900ca67 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersbe492613a16e?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" : "afb2636d-d8ef-4e3a-9075-b230ec381b27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF49E7586\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac5278b4-801e-0086-07e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "afb2636d-d8ef-4e3a-9075-b230ec381b27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersbe492613a16e/javablobuploadheaders1blockblobapitestuploadheadersbe473230ae", + "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" : "b5e932fc-4eec-4d9b-a041-5bc81ca6d323", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF4A5C695\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac5278c1-801e-0086-11e5-6464a4000000", + "x-ms-client-request-id" : "b5e932fc-4eec-4d9b-a041-5bc81ca6d323" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersbe492613a16e/javablobuploadheaders1blockblobapitestuploadheadersbe473230ae", + "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" : "252bffd2-420b-4a21-a70f-8bb6f9827583", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF4ACA609\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac5278ce-801e-0086-1de5-6464a4000000", + "x-ms-client-request-id" : "252bffd2-420b-4a21-a70f-8bb6f9827583" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersbe492613a16e/javablobuploadheaders1blockblobapitestuploadheadersbe473230ae", + "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" : "a8ee8ca6-1a75-4f6b-8f9f-0a009bee177b" + }, + "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" : "Fri, 06 Sep 2019 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03: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" : "\"0x8D732FCF4ACA609\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:51 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ac5278e1-801e-0086-2be5-6464a4000000", + "x-ms-client-request-id" : "a8ee8ca6-1a75-4f6b-8f9f-0a009bee177b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c45cf7e5-3c24-42be-bc34-21efcf15f421" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac5278e5-801e-0086-2ee5-6464a4000000", + "Body" : "jtcuploadheadersjtcuploadheaders0blockblobapitestuploadheadersbe492613a16eFri, 06 Sep 2019 19:03:51 GMT\"0x8D732FCF49E7586\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "c45cf7e5-3c24-42be-bc34-21efcf15f421", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersbe492613a16e?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" : "345fd6f5-e26d-4e9d-b98e-70e1b9405de4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac5278ef-801e-0086-38e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "345fd6f5-e26d-4e9d-b98e-70e1b9405de4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadheaders0blockblobapitestuploadheadersbe492613a16e", "javablobuploadheaders1blockblobapitestuploadheadersbe473230ae", "javablobuploadheaders2blockblobapitestuploadheadersbe4492856a" ] +} \ 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..eabb77f0d3cb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders6bd878447128?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" : "46250793-060b-449f-8df8-2c1296ef3391" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF4C9D5EA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac5278fc-801e-0086-42e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "46250793-060b-449f-8df8-2c1296ef3391" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders6bd878447128/javablobuploadheaders1blockblobapitestuploadheaders6bd8281356", + "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" : "5f026378-5403-4a11-bbf2-d3688e9dadc3", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF4E0E1CC\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527920-801e-0086-60e5-6464a4000000", + "x-ms-client-request-id" : "5f026378-5403-4a11-bbf2-d3688e9dadc3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders6bd878447128/javablobuploadheaders1blockblobapitestuploadheaders6bd8281356", + "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" : "01eadb3a-6fd1-420d-9a55-9509e54c4a0e", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF4E77309\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac52792a-801e-0086-6ae5-6464a4000000", + "x-ms-client-request-id" : "01eadb3a-6fd1-420d-9a55-9509e54c4a0e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders6bd878447128/javablobuploadheaders1blockblobapitestuploadheaders6bd8281356", + "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" : "44177f7b-defc-4471-b380-894450c1bfdd" + }, + "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" : "Fri, 06 Sep 2019 19:03:51 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" : "Fri, 06 Sep 2019 19:03:51 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ac527933-801e-0086-71e5-6464a4000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D732FCF4E77309\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "44177f7b-defc-4471-b380-894450c1bfdd", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3ce94c43-3e43-457f-8e43-71ff8195a7af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac52793b-801e-0086-77e5-6464a4000000", + "Body" : "jtcuploadheadersjtcuploadheaders0blockblobapitestuploadheaders6bd878447128Fri, 06 Sep 2019 19:03:51 GMT\"0x8D732FCF4C9D5EA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "3ce94c43-3e43-457f-8e43-71ff8195a7af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders6bd878447128?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" : "ccdca71b-5399-4c28-a355-c1c55bf58338" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527943-801e-0086-7ee5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "ccdca71b-5399-4c28-a355-c1c55bf58338" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadheaders0blockblobapitestuploadheaders6bd878447128", "javablobuploadheaders1blockblobapitestuploadheaders6bd8281356", "javablobuploadheaders2blockblobapitestuploadheaders6bd214797c" ] +} \ 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..d678c2dec9bf --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument050101b188b8d9295a432d?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" : "b2be26c1-3fd9-4075-8671-982f90231ff1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF3AA3CB0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a2406-c01e-00c5-21e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "b2be26c1-3fd9-4075-8671-982f90231ff1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument050101b188b8d9295a432d/javablobuploadillegalargument180746a5602e34a6f545", + "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" : "0a190288-f261-4d9f-9930-860d8b66544a", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF3C6CA5C\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a244e-c01e-00c5-5be5-644e4d000000", + "x-ms-client-request-id" : "0a190288-f261-4d9f-9930-860d8b66544a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c7297a67-086e-4bd1-9876-5440b4e7e3a7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a2462-c01e-00c5-69e5-644e4d000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument050101b188b8d9295a432dFri, 06 Sep 2019 19:03:49 GMT\"0x8D732FCF3AA3CB0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "c7297a67-086e-4bd1-9876-5440b4e7e3a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument050101b188b8d9295a432d?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" : "9bc4b1fe-8fc5-4d20-ba59-5e5eac4495b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a2479-c01e-00c5-7be5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "9bc4b1fe-8fc5-4d20-ba59-5e5eac4495b5" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument050101b188b8d9295a432d", "javablobuploadillegalargument180746a5602e34a6f545", "javablobuploadillegalargument2391851304eb69a8e747" ] +} \ 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..0d21fa7c1b8e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument063706f10ae1448f354290?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" : "660fbd7a-f56b-4041-85e5-ed154c34b8b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF3E7F0C3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a24bf-c01e-00c5-36e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "660fbd7a-f56b-4041-85e5-ed154c34b8b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument063706f10ae1448f354290/javablobuploadillegalargument177307b30b5c44a76747", + "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" : "eba4d668-e7ef-4202-adc4-afe5d01e76f0", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF3EFB8D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a24da-c01e-00c5-4ce5-644e4d000000", + "x-ms-client-request-id" : "eba4d668-e7ef-4202-adc4-afe5d01e76f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument063706f10ae1448f354290/javablobuploadillegalargument177307b30b5c44a76747", + "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" : "90fa6c93-2581-46af-8c09-e6cee326bed1", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c7204bfa-3c40-435f-9fc0-daa1b757d6dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "11f0ed55-701e-0076-5ae5-64b4ca000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument063706f10ae1448f354290Fri, 06 Sep 2019 19:03:50 GMT\"0x8D732FCF3E7F0C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "c7204bfa-3c40-435f-9fc0-daa1b757d6dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument063706f10ae1448f354290?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" : "8aae4010-c183-4d6d-bbbd-7b3ebce45fb4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "11f0ed75-701e-0076-75e5-64b4ca000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "8aae4010-c183-4d6d-bbbd-7b3ebce45fb4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument063706f10ae1448f354290", "javablobuploadillegalargument177307b30b5c44a76747", "javablobuploadillegalargument20594818154f835dc84b" ] +} \ 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..6a100a7a72cd --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument054269fc981d84eee84f1a?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" : "092ae51b-a6fe-4a2a-bf52-87d7454d4c0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF418725D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "11f0ed90-701e-0076-0de5-64b4ca000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "092ae51b-a6fe-4a2a-bf52-87d7454d4c0a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument054269fc981d84eee84f1a/javablobuploadillegalargument193835fb97190258b54b", + "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" : "2cb1d69e-6b96-416f-8156-aeb000185908", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF41FFC0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "11f0edac-701e-0076-26e5-64b4ca000000", + "x-ms-client-request-id" : "2cb1d69e-6b96-416f-8156-aeb000185908" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument054269fc981d84eee84f1a/javablobuploadillegalargument193835fb97190258b54b", + "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" : "e284fabd-5dcb-4276-9642-5a01c2101398", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d8de1029-847c-4f1e-ab35-93ff65474990" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac5277fb-801e-0086-6ee5-6464a4000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument054269fc981d84eee84f1aFri, 06 Sep 2019 19:03:50 GMT\"0x8D732FCF418725D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "d8de1029-847c-4f1e-ab35-93ff65474990", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument054269fc981d84eee84f1a?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" : "447f75b1-b5b8-4522-82b1-4791760c855f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527826-801e-0086-13e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:49 GMT", + "x-ms-client-request-id" : "447f75b1-b5b8-4522-82b1-4791760c855f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument054269fc981d84eee84f1a", "javablobuploadillegalargument193835fb97190258b54b", "javablobuploadillegalargument27628026f447c847984f" ] +} \ 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..ecbcf737d640 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadatab7594064384?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" : "0967a5cc-d514-42c9-b1db-5db43770bc35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF506789E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527957-801e-0086-0de5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "0967a5cc-d514-42c9-b1db-5db43770bc35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadatab7594064384/javablobuploadmetadata1blockblobapitestuploadmetadatab75967134", + "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" : "54483343-2927-4634-a778-8e27bef3dca2", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF5120F9A\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac52797e-801e-0086-28e5-6464a4000000", + "x-ms-client-request-id" : "54483343-2927-4634-a778-8e27bef3dca2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadatab7594064384/javablobuploadmetadata1blockblobapitestuploadmetadatab75967134", + "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" : "fff3b949-9b11-4e07-b477-9884c737bbd9", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF51A4EEB\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac5279aa-801e-0086-4ce5-6464a4000000", + "x-ms-client-request-id" : "fff3b949-9b11-4e07-b477-9884c737bbd9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadatab7594064384/javablobuploadmetadata1blockblobapitestuploadmetadatab75967134", + "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" : "a8fc7738-a128-46e2-ba21-6cb8bc779070" + }, + "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" : "Fri, 06 Sep 2019 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D732FCF51A4EEB\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ac5279b5-801e-0086-57e5-6464a4000000", + "x-ms-client-request-id" : "a8fc7738-a128-46e2-ba21-6cb8bc779070", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0567ccb2-30ea-4188-9a3c-815ef28e6e1e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac5279c3-801e-0086-62e5-6464a4000000", + "Body" : "jtcuploadmetadatajtcuploadmetadata0blockblobapitestuploadmetadatab7594064384Fri, 06 Sep 2019 19:03:52 GMT\"0x8D732FCF506789E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "0567ccb2-30ea-4188-9a3c-815ef28e6e1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadatab7594064384?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" : "db5551cc-306f-4268-a593-0020764fd3f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac5279c8-801e-0086-67e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "db5551cc-306f-4268-a593-0020764fd3f0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmetadata0blockblobapitestuploadmetadatab7594064384", "javablobuploadmetadata1blockblobapitestuploadmetadatab75967134", "javablobuploadmetadata2blockblobapitestuploadmetadatab7590591b" ] +} \ 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..408de5c89721 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6d?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" : "808654ae-6f71-42a7-b8a0-047709d8dceb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF534BFEA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac5279d6-801e-0086-71e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "808654ae-6f71-42a7-b8a0-047709d8dceb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6d/javablobuploadmetadata1blockblobapitestuploadmetadata7f2294271", + "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" : "455e43c4-edde-485b-94d2-52a487f05517", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF55D0D1C\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527a45-801e-0086-46e5-6464a4000000", + "x-ms-client-request-id" : "455e43c4-edde-485b-94d2-52a487f05517" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6d/javablobuploadmetadata1blockblobapitestuploadmetadata7f2294271", + "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" : "7505c412-a8f4-4259-b4e4-ba1f62928a19", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF567E51D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527a58-801e-0086-58e5-6464a4000000", + "x-ms-client-request-id" : "7505c412-a8f4-4259-b4e4-ba1f62928a19" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6d/javablobuploadmetadata1blockblobapitestuploadmetadata7f2294271", + "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" : "ad80f5e1-e65a-4548-b311-242840321f81" + }, + "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" : "Fri, 06 Sep 2019 19:03:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:51 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" : "\"0x8D732FCF567E51D\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:52 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ac527a6d-801e-0086-6ae5-6464a4000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "ad80f5e1-e65a-4548-b311-242840321f81", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "812f458b-9778-4c4a-8186-ea0bf14ffcbd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac527a85-801e-0086-7de5-6464a4000000", + "Body" : "jtcuploadmetadatajtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6dFri, 06 Sep 2019 19:03:52 GMT\"0x8D732FCF534BFEA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "812f458b-9778-4c4a-8186-ea0bf14ffcbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6d?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" : "ae33d6df-db55-4738-b5c0-23ff6ec911c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac527a92-801e-0086-07e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:51 GMT", + "x-ms-client-request-id" : "ae33d6df-db55-4738-b5c0-23ff6ec911c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmetadata0blockblobapitestuploadmetadata7f239529c6d", "javablobuploadmetadata1blockblobapitestuploadmetadata7f2294271", "javablobuploadmetadata2blockblobapitestuploadmetadata7f2815415" ] +} \ 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..e7b03d4751e2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmind0a65118672a5f40?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" : "c8ffe160-c707-4a7f-87ac-982b9766641f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF367A562\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "412a2363-c01e-00c5-10e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "c8ffe160-c707-4a7f-87ac-982b9766641f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmind0a65118672a5f40/javablobuploadmin1blockblobapitestuploadmind0a1450352926b", + "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" : "58f4ae5b-bbe7-4263-8dce-f87a74173e25", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF38852FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a23af-c01e-00c5-51e5-644e4d000000", + "x-ms-client-request-id" : "58f4ae5b-bbe7-4263-8dce-f87a74173e25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmind0a65118672a5f40/javablobuploadmin1blockblobapitestuploadmind0a1450352926b", + "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" : "b841b30a-7b7b-4e29-9905-19a1668f62c3", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF38EBD1E\"", + "Content-Length" : "0", + "x-ms-request-id" : "412a23c1-c01e-00c5-62e5-644e4d000000", + "x-ms-client-request-id" : "b841b30a-7b7b-4e29-9905-19a1668f62c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmind0a65118672a5f40/javablobuploadmin1blockblobapitestuploadmind0a1450352926b", + "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" : "00d33202-667f-4b98-b93e-79d95ecb444c" + }, + "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" : "Fri, 06 Sep 2019 19:03:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FCF38EBD1E\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:03:49 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "412a23d2-c01e-00c5-6ee5-644e4d000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "00d33202-667f-4b98-b93e-79d95ecb444c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c3ec20a2-ec3f-4391-bda4-217e8e5544a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "412a23e5-c01e-00c5-01e5-644e4d000000", + "Body" : "jtcuploadminjtcuploadmin0blockblobapitestuploadmind0a65118672a5f40Fri, 06 Sep 2019 19:03:49 GMT\"0x8D732FCF367A562\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "c3ec20a2-ec3f-4391-bda4-217e8e5544a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmind0a65118672a5f40?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" : "d850cf43-66b6-487b-8c47-255eb2c585bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "412a23ee-c01e-00c5-09e5-644e4d000000", + "Date" : "Fri, 06 Sep 2019 19:03:48 GMT", + "x-ms-client-request-id" : "d850cf43-66b6-487b-8c47-255eb2c585bc" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmin0blockblobapitestuploadmind0a65118672a5f40", "javablobuploadmin1blockblobapitestuploadmind0a1450352926b", "javablobuploadmin2blockblobapitestuploadmind0a99334889b7e" ] +} \ 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..590aaed85f80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody967341841f9?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" : "a08e424b-00d4-4b1c-924b-b22a4b9bd9d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FCF482822D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ac527886-801e-0086-63e5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "a08e424b-00d4-4b1c-924b-b22a4b9bd9d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody967341841f9/javablobuploadnullbody1blockblobapitestuploadnullbody96774685a", + "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" : "fa1ebeeb-98ce-4349-a831-c72f4c6cf14b", + "Content-Type" : "application/octet-stream" + }, + "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 19:03:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FCF489AC69\"", + "Content-Length" : "0", + "x-ms-request-id" : "ac527899-801e-0086-70e5-6464a4000000", + "x-ms-client-request-id" : "fa1ebeeb-98ce-4349-a831-c72f4c6cf14b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fd7bd165-34b1-4d3c-9240-d8a69d1f3782" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ac5278a5-801e-0086-7ae5-6464a4000000", + "Body" : "jtcuploadnullbodyjtcuploadnullbody0blockblobapitestuploadnullbody967341841f9Fri, 06 Sep 2019 19:03:51 GMT\"0x8D732FCF482822D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "fd7bd165-34b1-4d3c-9240-d8a69d1f3782", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody967341841f9?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" : "f4831094-ff1f-42e4-b7c0-aa2f4875a7fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ac5278aa-801e-0086-7fe5-6464a4000000", + "Date" : "Fri, 06 Sep 2019 19:03:50 GMT", + "x-ms-client-request-id" : "f4831094-ff1f-42e4-b7c0-aa2f4875a7fd" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadnullbody0blockblobapitestuploadnullbody967341841f9", "javablobuploadnullbody1blockblobapitestuploadnullbody96774685a", "javablobuploadnullbody2blockblobapitestuploadnullbody967228905" ] +} \ 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..90961992f78e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobInputOutputStreamTestuploaddownload.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcuploaddownload094002466a789d653a4d588def", "javablobuploaddownload1016294ce9ad7c6e864f1fa", "5b3a16ec-5fad-4c6d-9019-a471f978cceb" ] +} \ 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..796fd1d7d811 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2ef8437961d37?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" : "d51e36d4-b3fc-45f7-b737-878cb186f7e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD823301BB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651344-001e-001f-1fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "d51e36d4-b3fc-45f7-b737-878cb186f7e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2ef8437961d37?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c033254c-9f71-4540-809e-b220ce7a9dae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD823301BB\"", + "x-ms-lease-id" : "0a9c8336-ebcc-4441-8154-d60c1c0425b6", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65136d-001e-001f-44e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "c033254c-9f71-4540-809e-b220ce7a9dae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2ef8437961d37?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" : "c67c8473-2f78-458d-b71d-4158f744f35e" + }, + "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" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD823301BB\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "ec651389-001e-001f-5de6-64eb66000000", + "x-ms-client-request-id" : "c67c8473-2f78-458d-b71d-4158f744f35e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "653903be-cc98-4e86-87db-9b0579b07bae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65139a-001e-001f-6de6-64eb66000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease2ef8437961d37Fri, 06 Sep 2019 19:07:48 GMT\"0x8D732FD823301BB\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "653903be-cc98-4e86-87db-9b0579b07bae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2ef8437961d37?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3845847a-0bdf-4721-b3e2-63aa23d68937" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD823301BB\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6513bb-001e-001f-07e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "3845847a-0bdf-4721-b3e2-63aa23d68937" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2ef8437961d37?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" : "105ef41b-5c13-42c4-88c2-98698f30c0e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6513e3-001e-001f-2ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "105ef41b-5c13-42c4-88c2-98698f30c0e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease2ef8437961d37" ] +} \ 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..2a33a1dd7fb2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease93d90668f1b79?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" : "c7787a1e-eccf-48bf-91c6-0a8660553076" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD828B7031\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6514a5-001e-001f-5ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "c7787a1e-eccf-48bf-91c6-0a8660553076" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease93d90668f1b79?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4a4987fa-c723-45b8-8087-77632de81fbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD828B7031\"", + "x-ms-lease-id" : "6538e622-31e1-4179-b4f2-49dca6ffc440", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6514ba-001e-001f-6ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "4a4987fa-c723-45b8-8087-77632de81fbf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease93d90668f1b79?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" : "ce47a7ff-4034-42a1-8302-99b9f9918c39" + }, + "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" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD828B7031\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "fixed", + "Content-Length" : "0", + "x-ms-request-id" : "ec6514ca-001e-001f-7ce6-64eb66000000", + "x-ms-client-request-id" : "ce47a7ff-4034-42a1-8302-99b9f9918c39" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "abf725cd-1372-4529-a087-12bb882edf74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6514db-001e-001f-0be6-64eb66000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease93d90668f1b79Fri, 06 Sep 2019 19:07:49 GMT\"0x8D732FD828B7031\"lockedleasedfixed$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "abf725cd-1372-4529-a087-12bb882edf74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease93d90668f1b79?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0c20b88f-e540-4376-8311-9f76ac45de70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD828B7031\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6514ed-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "0c20b88f-e540-4376-8311-9f76ac45de70" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease93d90668f1b79?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" : "4dbf9937-6f06-4f96-abf4-24e49eee5877" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651508-001e-001f-33e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "4dbf9937-6f06-4f96-abf4-24e49eee5877" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease93d90668f1b79" ] +} \ 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..80918afb88e3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseeb311757e874c?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" : "8b6c9581-7eed-494b-a229-b0a5efbee641" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82AEDF28\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651524-001e-001f-49e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "8b6c9581-7eed-494b-a229-b0a5efbee641" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseeb311757e874c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d4c0fe82-35bc-4ecb-ab67-11cf586993de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82AEDF28\"", + "x-ms-lease-id" : "d6ccd02e-5eac-4fd6-92ed-1958eb45b7b8", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651572-001e-001f-0de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "d4c0fe82-35bc-4ecb-ab67-11cf586993de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseeb311757e874c?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" : "8fe560a6-9138-4f47-9359-3866c75a29f5" + }, + "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" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD82AEDF28\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "ec65158e-001e-001f-23e6-64eb66000000", + "x-ms-client-request-id" : "8fe560a6-9138-4f47-9359-3866c75a29f5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea574cb0-fc61-4e83-b5ad-a9c63e17d019" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6515a0-001e-001f-34e6-64eb66000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquireleaseeb311757e874cFri, 06 Sep 2019 19:07:49 GMT\"0x8D732FD82AEDF28\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "ea574cb0-fc61-4e83-b5ad-a9c63e17d019", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseeb311757e874c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea702279-8767-4447-ac77-59594e6a91cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82AEDF28\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6515ac-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "ea702279-8767-4447-ac77-59594e6a91cd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseeb311757e874c?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" : "3b6ca5aa-536e-429d-8c3a-fb51e7cd5f57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6515c0-001e-001f-54e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "3b6ca5aa-536e-429d-8c3a-fb51e7cd5f57" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquireleaseeb311757e874c" ] +} \ 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..e742fc5f3a8e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac64322157c0d?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" : "67a21cfc-b02c-4642-8bb4-53d2e50f681c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8303550A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651664-001e-001f-6ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "67a21cfc-b02c-4642-8bb4-53d2e50f681c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac64322157c0d?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "68ac1a07-58b7-40bf-ae02-5ba0b76b0aff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8303550A\"", + "x-ms-lease-id" : "3615b1bd-eb73-4bad-9139-944c55bec92b", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651683-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "68ac1a07-58b7-40bf-ae02-5ba0b76b0aff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8665aad7-aacd-4cf0-90b0-eb05c95d0793" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6516a8-001e-001f-1ee6-64eb66000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseac64322157c0dFri, 06 Sep 2019 19:07:50 GMT\"0x8D732FD8303550A\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "8665aad7-aacd-4cf0-90b0-eb05c95d0793", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac64322157c0d?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9feed676-6bc0-4c19-b87d-5636e0af8d38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8303550A\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6516b6-001e-001f-29e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "9feed676-6bc0-4c19-b87d-5636e0af8d38" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac64322157c0d?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" : "6e79e784-3035-4d3b-865e-2c9005986d92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6516cd-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "6e79e784-3035-4d3b-865e-2c9005986d92" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseac64322157c0d" ] +} \ 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..1ba73981af59 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac0428779625f?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" : "8a78e4ae-cf18-4710-b97f-9ef5b71d6b72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83216B94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6516e4-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "8a78e4ae-cf18-4710-b97f-9ef5b71d6b72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac0428779625f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7d575dca-92a9-489b-a879-34e6d47b15ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83216B94\"", + "x-ms-lease-id" : "a8cfdd69-31e5-4181-8aeb-5fcff1f0b6e0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651753-001e-001f-33e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "7d575dca-92a9-489b-a879-34e6d47b15ec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "04ead16f-7854-4e4d-845c-94bdcffeff6f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec651763-001e-001f-41e6-64eb66000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseac0428779625fFri, 06 Sep 2019 19:07:50 GMT\"0x8D732FD83216B94\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "04ead16f-7854-4e4d-845c-94bdcffeff6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac0428779625f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3b4749d6-7a61-422e-a78f-49c0a4d022fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83216B94\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65177e-001e-001f-59e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "3b4749d6-7a61-422e-a78f-49c0a4d022fd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac0428779625f?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" : "80f41961-d017-4717-b6af-5ce6a60c1b42" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651790-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "80f41961-d017-4717-b6af-5ce6a60c1b42" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseac0428779625f" ] +} \ 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..3d70e7a9fde8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacbb187099b7a?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" : "cc5212ff-4b38-4c82-a802-5a1123c71770" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8363DBC5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6517b1-001e-001f-08e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "cc5212ff-4b38-4c82-a802-5a1123c71770" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacbb187099b7a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e5583709-7b4d-4268-b727-3f983d7de4a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8363DBC5\"", + "x-ms-lease-id" : "605b72c5-a03e-4ac9-9f4e-776fe7cc6eb2", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6517d3-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "e5583709-7b4d-4268-b727-3f983d7de4a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f46701cf-9ec0-47a3-a403-e8827a50e1a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6517e9-001e-001f-39e6-64eb66000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseacbb187099b7aFri, 06 Sep 2019 19:07:50 GMT\"0x8D732FD8363DBC5\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "f46701cf-9ec0-47a3-a403-e8827a50e1a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacbb187099b7a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15f4559e-0c42-455f-9575-b1f1978e1ae7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8363DBC5\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6517fa-001e-001f-48e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "15f4559e-0c42-455f-9575-b1f1978e1ae7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacbb187099b7a?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" : "54f59d9f-1cee-46d3-860f-ea27e34fce13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651814-001e-001f-61e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "54f59d9f-1cee-46d3-860f-ea27e34fce13" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseacbb187099b7a" ] +} \ 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..56b881147d11 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0552710068db9b1038482baa?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" : "1c2a5f3e-bfb1-41e5-9e55-0497f4e14925" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83848B01\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651842-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "1c2a5f3e-bfb1-41e5-9e55-0497f4e14925" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0552710068db9b1038482baa?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "64067dbc-e49f-4305-9c3e-09a93818df81" + }, + "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" : "ec65185a-001e-001f-1fe6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65185a-001e-001f-1fe6-64eb66000000\nTime:2019-09-06T19:07:51.1201194Z", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "64067dbc-e49f-4305-9c3e-09a93818df81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea795050-1a28-4dd7-9004-ccc25244629b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65186c-001e-001f-31e6-64eb66000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0552710068db9b1038482baaFri, 06 Sep 2019 19:07:51 GMT\"0x8D732FD83848B01\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "ea795050-1a28-4dd7-9004-ccc25244629b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0552710068db9b1038482baa?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" : "e576cc5b-277e-41f3-8e93-86214ba06b20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65187b-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "e576cc5b-277e-41f3-8e93-86214ba06b20" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0552710068db9b1038482baa" ] +} \ 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..b4166a7aee7c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail028925fc98bdac6acf4d4899?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" : "674a4397-9e2e-47e4-8eb5-f06a0cb0c07d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD839D9747\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65189f-001e-001f-60e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "674a4397-9e2e-47e4-8eb5-f06a0cb0c07d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail028925fc98bdac6acf4d4899?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c4cedb23-9868-4000-863c-43536169ab34" + }, + "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" : "ec6518b9-001e-001f-76e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec6518b9-001e-001f-76e6-64eb66000000\nTime:2019-09-06T19:07:51.2872767Z", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "c4cedb23-9868-4000-863c-43536169ab34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dd694f50-2374-4831-b0bf-f2ca1d106bf6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6518cb-001e-001f-07e6-64eb66000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail028925fc98bdac6acf4d4899Fri, 06 Sep 2019 19:07:51 GMT\"0x8D732FD839D9747\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "dd694f50-2374-4831-b0bf-f2ca1d106bf6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail028925fc98bdac6acf4d4899?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" : "c1fd164f-048d-48d5-ac64-4001c91a58f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6518de-001e-001f-1ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:50 GMT", + "x-ms-client-request-id" : "c1fd164f-048d-48d5-ac64-4001c91a58f6" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail028925fc98bdac6acf4d4899" ] +} \ 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..5fdb08db669e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal051166fac6c5d8547c40f1?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" : "2499622c-6e59-4f49-bccf-23f479e12658" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83B6A396\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651906-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "2499622c-6e59-4f49-bccf-23f479e12658" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e03f361f-3461-44fb-b443-1a4aaf90f554" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec651928-001e-001f-5ae6-64eb66000000", + "Body" : "jtcacquireleaseacillegaljtcacquireleaseacillegal051166fac6c5d8547c40f1Fri, 06 Sep 2019 19:07:51 GMT\"0x8D732FD83B6A396\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "e03f361f-3461-44fb-b443-1a4aaf90f554", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal051166fac6c5d8547c40f1?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" : "3818b519-8e64-4685-9d07-707f683b1321" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651937-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "3818b519-8e64-4685-9d07-707f683b1321" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacillegal051166fac6c5d8547c40f1" ] +} \ 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..06f9cec00b57 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal080962bcd810901ce142ce?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" : "031c7283-b2f2-41d7-8353-398bf36e47a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83C85B0F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65195a-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "031c7283-b2f2-41d7-8353-398bf36e47a9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea89c1d5-e000-4942-97e0-a85c77f92cd4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65196c-001e-001f-15e6-64eb66000000", + "Body" : "jtcacquireleaseacillegaljtcacquireleaseacillegal080962bcd810901ce142ceFri, 06 Sep 2019 19:07:51 GMT\"0x8D732FD83C85B0F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "ea89c1d5-e000-4942-97e0-a85c77f92cd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal080962bcd810901ce142ce?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" : "a76166e7-e8db-44b4-9756-394b73e92476" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651979-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "a76166e7-e8db-44b4-9756-394b73e92476" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacillegal080962bcd810901ce142ce" ] +} \ 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..f26259479fcb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0containerapitestacquireleaseerror03f04380?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" : "34671724-ae46-4a7c-a317-bb53121e0eac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83DBC0AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651999-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "34671724-ae46-4a7c-a317-bb53121e0eac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror1containerapitestacquireleaseerror03f81216?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eb01ced0-a920-465c-b7c0-883ad8f32760" + }, + "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" : "ec6519bc-001e-001f-5be6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec6519bc-001e-001f-5be6-64eb66000000\nTime:2019-09-06T19:07:51.6946596Z", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "eb01ced0-a920-465c-b7c0-883ad8f32760", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "04d10639-a2d4-47cf-af14-7104649fcc94" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6519d1-001e-001f-6ee6-64eb66000000", + "Body" : "jtcacquireleaseerrorjtcacquireleaseerror0containerapitestacquireleaseerror03f04380Fri, 06 Sep 2019 19:07:51 GMT\"0x8D732FD83DBC0AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "04d10639-a2d4-47cf-af14-7104649fcc94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0containerapitestacquireleaseerror03f04380?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" : "415db415-838f-4f29-b27f-3d202b0e0e8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6519e6-001e-001f-02e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "415db415-838f-4f29-b27f-3d202b0e0e8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseerror0containerapitestacquireleaseerror03f04380", "jtcacquireleaseerror1containerapitestacquireleaseerror03f81216" ] +} \ 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..bac1632ee420 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleasemin6515802401?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" : "7c4aa656-e0c4-4a39-be2d-1c6d9f06ea71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82E453E3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6515d4-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "7c4aa656-e0c4-4a39-be2d-1c6d9f06ea71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleasemin6515802401?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "17a6c09f-d3c6-4ca2-83ea-ac697334a6c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82E453E3\"", + "x-ms-lease-id" : "c972dbb9-f20c-4043-9c57-0e810747efa5", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6515f7-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "17a6c09f-d3c6-4ca2-83ea-ac697334a6c9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6dadc3ec-88f5-48c7-885b-f9f0d4e94ae2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65161a-001e-001f-25e6-64eb66000000", + "Body" : "jtcacquireleaseminjtcacquireleasemin0containerapitestacquireleasemin6515802401Fri, 06 Sep 2019 19:07:50 GMT\"0x8D732FD82E453E3\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "6dadc3ec-88f5-48c7-885b-f9f0d4e94ae2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleasemin6515802401?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cda8899d-eea7-456b-b1d7-d458fd0673f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82E453E3\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651632-001e-001f-3ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "cda8899d-eea7-456b-b1d7-d458fd0673f2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleasemin6515802401?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" : "481cb7f6-c8a4-475c-85c7-15ad1cc11438" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65164d-001e-001f-54e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:49 GMT", + "x-ms-client-request-id" : "481cb7f6-c8a4-475c-85c7-15ad1cc11438" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleasemin0containerapitestacquireleasemin6515802401" ] +} \ 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..8d424b414f46 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleasef56921756a74c47?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" : "5dcd5884-880e-4209-aa94-d0954d5177e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD902FCB16\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6555cb-001e-001f-0fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "5dcd5884-880e-4209-aa94-d0954d5177e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleasef56921756a74c47?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0867baac-d45a-4ea5-9d71-c87f39178b35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD902FCB16\"", + "x-ms-lease-id" : "0c4ad377-8d75-42c5-b3a1-fe51c3f32637", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6555e0-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "0867baac-d45a-4ea5-9d71-c87f39178b35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleasef56921756a74c47?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2ce641ae-25ac-466f-9979-283902d00b61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD902FCB16\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6555f3-001e-001f-33e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "2ce641ae-25ac-466f-9979-283902d00b61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleasef56921756a74c47?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" : "c5ef64b3-6c7d-4f13-8d09-d072e8d7b44c" + }, + "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" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD902FCB16\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec65560a-001e-001f-46e6-64eb66000000", + "x-ms-client-request-id" : "c5ef64b3-6c7d-4f13-8d09-d072e8d7b44c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bdde77e9-3822-4c4d-9958-bb11cfe2c7e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655620-001e-001f-58e6-64eb66000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreakleasef56921756a74c47Fri, 06 Sep 2019 19:08:12 GMT\"0x8D732FD902FCB16\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-client-request-id" : "bdde77e9-3822-4c4d-9958-bb11cfe2c7e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleasef56921756a74c47?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" : "d5080bfc-449c-44ec-a118-56ca751fb02c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655638-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-client-request-id" : "d5080bfc-449c-44ec-a118-56ca751fb02c" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreakleasef56921756a74c47", "0c4ad377-8d75-42c5-b3a1-fe51c3f32637" ] +} \ 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..d2ceb9a4bbd4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseb0a41448ba85226?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" : "3f6c78c6-4ce9-4f5d-b5a8-f390957d60b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD90536137\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65564c-001e-001f-7ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-client-request-id" : "3f6c78c6-4ce9-4f5d-b5a8-f390957d60b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseb0a41448ba85226?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8916ce34-5fb3-45e8-a6c8-8e9025497961" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD90536137\"", + "x-ms-lease-id" : "d2ed233e-ce3f-4d4d-b2f9-6cc267b60f85", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655672-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-client-request-id" : "8916ce34-5fb3-45e8-a6c8-8e9025497961" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseb0a41448ba85226?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e49ca2c9-7d54-4beb-ad42-f57134e4d071" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD90536137\"", + "x-ms-lease-time" : "20", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65568e-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-client-request-id" : "e49ca2c9-7d54-4beb-ad42-f57134e4d071" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseb0a41448ba85226?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" : "57939d1e-2b56-498b-88ba-33ea138b4282" + }, + "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" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:12 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD90536137\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec6556b2-001e-001f-52e6-64eb66000000", + "x-ms-client-request-id" : "57939d1e-2b56-498b-88ba-33ea138b4282" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d5bd8469-7fb7-49d5-afef-f12c4e73b645" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6587eb-001e-001f-3ae6-64eb66000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreakleaseb0a41448ba85226Fri, 06 Sep 2019 19:08:12 GMT\"0x8D732FD90536137\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:32 GMT", + "x-ms-client-request-id" : "d5bd8469-7fb7-49d5-afef-f12c4e73b645", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseb0a41448ba85226?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" : "b1dfc259-d1bf-4df9-bf22-6bb558c26828" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6587fc-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:32 GMT", + "x-ms-client-request-id" : "b1dfc259-d1bf-4df9-bf22-6bb558c26828" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreakleaseb0a41448ba85226", "d2ed233e-ce3f-4d4d-b2f9-6cc267b60f85" ] +} \ 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..afcc5f301a2c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease69a2767045e57ca?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" : "e7c622b2-969e-4cf9-ae03-cc0f8a44602c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD9C61782B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65882e-001e-001f-77e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:32 GMT", + "x-ms-client-request-id" : "e7c622b2-969e-4cf9-ae03-cc0f8a44602c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease69a2767045e57ca?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "11069a3e-107d-445d-90f3-20a4581a3a1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD9C61782B\"", + "x-ms-lease-id" : "a312bf11-70db-4811-a44e-8aa5ce119333", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65885b-001e-001f-1de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:32 GMT", + "x-ms-client-request-id" : "11069a3e-107d-445d-90f3-20a4581a3a1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease69a2767045e57ca?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0b934d1c-016d-4425-8a07-fcaa9cf66bf9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD9C61782B\"", + "x-ms-lease-time" : "15", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec658879-001e-001f-37e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:32 GMT", + "x-ms-client-request-id" : "0b934d1c-016d-4425-8a07-fcaa9cf66bf9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease69a2767045e57ca?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" : "c85d19ed-772c-44c2-98b4-168150fc43e6" + }, + "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" : "Fri, 06 Sep 2019 19:08:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:32 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD9C61782B\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec658899-001e-001f-51e6-64eb66000000", + "x-ms-client-request-id" : "c85d19ed-772c-44c2-98b4-168150fc43e6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a3b213a0-0ad6-41fd-95f1-b68a0af18e3a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65acbb-001e-001f-3de6-64eb66000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreaklease69a2767045e57caFri, 06 Sep 2019 19:08:32 GMT\"0x8D732FD9C61782B\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "a3b213a0-0ad6-41fd-95f1-b68a0af18e3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease69a2767045e57ca?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" : "9f79e087-0569-462c-bd95-a912f2c337db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65acc6-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "9f79e087-0569-462c-bd95-a912f2c337db" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreaklease69a2767045e57ca", "a312bf11-70db-4811-a44e-8aa5ce119333" ] +} \ 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..19b4b91679e7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacd0360646ef5ef?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" : "2aba12a7-d9ab-412e-b82c-29ba9877a3a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA59E03B3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ad7e-001e-001f-6ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "2aba12a7-d9ab-412e-b82c-29ba9877a3a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacd0360646ef5ef?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bb4f7d6b-57e6-402e-b92c-67b46885c23a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA59E03B3\"", + "x-ms-lease-id" : "05551ba8-19b2-4597-8ad7-6388d79ab40a", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ad97-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "bb4f7d6b-57e6-402e-b92c-67b46885c23a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacd0360646ef5ef?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "308ce29c-a4fb-475e-8ed7-95279b5ebd72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA59E03B3\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65adae-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "308ce29c-a4fb-475e-8ed7-95279b5ebd72" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "58476328-62b0-42b1-bc2c-15a1965a5754" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65adca-001e-001f-2ae6-64eb66000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseacd0360646ef5efFri, 06 Sep 2019 19:08:48 GMT\"0x8D732FDA59E03B3\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "58476328-62b0-42b1-bc2c-15a1965a5754", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacd0360646ef5ef?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" : "77d15509-1b83-4ef9-8b11-3a5743bb8c65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ade4-001e-001f-3fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "77d15509-1b83-4ef9-8b11-3a5743bb8c65" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseacd0360646ef5ef" ] +} \ 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..03861b69ed92 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac1f039314e1a84?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" : "94a9ca60-112c-47c6-884e-76e9a356f2d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5BA451D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65adf9-001e-001f-53e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "94a9ca60-112c-47c6-884e-76e9a356f2d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac1f039314e1a84?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e2879ad7-a7ed-41ae-85e7-c7a8fe23520e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5BA451D\"", + "x-ms-lease-id" : "8d59de78-d0ef-491a-8cca-2fa018ff9c75", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ae10-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "e2879ad7-a7ed-41ae-85e7-c7a8fe23520e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac1f039314e1a84?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8561964f-6867-4128-aa8a-63b383faedb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5BA451D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ae20-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "8561964f-6867-4128-aa8a-63b383faedb7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7b4dfdbf-132e-409c-a126-09ca824705db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ae3d-001e-001f-10e6-64eb66000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseac1f039314e1a84Fri, 06 Sep 2019 19:08:48 GMT\"0x8D732FDA5BA451D\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "7b4dfdbf-132e-409c-a126-09ca824705db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac1f039314e1a84?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" : "51c6f21d-4a12-4cd5-b623-83c9aa4d9a0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ae5a-001e-001f-29e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "51c6f21d-4a12-4cd5-b623-83c9aa4d9a0d" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseac1f039314e1a84" ] +} \ 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..2586be78da31 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac85c6019527141?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" : "0509eed7-4e9e-414c-a7ed-c2645cf80c85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5DA09D8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ae81-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "0509eed7-4e9e-414c-a7ed-c2645cf80c85" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac85c6019527141?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a74b843f-67e2-4b7d-9cb1-77d906896723" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5DA09D8\"", + "x-ms-lease-id" : "cf5f92d9-1338-4043-9cf0-3b55079d75ec", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ae9e-001e-001f-63e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "a74b843f-67e2-4b7d-9cb1-77d906896723" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac85c6019527141?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b4eaba08-e86e-4f49-a08d-a9abc4386f94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5DA09D8\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65aeb4-001e-001f-77e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "b4eaba08-e86e-4f49-a08d-a9abc4386f94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "064990e6-6788-453c-98ea-72e83283fea3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65aed0-001e-001f-10e6-64eb66000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseac85c6019527141Fri, 06 Sep 2019 19:08:48 GMT\"0x8D732FDA5DA09D8\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "064990e6-6788-453c-98ea-72e83283fea3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac85c6019527141?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" : "1a30c34d-3631-4cea-9e47-014749dfb92b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65aede-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "1a30c34d-3631-4cea-9e47-014749dfb92b" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseac85c6019527141" ] +} \ 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..5f7431990cef --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468?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" : "1ddd9480-20ea-4a14-a04a-597d4b55348c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5F5FD00\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65aef7-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "1ddd9480-20ea-4a14-a04a-597d4b55348c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9c2e6fdb-6e48-4fcb-b408-73a1ba12b762" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5F5FD00\"", + "x-ms-lease-id" : "2a6b90e4-43ac-4247-b636-d130c6fe2aee", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65af06-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "9c2e6fdb-6e48-4fcb-b408-73a1ba12b762" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5d5cb6c1-7190-4e37-88d6-b5aa3ae261c9" + }, + "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" : "ec65af16-001e-001f-4fe6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65af16-001e-001f-4fe6-64eb66000000\nTime:2019-09-06T19:08:48.9411631Z", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "5d5cb6c1-7190-4e37-88d6-b5aa3ae261c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d1166295-c8a8-4203-885b-609bfae04ca3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65af25-001e-001f-5de6-64eb66000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468Fri, 06 Sep 2019 19:08:48 GMT\"0x8D732FDA5F5FD00\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "d1166295-c8a8-4203-885b-609bfae04ca3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d411012b-0120-4796-8e64-94d0c0add0bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5F5FD00\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65af3b-001e-001f-72e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "d411012b-0120-4796-8e64-94d0c0add0bf" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468?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" : "6463f988-7060-41f3-8d3b-3aaa9e756f3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65af52-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "6463f988-7060-41f3-8d3b-3aaa9e756f3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0containerapitestbreakleaseacfaileec372468" ] +} \ 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..85f6a88db5b1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224?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" : "ee3737cf-a976-47d4-bb75-ac10b0babfd6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA619BA4C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65af79-001e-001f-2ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "ee3737cf-a976-47d4-bb75-ac10b0babfd6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6b66bd45-befc-43c5-9c7f-0c5f3746af41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA619BA4C\"", + "x-ms-lease-id" : "3679d2d3-06e9-47b9-b75c-835fb5eece64", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65afd5-001e-001f-7de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "6b66bd45-befc-43c5-9c7f-0c5f3746af41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d30289a8-141b-4ee2-8e4a-b31af06a40e9" + }, + "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" : "ec65afef-001e-001f-14e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65afef-001e-001f-14e6-64eb66000000\nTime:2019-09-06T19:08:49.2664705Z", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "d30289a8-141b-4ee2-8e4a-b31af06a40e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e08c1be0-325b-4971-a6ba-b0782e8b71e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b005-001e-001f-26e6-64eb66000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224Fri, 06 Sep 2019 19:08:49 GMT\"0x8D732FDA619BA4C\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "e08c1be0-325b-4971-a6ba-b0782e8b71e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "45733d81-f921-4072-a20c-4a32caaa083f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA619BA4C\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b024-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "45733d81-f921-4072-a20c-4a32caaa083f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224?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" : "40df2352-4e45-4d18-a9d8-7255cfc062ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b03c-001e-001f-59e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "40df2352-4e45-4d18-a9d8-7255cfc062ff" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0containerapitestbreakleaseacfail3a1821224" ] +} \ 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..c54ecdb78e0c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal090774171c5d282d78481f9?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" : "b0ade637-8479-4353-9e9e-a5e71befd1d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA64BFA00\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b071-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "b0ade637-8479-4353-9e9e-a5e71befd1d8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "63f8f861-16d0-454b-8f20-bf9ef78bd473" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b094-001e-001f-27e6-64eb66000000", + "Body" : "jtcbreakleaseacillegaljtcbreakleaseacillegal090774171c5d282d78481f9Fri, 06 Sep 2019 19:08:49 GMT\"0x8D732FDA64BFA00\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:48 GMT", + "x-ms-client-request-id" : "63f8f861-16d0-454b-8f20-bf9ef78bd473", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal090774171c5d282d78481f9?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" : "342c574c-a780-464c-abc6-88e3321c705f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b0b3-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "342c574c-a780-464c-abc6-88e3321c705f" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacillegal090774171c5d282d78481f9" ] +} \ 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..6c6e3dd060ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal031599a6611eeb006643cca?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" : "765f13ef-ab40-4559-b9a0-9ffe5d2ce3da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA660E6A4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b0db-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "765f13ef-ab40-4559-b9a0-9ffe5d2ce3da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "47c4ce98-b9d7-42a1-bda5-59caa17c0df1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b0f0-001e-001f-74e6-64eb66000000", + "Body" : "jtcbreakleaseacillegaljtcbreakleaseacillegal031599a6611eeb006643ccaFri, 06 Sep 2019 19:08:49 GMT\"0x8D732FDA660E6A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "47c4ce98-b9d7-42a1-bda5-59caa17c0df1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal031599a6611eeb006643cca?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" : "75809f1b-73bd-414f-bd8d-0de9132cb6f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b109-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "75809f1b-73bd-414f-bd8d-0de9132cb6f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacillegal031599a6611eeb006643cca" ] +} \ 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..4ec7b3b83338 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0containerapitestbreakleaseerror17f91585c6?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" : "92f34d24-d598-4916-bf93-d8017ef0b608" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6731381\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b12a-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "92f34d24-d598-4916-bf93-d8017ef0b608" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror1containerapitestbreakleaseerror17f8536253?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "858305fc-0e7b-4113-8b5d-fbbb9cb3be23" + }, + "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" : "ec65b13f-001e-001f-37e6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec65b13f-001e-001f-37e6-64eb66000000\nTime:2019-09-06T19:08:49.7339129Z", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "858305fc-0e7b-4113-8b5d-fbbb9cb3be23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d26c980e-ec0b-457d-b07b-95a38c42f340" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b14f-001e-001f-45e6-64eb66000000", + "Body" : "jtcbreakleaseerrorjtcbreakleaseerror0containerapitestbreakleaseerror17f91585c6Fri, 06 Sep 2019 19:08:49 GMT\"0x8D732FDA6731381\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "d26c980e-ec0b-457d-b07b-95a38c42f340", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0containerapitestbreakleaseerror17f91585c6?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" : "ee270915-a23d-452f-a024-de48e0c24d10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b15b-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "ee270915-a23d-452f-a024-de48e0c24d10" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseerror0containerapitestbreakleaseerror17f91585c6", "jtcbreakleaseerror1containerapitestbreakleaseerror17f8536253" ] +} \ 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..e522d3c39d77 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin785575744d04?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" : "d8a7a054-80e4-4e56-b523-0121e454f395" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5808983\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65acdf-001e-001f-5de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "d8a7a054-80e4-4e56-b523-0121e454f395" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin785575744d04?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5684957a-f5f8-4b90-aa71-1750704d991c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5808983\"", + "x-ms-lease-id" : "d23020b8-a0ee-4174-bbf7-e85b014eb183", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ad1d-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "5684957a-f5f8-4b90-aa71-1750704d991c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin785575744d04?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f920aa5d-3855-4090-bee6-ef773706ea64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA5808983\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ad2f-001e-001f-24e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "f920aa5d-3855-4090-bee6-ef773706ea64" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d6b53668-100a-44cd-87f0-0f2bab51e9d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ad3c-001e-001f-2fe6-64eb66000000", + "Body" : "jtcbreakleaseminjtcbreakleasemin0containerapitestbreakleasemin785575744d04Fri, 06 Sep 2019 19:08:48 GMT\"0x8D732FDA5808983\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "d6b53668-100a-44cd-87f0-0f2bab51e9d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin785575744d04?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" : "7899657c-ce98-4305-95c9-a3adfd79e9e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ad56-001e-001f-46e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:47 GMT", + "x-ms-client-request-id" : "7899657c-ce98-4305-95c9-a3adfd79e9e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleasemin0containerapitestbreakleasemin785575744d04" ] +} \ 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..c2ad2101825a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleased3c07986db2003?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" : "95bae61f-fce2-472e-bd18-28af156573ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6903F84\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b17b-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "95bae61f-fce2-472e-bd18-28af156573ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleased3c07986db2003?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c1f4be88-bdc4-4b74-ac90-9aa30d6c79d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6903F84\"", + "x-ms-lease-id" : "29f068fa-99f5-4704-a909-62a0a1be3e06", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b1a7-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "c1f4be88-bdc4-4b74-ac90-9aa30d6c79d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleased3c07986db2003?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a0703925-5632-4d95-89ee-7f9c67bd7856" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6903F84\"", + "x-ms-lease-id" : "125c8e24-6363-42d5-abdc-38e5bb7517da", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b1c4-001e-001f-31e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "a0703925-5632-4d95-89ee-7f9c67bd7856" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleased3c07986db2003?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d3d8fc2d-1887-4e84-b572-79d9328671d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6903F84\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b1ed-001e-001f-55e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "d3d8fc2d-1887-4e84-b572-79d9328671d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6e398343-1b47-4660-8e49-c1014cc12b20" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b204-001e-001f-69e6-64eb66000000", + "Body" : "jtcchangeleasejtcchangelease0containerapitestchangeleased3c07986db2003Fri, 06 Sep 2019 19:08:49 GMT\"0x8D732FDA6903F84\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "6e398343-1b47-4660-8e49-c1014cc12b20", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleased3c07986db2003?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" : "c3b818c9-babe-4bed-9ba8-1c641403bf37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b213-001e-001f-77e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "c3b818c9-babe-4bed-9ba8-1c641403bf37" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangelease0containerapitestchangeleased3c07986db2003", "125c8e24-6363-42d5-abdc-38e5bb7517da" ] +} \ 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..b8f72b82d27d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacdf7540916ffd?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" : "e9587d90-17fc-42f8-9781-55ac11b5ab83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6DE726A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b32b-001e-001f-71e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "e9587d90-17fc-42f8-9781-55ac11b5ab83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacdf7540916ffd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fd391fbb-bfd8-44cf-9f3d-9ba031feb771" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6DE726A\"", + "x-ms-lease-id" : "be33261c-e13e-48d8-80d8-3d8dc2b4b7bb", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b352-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "fd391fbb-bfd8-44cf-9f3d-9ba031feb771" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacdf7540916ffd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e3446489-368d-413f-9abf-63e735c190e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6DE726A\"", + "x-ms-lease-id" : "61fe8847-e072-41f3-9d8a-9e29e53e3d28", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b36a-001e-001f-2be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "e3446489-368d-413f-9abf-63e735c190e8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c36eb5d7-11c4-4d10-9f2a-fa5371c1b636" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b37c-001e-001f-3ce6-64eb66000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseacdf7540916ffdFri, 06 Sep 2019 19:08:50 GMT\"0x8D732FDA6DE726A\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "c36eb5d7-11c4-4d10-9f2a-fa5371c1b636", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacdf7540916ffd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "715f94b9-6864-41c4-9711-23aec7943ecd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6DE726A\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b390-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "715f94b9-6864-41c4-9711-23aec7943ecd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacdf7540916ffd?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" : "5a53e668-01c8-4d10-a900-4f784ee44f5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b3a3-001e-001f-5be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "5a53e668-01c8-4d10-a900-4f784ee44f5a" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseacdf7540916ffd", "61fe8847-e072-41f3-9d8a-9e29e53e3d28" ] +} \ 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..df357a1f060e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf2521673065c?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" : "704451d1-4443-4af8-877f-c8619aea82c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA700CFCE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b3c7-001e-001f-7ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "704451d1-4443-4af8-877f-c8619aea82c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf2521673065c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "99bc3216-28aa-4399-9450-f578d098d6be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA700CFCE\"", + "x-ms-lease-id" : "5bad9fc4-136e-40df-95b8-c7dcbad19775", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b3e3-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "99bc3216-28aa-4399-9450-f578d098d6be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf2521673065c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6df7869d-e5e1-4ff3-b32e-410f9c055281" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA700CFCE\"", + "x-ms-lease-id" : "6c0aee76-4149-4b1e-bc63-b3881eb515f4", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b409-001e-001f-35e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "6df7869d-e5e1-4ff3-b32e-410f9c055281" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0d7a0f50-c830-4b26-97e9-491402a86dd8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b422-001e-001f-4ae6-64eb66000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseacf2521673065cFri, 06 Sep 2019 19:08:50 GMT\"0x8D732FDA700CFCE\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "0d7a0f50-c830-4b26-97e9-491402a86dd8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf2521673065c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "879e58ae-facb-4087-b49b-0ca1a877bba5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA700CFCE\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b434-001e-001f-59e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "879e58ae-facb-4087-b49b-0ca1a877bba5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf2521673065c?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" : "728ec750-2303-4696-94e4-295bb71f4923" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b448-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "728ec750-2303-4696-94e4-295bb71f4923" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseacf2521673065c", "6c0aee76-4149-4b1e-bc63-b3881eb515f4" ] +} \ 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..667c0606e2a8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac5be5217291a4?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" : "23069814-1046-4c2e-8241-270b7030ea5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7237B61\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b46d-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "23069814-1046-4c2e-8241-270b7030ea5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac5be5217291a4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d79d579d-efd7-4db4-b425-7d2aaf738164" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7237B61\"", + "x-ms-lease-id" : "bcf05c07-8462-47cd-9c37-3f535514c47c", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b488-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "d79d579d-efd7-4db4-b425-7d2aaf738164" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac5be5217291a4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1b067382-5028-46c8-9ca6-663a0a913099" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7237B61\"", + "x-ms-lease-id" : "11aa8b32-ee94-4fdd-ab53-5c6e7c7e9d40", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b49a-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "1b067382-5028-46c8-9ca6-663a0a913099" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bd461977-7877-4d16-8c98-067ecc38446e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b4b0-001e-001f-41e6-64eb66000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseac5be5217291a4Fri, 06 Sep 2019 19:08:50 GMT\"0x8D732FDA7237B61\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "bd461977-7877-4d16-8c98-067ecc38446e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac5be5217291a4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fe576f32-241b-4601-bbc2-c733cfc64cc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7237B61\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b4d1-001e-001f-5ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "fe576f32-241b-4601-bbc2-c733cfc64cc1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac5be5217291a4?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" : "ab3bb577-a34c-40c9-bf03-3026a541c74f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b4ec-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "ab3bb577-a34c-40c9-bf03-3026a541c74f" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseac5be5217291a4", "11aa8b32-ee94-4fdd-ab53-5c6e7c7e9d40" ] +} \ 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..d1a92335fa83 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254?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" : "d2e6323d-bf5e-4c07-8cea-1288564936fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7482341\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b513-001e-001f-1ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "d2e6323d-bf5e-4c07-8cea-1288564936fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9861ac4b-f320-476f-b969-e27a0dbd9ff9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7482341\"", + "x-ms-lease-id" : "e30bb6cf-8ca4-4299-a568-b39a7dc0b72f", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b536-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "9861ac4b-f320-476f-b969-e27a0dbd9ff9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c1c1e58-f6fa-4b30-8322-c95feca86640" + }, + "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" : "ec65b554-001e-001f-52e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65b554-001e-001f-52e6-64eb66000000\nTime:2019-09-06T19:08:51.1572587Z", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "1c1c1e58-f6fa-4b30-8322-c95feca86640", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6e233b43-b07a-4b4c-8794-605618b8ea3f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b56f-001e-001f-6ae6-64eb66000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254Fri, 06 Sep 2019 19:08:51 GMT\"0x8D732FDA7482341\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "6e233b43-b07a-4b4c-8794-605618b8ea3f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c750913f-0b90-42f1-8316-b5d317ad1fdb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7482341\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b588-001e-001f-01e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "c750913f-0b90-42f1-8316-b5d317ad1fdb" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254?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" : "720af495-7c1a-4949-ab11-f44b26fb9515" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b5a1-001e-001f-19e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "720af495-7c1a-4949-ab11-f44b26fb9515" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0containerapitestchangeleaseacfail10b47254", "2d412a91-c4d2-41a4-a757-24f50bc5fd4c" ] +} \ 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..e9f087dc18ed --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471?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" : "54ab5124-45f8-4e50-b40a-302f08a9b43d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA76920C2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b5c7-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "54ab5124-45f8-4e50-b40a-302f08a9b43d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "05873be4-c062-4508-a55b-63b42cb9f807" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA76920C2\"", + "x-ms-lease-id" : "9b17b39e-6719-46c0-a8a8-b50ec2d95c06", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b5de-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "05873be4-c062-4508-a55b-63b42cb9f807" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "85b7ef6f-2963-4897-84ec-e89f6dd552eb" + }, + "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" : "ec65b5fa-001e-001f-69e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65b5fa-001e-001f-69e6-64eb66000000\nTime:2019-09-06T19:08:51.3724620Z", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "85b7ef6f-2963-4897-84ec-e89f6dd552eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "14b7c994-a3ac-4298-b1a2-14252577f646" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b61c-001e-001f-06e6-64eb66000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471Fri, 06 Sep 2019 19:08:51 GMT\"0x8D732FDA76920C2\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "14b7c994-a3ac-4298-b1a2-14252577f646", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bbb9bd5b-c25e-487b-9adc-efce2dcb34fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA76920C2\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b63e-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:50 GMT", + "x-ms-client-request-id" : "bbb9bd5b-c25e-487b-9adc-efce2dcb34fa" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471?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" : "5df4242b-ec8b-41cc-8130-c0c679af2844" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b652-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "5df4242b-ec8b-41cc-8130-c0c679af2844" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0containerapitestchangeleaseacfaila0a51471", "70b63f5b-ea1b-4f63-8188-9cfca525098e" ] +} \ 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..64d1950b2cb2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal078976f18c94262d2046cd9?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" : "99448903-0b3d-481d-92ac-2731a1018191" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA79432D0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b686-001e-001f-5fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "99448903-0b3d-481d-92ac-2731a1018191" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a3829dd6-c49b-4f64-a8da-a819243b0be9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b6c5-001e-001f-16e6-64eb66000000", + "Body" : "jtcchangeleaseacillegaljtcchangeleaseacillegal078976f18c94262d2046cd9Fri, 06 Sep 2019 19:08:51 GMT\"0x8D732FDA79432D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "a3829dd6-c49b-4f64-a8da-a819243b0be9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal078976f18c94262d2046cd9?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" : "502604bd-4e00-4305-b18d-6c9085b4a013" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b6df-001e-001f-2ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "502604bd-4e00-4305-b18d-6c9085b4a013" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacillegal078976f18c94262d2046cd9" ] +} \ 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..b0236c1497f8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal026425ede278c1087945c2a?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" : "e6154770-d434-4460-840a-8df47ba800a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7A6116D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b6ff-001e-001f-48e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "e6154770-d434-4460-840a-8df47ba800a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3334e51e-467e-4722-b855-085a4a4ec109" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b726-001e-001f-6ce6-64eb66000000", + "Body" : "jtcchangeleaseacillegaljtcchangeleaseacillegal026425ede278c1087945c2aFri, 06 Sep 2019 19:08:51 GMT\"0x8D732FDA7A6116D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "3334e51e-467e-4722-b855-085a4a4ec109", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal026425ede278c1087945c2a?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" : "b934b421-ad7c-4b68-a270-0e7c85a32169" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b73e-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "b934b421-ad7c-4b68-a270-0e7c85a32169" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacillegal026425ede278c1087945c2a" ] +} \ 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..18cd761b1850 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0containerapitestchangeleaseerror24753087e?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" : "8a7f6dc5-7a67-4169-9093-7b67097cf241" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7B641F5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b756-001e-001f-18e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "8a7f6dc5-7a67-4169-9093-7b67097cf241" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror1containerapitestchangeleaseerror247256642?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8a822745-373c-4f5e-91bd-c1ad3f404dfe" + }, + "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" : "ec65b77a-001e-001f-34e6-64eb66000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ec65b77a-001e-001f-34e6-64eb66000000\nTime:2019-09-06T19:08:51.8389026Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "8a822745-373c-4f5e-91bd-c1ad3f404dfe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1bde16a2-3dd2-4790-8006-fa9093eafcb3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b78f-001e-001f-46e6-64eb66000000", + "Body" : "jtcchangeleaseerrorjtcchangeleaseerror0containerapitestchangeleaseerror24753087eFri, 06 Sep 2019 19:08:51 GMT\"0x8D732FDA7B641F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "1bde16a2-3dd2-4790-8006-fa9093eafcb3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0containerapitestchangeleaseerror24753087e?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" : "88950051-8972-46a0-a8a1-dbffd7f00a23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b7a3-001e-001f-57e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "88950051-8972-46a0-a8a1-dbffd7f00a23" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseerror0containerapitestchangeleaseerror24753087e", "jtcchangeleaseerror1containerapitestchangeleaseerror247256642" ] +} \ 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..1212710507fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin6c4305427fd?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" : "23d1ad67-1e63-4742-9f13-163d6633fa81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6B7F553\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b254-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "23d1ad67-1e63-4742-9f13-163d6633fa81" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin6c4305427fd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e7d37e92-3c62-48ab-b3c4-1ced9e148dbd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6B7F553\"", + "x-ms-lease-id" : "6c0d5b06-9436-4c07-a2b1-cd365ae3f386", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b283-001e-001f-5fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "e7d37e92-3c62-48ab-b3c4-1ced9e148dbd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin6c4305427fd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "62e8d71e-8e49-49e4-a443-45ec6651ea6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6B7F553\"", + "x-ms-lease-id" : "63b63101-4b18-44d0-8a2e-c9cdf35984ee", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b29e-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "62e8d71e-8e49-49e4-a443-45ec6651ea6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "114eead6-8a1f-4ed7-9602-594fca407b27" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b2bb-001e-001f-11e6-64eb66000000", + "Body" : "jtcchangeleaseminjtcchangeleasemin0containerapitestchangeleasemin6c4305427fdFri, 06 Sep 2019 19:08:50 GMT\"0x8D732FDA6B7F553\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "114eead6-8a1f-4ed7-9602-594fca407b27", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin6c4305427fd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "44199f84-82ed-4b59-a2a6-8d914c382e03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA6B7F553\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b2de-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "44199f84-82ed-4b59-a2a6-8d914c382e03" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin6c4305427fd?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" : "7604d503-7ded-4fc0-85fb-4a6f3c95a381" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b2fd-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:49 GMT", + "x-ms-client-request-id" : "7604d503-7ded-4fc0-85fb-4a6f3c95a381" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleasemin0containerapitestchangeleasemin6c4305427fd", "63b63101-4b18-44d0-8a2e-c9cdf35984ee" ] +} \ 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..3c9e00907db3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0containerapitestcreateallnullfa8884695daf?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" : "d95f1aa8-5897-41f5-8bc0-64c87d309155" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD228EDF00\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec635f30-001e-001f-11e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "d95f1aa8-5897-41f5-8bc0-64c87d309155" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull1containerapitestcreateallnullfa8307517099?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" : "9082af89-c52a-40ed-a433-6b0fafe9437b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2296F744\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec635f5c-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "9082af89-c52a-40ed-a433-6b0fafe9437b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7dc08497-d9d1-4774-844a-97e5150451c1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec635f90-001e-001f-5ee6-64eb66000000", + "Body" : "jtccreateallnulljtccreateallnull0containerapitestcreateallnullfa8884695dafFri, 06 Sep 2019 19:05:08 GMT\"0x8D732FD228EDF00\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreateallnull1containerapitestcreateallnullfa8307517099Fri, 06 Sep 2019 19:05:08 GMT\"0x8D732FD2296F744\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "7dc08497-d9d1-4774-844a-97e5150451c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0containerapitestcreateallnullfa8884695daf?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" : "60ab5c72-ce4b-4872-a2b7-ece2bbb11995" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636006-001e-001f-41e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "60ab5c72-ce4b-4872-a2b7-ece2bbb11995" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull1containerapitestcreateallnullfa8307517099?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" : "ec1e36e3-123c-4470-969d-15577b14d50f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636027-001e-001f-5be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "ec1e36e3-123c-4470-969d-15577b14d50f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateallnull0containerapitestcreateallnullfa8884695daf", "jtccreateallnull1containerapitestcreateallnullfa8307517099" ] +} \ 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..4437ddf7dfef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0containerapitestcreateerror8c533207759ae0?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" : "996a405f-b60f-4358-b19a-10cfa3c47a84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD23C64A94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63654f-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "996a405f-b60f-4358-b19a-10cfa3c47a84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0containerapitestcreateerror8c533207759ae0?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" : "6df38398-4c57-4e64-91d6-eb93dd742c04" + }, + "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" : "ec636573-001e-001f-46e6-64eb66000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:ec636573-001e-001f-46e6-64eb66000000\nTime:2019-09-06T19:05:10.4877330Z", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "6df38398-4c57-4e64-91d6-eb93dd742c04", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "178c7bf8-68cf-4592-bcd7-2a18d67e465d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636589-001e-001f-5ae6-64eb66000000", + "Body" : "jtccreateerrorjtccreateerror0containerapitestcreateerror8c533207759ae0Fri, 06 Sep 2019 19:05:10 GMT\"0x8D732FD23C64A94\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "178c7bf8-68cf-4592-bcd7-2a18d67e465d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0containerapitestcreateerror8c533207759ae0?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" : "53c65b68-af03-44bd-b8a9-9908c5b34825" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63659e-001e-001f-6de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "53c65b68-af03-44bd-b8a9-9908c5b34825" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0containerapitestcreateerror8c533207759ae0" ] +} \ 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..9d949f13f909 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadata1e584545701?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" : "a0b8e72b-8912-42e3-8caa-d7a53cb34920" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD22F7A515\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63612e-001e-001f-28e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "a0b8e72b-8912-42e3-8caa-d7a53cb34920" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata1e5762880bf?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" : "eaf5c2dc-8afd-4856-b35b-d3b8d9ae37c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD22FE0F40\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63617b-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "eaf5c2dc-8afd-4856-b35b-d3b8d9ae37c7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata1e5762880bf?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" : "8824d14b-c6f5-4d0e-9f23-90715cbcca3b" + }, + "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" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD22FE0F40\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec636199-001e-001f-01e6-64eb66000000", + "x-ms-client-request-id" : "8824d14b-c6f5-4d0e-9f23-90715cbcca3b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b01b511b-006a-45df-804e-6c2fec1254a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6361b1-001e-001f-14e6-64eb66000000", + "Body" : "jtccreatemetadatajtccreatemetadata0containerapitestcreatemetadata1e584545701Fri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD22F7A515\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemetadata1containerapitestcreatemetadata1e5762880bfFri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD22FE0F40\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "b01b511b-006a-45df-804e-6c2fec1254a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadata1e584545701?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" : "58436ef9-680e-4a21-9167-d0b3e2860405" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6361c8-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "58436ef9-680e-4a21-9167-d0b3e2860405" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata1e5762880bf?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" : "7c132029-5844-45f9-8d2a-c9010a1108b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6361e2-001e-001f-3fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "7c132029-5844-45f9-8d2a-c9010a1108b4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0containerapitestcreatemetadata1e584545701", "jtccreatemetadata1containerapitestcreatemetadata1e5762880bf" ] +} \ 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..7e0d1ef49c38 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadatabd4703268b0?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" : "6f4d53d9-e1fd-48ad-be5f-a1d319f69cf4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD23193EEE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63620b-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "6f4d53d9-e1fd-48ad-be5f-a1d319f69cf4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatabd454136337?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" : "aa0dbc47-016a-4fe2-8cee-5a1f102065ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD232268E2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636230-001e-001f-04e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "aa0dbc47-016a-4fe2-8cee-5a1f102065ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatabd454136337?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" : "8ef7b2c0-4fc7-413f-8621-2da63419414d" + }, + "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" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD232268E2\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec63625c-001e-001f-28e6-64eb66000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "8ef7b2c0-4fc7-413f-8621-2da63419414d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "03028345-b9cf-491c-8b2c-297e8628225a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636277-001e-001f-40e6-64eb66000000", + "Body" : "jtccreatemetadatajtccreatemetadata0containerapitestcreatemetadatabd4703268b0Fri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD23193EEE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemetadata1containerapitestcreatemetadatabd454136337Fri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD232268E2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "03028345-b9cf-491c-8b2c-297e8628225a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadatabd4703268b0?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" : "17201680-2251-4984-a15f-d661fd1518f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63628a-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "17201680-2251-4984-a15f-d661fd1518f1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatabd454136337?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" : "2b53632a-66a7-437a-a297-38ce04c4ed45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6362a4-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "2b53632a-66a7-437a-a297-38ce04c4ed45" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0containerapitestcreatemetadatabd4703268b0", "jtccreatemetadata1containerapitestcreatemetadatabd454136337" ] +} \ 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..7231e392f614 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0containerapitestcreateminbd7771910960b96b?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" : "2ba899f9-5bfb-46cf-91b6-e6ee715c842b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD22C42CAB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636052-001e-001f-7ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "2ba899f9-5bfb-46cf-91b6-e6ee715c842b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin1containerapitestcreateminbd78143240d7ffea?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" : "3eb63481-79d9-4cc8-a640-3555102c5e03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD22D14F34\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63606d-001e-001f-16e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "3eb63481-79d9-4cc8-a640-3555102c5e03" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin1containerapitestcreateminbd78143240d7ffea?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" : "ed8483b8-7b51-448f-ad62-77b8703bd5d3" + }, + "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" : "Fri, 06 Sep 2019 19:05:08 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD22D14F34\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec6360ba-001e-001f-50e6-64eb66000000", + "x-ms-client-request-id" : "ed8483b8-7b51-448f-ad62-77b8703bd5d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c408a84-8919-4043-bb17-a7a8b7a831f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6360e3-001e-001f-6ae6-64eb66000000", + "Body" : "jtccreateminjtccreatemin0containerapitestcreateminbd7771910960b96bFri, 06 Sep 2019 19:05:08 GMT\"0x8D732FD22C42CAB\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemin1containerapitestcreateminbd78143240d7ffeaFri, 06 Sep 2019 19:05:08 GMT\"0x8D732FD22D14F34\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "7c408a84-8919-4043-bb17-a7a8b7a831f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0containerapitestcreateminbd7771910960b96b?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" : "7dae5b9b-7d0d-4d52-a26e-5ecf3839a118" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6360f5-001e-001f-79e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "7dae5b9b-7d0d-4d52-a26e-5ecf3839a118" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin1containerapitestcreateminbd78143240d7ffea?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" : "32d27050-f863-45cc-8275-f4e0e5c9b2fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63610f-001e-001f-0de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:08 GMT", + "x-ms-client-request-id" : "32d27050-f863-45cc-8275-f4e0e5c9b2fd" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0containerapitestcreateminbd7771910960b96b", "jtccreatemin1containerapitestcreateminbd78143240d7ffea" ] +} \ 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..4256d8bd4755 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess042699317bb6b303984ac6aa?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" : "e0326442-1f59-4cd7-947d-a0b397d97c40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD233DBFAE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6362ce-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "e0326442-1f59-4cd7-947d-a0b397d97c40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess11911807eae62c93b4483092?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" : "8fb227bc-0f48-4eca-a41e-07e71db0fb3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD234A1EB1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6362e8-001e-001f-1de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "8fb227bc-0f48-4eca-a41e-07e71db0fb3c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess11911807eae62c93b4483092?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" : "93ac5ac8-69b8-46e8-a5ef-23c8d0dc3bc1" + }, + "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" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD234A1EB1\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "ec636317-001e-001f-42e6-64eb66000000", + "x-ms-client-request-id" : "93ac5ac8-69b8-46e8-a5ef-23c8d0dc3bc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4114cd72-7b86-4a18-bf4a-d32bee41dcc2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636332-001e-001f-58e6-64eb66000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess042699317bb6b303984ac6aaFri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD233DBFAE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess11911807eae62c93b4483092Fri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD234A1EB1\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "4114cd72-7b86-4a18-bf4a-d32bee41dcc2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess042699317bb6b303984ac6aa?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" : "b2d68442-ec93-45d6-87eb-e788c0481e2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636342-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "b2d68442-ec93-45d6-87eb-e788c0481e2e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess11911807eae62c93b4483092?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" : "714b3116-7f25-4c77-afb2-cfe7a5745420" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636360-001e-001f-7fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "714b3116-7f25-4c77-afb2-cfe7a5745420" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess042699317bb6b303984ac6aa", "jtccreatepublicaccess11911807eae62c93b4483092" ] +} \ 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..569371ee5040 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess0721281068bcf6a18e4bebb2?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" : "75148307-a8ad-433a-ad14-497dc16743e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2366AE4E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636388-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "75148307-a8ad-433a-ad14-497dc16743e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess135063722d087c156f48f8aa?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" : "aa0751c7-71df-409d-a936-64de7df70852" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD237074B5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63639f-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "aa0751c7-71df-409d-a936-64de7df70852" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess135063722d087c156f48f8aa?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" : "ea4244d3-74d9-4ae4-8fef-a46f702a5758" + }, + "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" : "Fri, 06 Sep 2019 19:05:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD237074B5\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "ec6363cd-001e-001f-5be6-64eb66000000", + "x-ms-client-request-id" : "ea4244d3-74d9-4ae4-8fef-a46f702a5758" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "81ddd6cf-57a5-4682-a0b5-c4160feef41b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6363de-001e-001f-6ce6-64eb66000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess0721281068bcf6a18e4bebb2Fri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD2366AE4E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess135063722d087c156f48f8aaFri, 06 Sep 2019 19:05:09 GMT\"0x8D732FD237074B5\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "81ddd6cf-57a5-4682-a0b5-c4160feef41b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess0721281068bcf6a18e4bebb2?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" : "002dd72b-40bc-4fef-a6e9-130649787af7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6363f2-001e-001f-7de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "002dd72b-40bc-4fef-a6e9-130649787af7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess135063722d087c156f48f8aa?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" : "5b89754a-d714-44ae-a59d-ae7ad32874f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636405-001e-001f-0ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "5b89754a-d714-44ae-a59d-ae7ad32874f6" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess0721281068bcf6a18e4bebb2", "jtccreatepublicaccess135063722d087c156f48f8aa" ] +} \ 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..9b57b64a81dd --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess0010116bda3de80320482384?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" : "97bdb4ec-3e80-44e6-9a67-5f55ad026d3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2393958D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63644a-001e-001f-42e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:09 GMT", + "x-ms-client-request-id" : "97bdb4ec-3e80-44e6-9a67-5f55ad026d3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess183486976b331903fd4084b1?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" : "80cd7d80-5ebd-434d-85aa-20dcf38aaf37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD23A042D1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636465-001e-001f-59e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "80cd7d80-5ebd-434d-85aa-20dcf38aaf37" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess183486976b331903fd4084b1?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" : "86926cc7-cd94-4b6f-8fd8-44ac9671873f" + }, + "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" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD23A042D1\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec6364be-001e-001f-28e6-64eb66000000", + "x-ms-client-request-id" : "86926cc7-cd94-4b6f-8fd8-44ac9671873f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6cf99a58-385d-456b-9c97-2191dbc7b612" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6364d5-001e-001f-3ce6-64eb66000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess0010116bda3de80320482384Fri, 06 Sep 2019 19:05:10 GMT\"0x8D732FD2393958D\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess183486976b331903fd4084b1Fri, 06 Sep 2019 19:05:10 GMT\"0x8D732FD23A042D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "6cf99a58-385d-456b-9c97-2191dbc7b612", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess0010116bda3de80320482384?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" : "b0637490-d7f3-4068-9996-8a0d0e070186" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636504-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "b0637490-d7f3-4068-9996-8a0d0e070186" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess183486976b331903fd4084b1?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" : "66422f78-39c5-45fb-bc3a-36b06bea1485" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636524-001e-001f-02e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "66422f78-39c5-45fb-bc3a-36b06bea1485" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess0010116bda3de80320482384", "jtccreatepublicaccess183486976b331903fd4084b1" ] +} \ 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..69465c3094c5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee?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" : "2f73d9c9-3003-4b79-b112-b50c919cd246" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7CAE061\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b7c5-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "2f73d9c9-3003-4b79-b112-b50c919cd246" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee/az[]", + "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" : "941a1000-0791-4815-a91d-4bef2628ac9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7D11258\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b7e1-001e-001f-0fe6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "941a1000-0791-4815-a91d-4bef2628ac9d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee/az[]", + "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" : "d3a5a359-f08d-4e3d-9e5c-f50f2334ecfa" + }, + "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" : "Fri, 06 Sep 2019 19:08:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:51 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" : "\"0x8D732FDA7D11258\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:08:51 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ec65b7f7-001e-001f-23e6-64eb66000000", + "x-ms-client-request-id" : "d3a5a359-f08d-4e3d-9e5c-f50f2334ecfa", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee/az[]2", + "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" : "c6876b6b-baf8-493e-8175-469a71a14a38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA7DBC342\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b809-001e-001f-32e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "c6876b6b-baf8-493e-8175-469a71a14a38" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee/az[]3", + "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" : "4f79db92-cd69-4753-97d9-6bf3041f8f2b", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA7E7D41B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65b84c-001e-001f-71e6-64eb66000000", + "x-ms-client-request-id" : "4f79db92-cd69-4753-97d9-6bf3041f8f2b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5685e8e9-f757-4ba6-8f6e-8cee71faf3e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b873-001e-001f-13e6-64eb66000000", + "Body" : "az[]Fri, 06 Sep 2019 19:08:51 GMTFri, 06 Sep 2019 19:08:51 GMT0x8D732FDA7D112580application/octet-streamAppendBlobHottrueunlockedavailabletrue0az[]2Fri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA7DBC342512application/octet-stream0PageBlobHottrueunlockedavailabletrue0az[]3Fri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA7E7D41B7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "5685e8e9-f757-4ba6-8f6e-8cee71faf3e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7a931079-334c-4555-8223-144ab180142d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b898-001e-001f-33e6-64eb66000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars05347248e3aed670724feeFri, 06 Sep 2019 19:08:51 GMT\"0x8D732FDA7CAE061\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "7a931079-334c-4555-8223-144ab180142d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars05347248e3aed670724fee?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" : "8aa159d4-cccd-4eb8-81d1-b2284f3c80d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b8a9-001e-001f-42e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "8aa159d4-cccd-4eb8-81d1-b2284f3c80d5" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars05347248e3aed670724fee" ] +} \ 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..259892b66eb4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99?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" : "3bac5d73-c89b-48a8-90b4-d36cf98e2f98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA802515F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b8c8-001e-001f-5ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "3bac5d73-c89b-48a8-90b4-d36cf98e2f98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99/hello/world", + "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" : "9cb2fef7-8dff-4477-9138-a63e78a892c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA8080DE6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b8ec-001e-001f-7de6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "9cb2fef7-8dff-4477-9138-a63e78a892c3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99/hello/world", + "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" : "9bbb44f4-1844-4bc7-9d25-eec2f6f9a896" + }, + "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" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:51 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" : "\"0x8D732FDA8080DE6\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:08:52 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ec65b90f-001e-001f-1ee6-64eb66000000", + "x-ms-client-request-id" : "9bbb44f4-1844-4bc7-9d25-eec2f6f9a896", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99/hello/world2", + "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" : "de131d6f-1325-4803-b598-69e62a47a3ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA8161B01\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b929-001e-001f-35e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:51 GMT", + "x-ms-client-request-id" : "de131d6f-1325-4803-b598-69e62a47a3ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99/hello/world3", + "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" : "8f29ba92-837b-46fa-aa9d-936664d64f61", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA81E3340\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65b943-001e-001f-4de6-64eb66000000", + "x-ms-client-request-id" : "8f29ba92-837b-46fa-aa9d-936664d64f61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "74960946-095d-4459-98c1-ae5e6a5c0ed1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b95e-001e-001f-65e6-64eb66000000", + "Body" : "hello/worldFri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA8080DE60application/octet-streamAppendBlobHottrueunlockedavailabletrue0hello/world2Fri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA8161B01512application/octet-stream0PageBlobHottrueunlockedavailabletrue0hello/world3Fri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA81E33407application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "74960946-095d-4459-98c1-ae5e6a5c0ed1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ef7f95c7-ee27-4ae4-b4cb-6e781dd96df3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65b989-001e-001f-0ae6-64eb66000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars083419fa4f07998b6b4d99Fri, 06 Sep 2019 19:08:52 GMT\"0x8D732FDA802515F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "ef7f95c7-ee27-4ae4-b4cb-6e781dd96df3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083419fa4f07998b6b4d99?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" : "217000aa-7bff-4c00-94a0-1571a025f515" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65b9ae-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "217000aa-7bff-4c00-94a0-1571a025f515" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars083419fa4f07998b6b4d99" ] +} \ 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..c36acf70300f --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a?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" : "9083b8e9-5e9c-4ef6-8ce5-6e0b4427ade3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA83D6CC8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65b9d6-001e-001f-3fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "9083b8e9-5e9c-4ef6-8ce5-6e0b4427ade3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a/hello&world", + "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" : "d71f3291-24db-4776-86fa-41d8edac1689" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA8448916\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ba1e-001e-001f-73e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "d71f3291-24db-4776-86fa-41d8edac1689" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a/hello&world", + "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" : "861054ec-10e7-401d-80be-3d07a341c036" + }, + "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" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08: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" : "\"0x8D732FDA8448916\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:08:52 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ec65ba3b-001e-001f-06e6-64eb66000000", + "x-ms-client-request-id" : "861054ec-10e7-401d-80be-3d07a341c036", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a/hello&world2", + "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" : "eee23a48-766f-458a-927d-29717df54a1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA84F39F2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ba50-001e-001f-17e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "eee23a48-766f-458a-927d-29717df54a1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a/hello&world3", + "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" : "60b22b4a-3c67-4a3f-b7e4-48240ae4e1cc", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA85507AE\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65ba6f-001e-001f-2fe6-64eb66000000", + "x-ms-client-request-id" : "60b22b4a-3c67-4a3f-b7e4-48240ae4e1cc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9da8dab5-2bc2-4f06-aff8-794b522a156d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ba89-001e-001f-40e6-64eb66000000", + "Body" : "hello&worldFri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA84489160application/octet-streamAppendBlobHottrueunlockedavailabletrue0hello&world2Fri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA84F39F2512application/octet-stream0PageBlobHottrueunlockedavailabletrue0hello&world3Fri, 06 Sep 2019 19:08:52 GMTFri, 06 Sep 2019 19:08:52 GMT0x8D732FDA85507AE7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "9da8dab5-2bc2-4f06-aff8-794b522a156d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7e573ff4-333d-43b0-9ac0-7463f67a2e89" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bab2-001e-001f-5de6-64eb66000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars0841797e1570d061174a4aFri, 06 Sep 2019 19:08:52 GMT\"0x8D732FDA83D6CC8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "7e573ff4-333d-43b0-9ac0-7463f67a2e89", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars0841797e1570d061174a4a?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" : "86d8906f-4d63-4b24-9f7a-17e50b21228a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65bac1-001e-001f-69e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "86d8906f-4d63-4b24-9f7a-17e50b21228a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars0841797e1570d061174a4a" ] +} \ 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..94a02d528ae4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0containerapitestdeletec4a02978de57cc68286?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" : "c9af3f1d-8b84-46f4-b0fe-b3b106c9b5e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD290F0A6C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637cd8-001e-001f-1fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "c9af3f1d-8b84-46f4-b0fe-b3b106c9b5e1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0containerapitestdeletec4a02978de57cc68286?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" : "206a4cef-4dd3-499a-8609-a73916c32238" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637d18-001e-001f-56e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "206a4cef-4dd3-499a-8609-a73916c32238" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "652907a0-11b2-45f5-9126-4923a8a2303e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637d4c-001e-001f-07e6-64eb66000000", + "Body" : "jtcdelete", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "652907a0-11b2-45f5-9126-4923a8a2303e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdelete0containerapitestdeletec4a02978de57cc68286" ] +} \ 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..66a3088a5b37 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac1875183745e671505?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" : "d7d4d7a4-6971-4613-836b-dbccd708bc12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD293931E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637de3-001e-001f-0fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "d7d4d7a4-6971-4613-836b-dbccd708bc12" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac1875183745e671505?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" : "33f59af3-0906-45a9-a31c-b44c4053faba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637e0a-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "33f59af3-0906-45a9-a31c-b44c4053faba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc7ccd03-b25d-4573-b3d8-50b0151641db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637e23-001e-001f-49e6-64eb66000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "bc7ccd03-b25d-4573-b3d8-50b0151641db", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac1875183745e671505" ] +} \ 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..646b00c4ade9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacbdf9483463434708e?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" : "1a87ffce-d0d0-4d90-903d-331d0206c3db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2950690E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637e51-001e-001f-75e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "1a87ffce-d0d0-4d90-903d-331d0206c3db" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacbdf9483463434708e?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" : "e5fc3a7a-7edf-4280-850b-95a1e63382b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637e84-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "e5fc3a7a-7edf-4280-850b-95a1e63382b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "98e83386-9e7f-4ce7-a82a-f3a71b9ff208" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637ea2-001e-001f-3fe6-64eb66000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "98e83386-9e7f-4ce7-a82a-f3a71b9ff208", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteacbdf9483463434708e" ] +} \ 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..941bb11153a7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac6ff13307329e8e8c6?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" : "73dbb28c-2ecb-4589-9cf3-7a2e07eb523b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2960998B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637eb7-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "73dbb28c-2ecb-4589-9cf3-7a2e07eb523b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac6ff13307329e8e8c6?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" : "9d044015-b335-4251-8419-87e794b8008b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637ed3-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "9d044015-b335-4251-8419-87e794b8008b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "757ba0f0-fd61-4a94-a026-3a3fc36904f4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637ef1-001e-001f-07e6-64eb66000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "757ba0f0-fd61-4a94-a026-3a3fc36904f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac6ff13307329e8e8c6" ] +} \ 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..713693b6166c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac26f52473b4a01c0d2?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" : "d6044742-aded-445f-b81e-1e8711560385" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2970A304\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637f13-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "d6044742-aded-445f-b81e-1e8711560385" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac26f52473b4a01c0d2?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "431867db-b640-4e55-ae1b-3c6eb930b04b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2970A304\"", + "x-ms-lease-id" : "70e9b014-cc33-4591-839b-0eb8b8b6c587", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637f25-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "431867db-b640-4e55-ae1b-3c6eb930b04b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac26f52473b4a01c0d2?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" : "56a13bc8-4eba-40d7-a6a8-ecc072405612" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637f36-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "56a13bc8-4eba-40d7-a6a8-ecc072405612" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "23ff2704-54c3-40d1-bb04-a1d10516b470" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637f5c-001e-001f-62e6-64eb66000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "23ff2704-54c3-40d1-bb04-a1d10516b470", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac26f52473b4a01c0d2" ] +} \ 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..4387581ab502 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail6a7861972eee0?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" : "6660dd60-5311-4a8a-8bd0-6ee3c921db03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD298DF619\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637f80-001e-001f-02e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "6660dd60-5311-4a8a-8bd0-6ee3c921db03" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail6a7861972eee0?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" : "4a4d6790-016e-4d5e-a320-78e4b8b6bebc" + }, + "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" : "ec637f9d-001e-001f-1ee6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec637f9d-001e-001f-1ee6-64eb66000000\nTime:2019-09-06T19:05:20.1909045Z", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "4a4d6790-016e-4d5e-a320-78e4b8b6bebc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cd477abb-9e07-4d10-a908-1eda15f374cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637fb1-001e-001f-32e6-64eb66000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail6a7861972eee0Fri, 06 Sep 2019 19:05:20 GMT\"0x8D732FD298DF619\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "cd477abb-9e07-4d10-a908-1eda15f374cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail6a7861972eee0?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" : "3f61a29b-a395-4a06-86fd-d1e30defa9c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637fd4-001e-001f-4fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "3f61a29b-a395-4a06-86fd-d1e30defa9c7" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail6a7861972eee0" ] +} \ 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..ae871cb0b271 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfaile9f71217f384d?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" : "e801b69f-b1db-4964-9e4c-5c6cdf6fb1cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD29A50621\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637ff5-001e-001f-6de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "e801b69f-b1db-4964-9e4c-5c6cdf6fb1cd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfaile9f71217f384d?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" : "f8994399-2e79-4525-a1f1-3ce4b6db2195" + }, + "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" : "ec638023-001e-001f-18e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec638023-001e-001f-18e6-64eb66000000\nTime:2019-09-06T19:05:20.3510550Z", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "f8994399-2e79-4525-a1f1-3ce4b6db2195", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6edd6655-f64a-413e-ade0-c0ecf897fd50" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63803c-001e-001f-2ee6-64eb66000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfaile9f71217f384dFri, 06 Sep 2019 19:05:20 GMT\"0x8D732FD29A50621\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "6edd6655-f64a-413e-ade0-c0ecf897fd50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfaile9f71217f384d?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" : "67faf1b5-82af-48d7-b64a-e2ab2bab0eb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63804c-001e-001f-3de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "67faf1b5-82af-48d7-b64a-e2ab2bab0eb7" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfaile9f71217f384d" ] +} \ 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..fdf79c95beea --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail1c83772088333?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" : "2d6a7cfa-f710-42c5-946a-b288789c36f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD29BD4EF5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638064-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "2d6a7cfa-f710-42c5-946a-b288789c36f3" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail1c83772088333?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" : "f4182149-6e30-4bae-b599-28d6cbbb5398" + }, + "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" : "ec638168-001e-001f-37e6-64eb66000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:ec638168-001e-001f-37e6-64eb66000000\nTime:2019-09-06T19:05:20.8565338Z", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "f4182149-6e30-4bae-b599-28d6cbbb5398", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6fbca716-610f-45ff-b2ac-1e1781fb6ffb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec638181-001e-001f-4ee6-64eb66000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail1c83772088333Fri, 06 Sep 2019 19:05:20 GMT\"0x8D732FD29BD4EF5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "6fbca716-610f-45ff-b2ac-1e1781fb6ffb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail1c83772088333?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" : "f1e5fdf9-7c70-4716-b37f-cf174b8f0ac4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec638198-001e-001f-63e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "f1e5fdf9-7c70-4716-b37f-cf174b8f0ac4" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail1c83772088333" ] +} \ 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..33973ba33230 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegal39f26484be?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" : "5f017813-d47f-44f4-96ff-a117b2a28ca7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A0F7A88\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6381c2-001e-001f-0ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "5f017813-d47f-44f4-96ff-a117b2a28ca7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d08469dc-86a3-4d95-9912-3be446c33f0e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6381d9-001e-001f-1fe6-64eb66000000", + "Body" : "jtcdeleteacillegaljtcdeleteacillegal0containerapitestdeleteacillegal39f26484beFri, 06 Sep 2019 19:05:20 GMT\"0x8D732FD2A0F7A88\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "d08469dc-86a3-4d95-9912-3be446c33f0e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegal39f26484be?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" : "ce918314-3667-4181-837c-573feee384b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6381f6-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "ce918314-3667-4181-837c-573feee384b5" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacillegal0containerapitestdeleteacillegal39f26484be" ] +} \ 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..7eba9492bb9d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegala2583551b7?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" : "1753f208-03fb-409d-a249-369d45a4446f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A21CE66\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63821f-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "1753f208-03fb-409d-a249-369d45a4446f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f3d6aca-a8fe-49d4-8a69-ac24821255ff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec638239-001e-001f-79e6-64eb66000000", + "Body" : "jtcdeleteacillegaljtcdeleteacillegal0containerapitestdeleteacillegala2583551b7Fri, 06 Sep 2019 19:05:21 GMT\"0x8D732FD2A21CE66\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "8f3d6aca-a8fe-49d4-8a69-ac24821255ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegala2583551b7?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" : "70227775-1748-4e61-a831-ca5ad1351212" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec638257-001e-001f-15e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:20 GMT", + "x-ms-client-request-id" : "70227775-1748-4e61-a831-ca5ad1351212" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacillegal0containerapitestdeleteacillegala2583551b7" ] +} \ 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..ecad51e5cda2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteerror0containerapitestdeleteerror44d42645ff3d25?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" : "6d779deb-5ee3-4ce4-b18d-4b48ff3617d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A31B0BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638275-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "6d779deb-5ee3-4ce4-b18d-4b48ff3617d8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteerror1containerapitestdeleteerror44d356858bffc0?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" : "73bdde49-5559-4e17-a745-2222eab95f6a" + }, + "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" : "ec638289-001e-001f-42e6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec638289-001e-001f-42e6-64eb66000000\nTime:2019-09-06T19:05:21.2599146Z", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "73bdde49-5559-4e17-a745-2222eab95f6a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cfe24329-697c-4fbe-b4a6-db5b7b271e98" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6382a3-001e-001f-58e6-64eb66000000", + "Body" : "jtcdeleteerrorjtcdeleteerror0containerapitestdeleteerror44d42645ff3d25Fri, 06 Sep 2019 19:05:21 GMT\"0x8D732FD2A31B0BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "cfe24329-697c-4fbe-b4a6-db5b7b271e98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteerror0containerapitestdeleteerror44d42645ff3d25?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" : "635c2bba-f794-4c24-8688-f7885703e52b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6382c0-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "635c2bba-f794-4c24-8688-f7885703e52b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteerror0containerapitestdeleteerror44d42645ff3d25", "jtcdeleteerror1containerapitestdeleteerror44d356858bffc0" ] +} \ 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..f679911f3f9a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0containerapitestdeletemin5710712544b2f90d?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" : "34f22b18-ac5d-4c6d-86c6-237b50f8daa4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD292221DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637d75-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "34f22b18-ac5d-4c6d-86c6-237b50f8daa4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0containerapitestdeletemin5710712544b2f90d?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" : "1b7d1179-45d3-4240-803e-23aea58bce5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637d96-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "1b7d1179-45d3-4240-803e-23aea58bce5a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0containerapitestdeletemin5710712544b2f90d?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" : "08e66237-1c61-4ed0-8fbe-cb6ebe330f03" + }, + "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" : "ec637dac-001e-001f-5fe6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec637dac-001e-001f-5fe6-64eb66000000\nTime:2019-09-06T19:05:19.5112609Z", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "08e66237-1c61-4ed0-8fbe-cb6ebe330f03", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ba769f71-4c3c-406c-b46f-dfe66f7646d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637dba-001e-001f-6be6-64eb66000000", + "Body" : "jtcdeletemin", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "ba769f71-4c3c-406c-b46f-dfe66f7646d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeletemin0containerapitestdeletemin5710712544b2f90d" ] +} \ 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..ac050a89dcb7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy52096091d7?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" : "7672201e-6ec6-4466-aab4-fc0dc0d44aac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD288C262D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637a6c-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "7672201e-6ec6-4466-aab4-fc0dc0d44aac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy52096091d7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4abeb67c-a1d9-4498-9909-cb8beadf4c1a", + "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" : "\"0x8D732FD28946364\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637a9d-001e-001f-15e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "4abeb67c-a1d9-4498-9909-cb8beadf4c1a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy52096091d7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "84aeee0d-ca75-4571-9aa0-adceb7b3a0f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "ETag" : "\"0x8D732FD28946364\"", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "ec637ab5-001e-001f-2be6-64eb66000000", + "Body" : "00002019-09-06T19:05:18.0000000Z2019-09-07T19:05:18.0000000Zr", + "x-ms-client-request-id" : "84aeee0d-ca75-4571-9aa0-adceb7b3a0f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b795d172-c915-44bf-8c4e-0f2e80dd95bd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637ac7-001e-001f-3ce6-64eb66000000", + "Body" : "jtcgetaccesspolicyjtcgetaccesspolicy0containerapitestgetaccesspolicy52096091d7Fri, 06 Sep 2019 19:05:18 GMT\"0x8D732FD28946364\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "b795d172-c915-44bf-8c4e-0f2e80dd95bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy52096091d7?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" : "9e2130d5-4a43-499a-8129-01b0ed8c59d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637adf-001e-001f-53e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "9e2130d5-4a43-499a-8129-01b0ed8c59d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicy0containerapitestgetaccesspolicy52096091d7", "2019-09-06T19:05:18.504Z", "2019-09-06T19:05:18.504Z" ] +} \ 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..2afdf0d4a50d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyerror017683f6888b11d248460f8?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" : "a68e50b6-92f9-4ef7-865f-3575ee40661e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28EF1EA4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637c2e-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "a68e50b6-92f9-4ef7-865f-3575ee40661e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyerror138369e0fd5668da674c2d8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3541fad1-22bf-4422-8e69-d6d6c5f950b0" + }, + "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" : "ec637c78-001e-001f-48e6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec637c78-001e-001f-48e6-64eb66000000\nTime:2019-09-06T19:05:19.1569258Z", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "3541fad1-22bf-4422-8e69-d6d6c5f950b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7e28a521-9f44-493a-99e4-b5c466404dbd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637c94-001e-001f-62e6-64eb66000000", + "Body" : "jtcgetaccesspolicyerrorjtcgetaccesspolicyerror017683f6888b11d248460f8Fri, 06 Sep 2019 19:05:19 GMT\"0x8D732FD28EF1EA4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "7e28a521-9f44-493a-99e4-b5c466404dbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyerror017683f6888b11d248460f8?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" : "b3e0a62c-4db2-4af5-926d-2532d08f0f74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637ca9-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:19 GMT", + "x-ms-client-request-id" : "b3e0a62c-4db2-4af5-926d-2532d08f0f74" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicyerror017683f6888b11d248460f8", "jtcgetaccesspolicyerror138369e0fd5668da674c2d8" ] +} \ 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..18fbf78ac7d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease045265cbbfce44111349799?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" : "b8bb9611-a6dd-41cf-a952-01d5f5a7fba2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28A9EE95\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637af8-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "b8bb9611-a6dd-41cf-a952-01d5f5a7fba2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease045265cbbfce44111349799?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0fde77a2-18e8-4c57-ba81-86f1eb903c95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28A9EE95\"", + "x-ms-lease-id" : "434f5f97-dd65-4bac-a948-638bc50ea031", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637b35-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "0fde77a2-18e8-4c57-ba81-86f1eb903c95" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease045265cbbfce44111349799?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b3e62661-753c-48fa-b533-11cfdacbc2de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28A9EE95\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637b50-001e-001f-3be6-64eb66000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "b3e62661-753c-48fa-b533-11cfdacbc2de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a4d67fc7-7a0b-40ab-9b82-9479693e33c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637b75-001e-001f-5fe6-64eb66000000", + "Body" : "jtcgetaccesspolicyleasejtcgetaccesspolicylease045265cbbfce44111349799Fri, 06 Sep 2019 19:05:18 GMT\"0x8D732FD28A9EE95\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "a4d67fc7-7a0b-40ab-9b82-9479693e33c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease045265cbbfce44111349799?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "67a0e81c-03c0-486c-b92b-7fdb2df0a70d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28A9EE95\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637b8a-001e-001f-70e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "67a0e81c-03c0-486c-b92b-7fdb2df0a70d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease045265cbbfce44111349799?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" : "8e449484-507a-4552-8778-5d97a451693c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637b9c-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "8e449484-507a-4552-8778-5d97a451693c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicylease045265cbbfce44111349799" ] +} \ 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..70a33633c170 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyleasefail012881f6d64a6fac7e4e8?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" : "06ec690d-9676-49f6-99f5-f629283344c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28D28F07\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637bbc-001e-001f-1de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "06ec690d-9676-49f6-99f5-f629283344c5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyleasefail012881f6d64a6fac7e4e8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6ce86ffc-c1b2-4ca0-bf16-88a3bfcf067a" + }, + "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" : "ec637bda-001e-001f-38e6-64eb66000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:ec637bda-001e-001f-38e6-64eb66000000\nTime:2019-09-06T19:05:18.9597395Z", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "6ce86ffc-c1b2-4ca0-bf16-88a3bfcf067a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "28030dc5-c8aa-4234-9273-e1ba1e6ec82b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637bf6-001e-001f-53e6-64eb66000000", + "Body" : "jtcgetaccesspolicyleasefailjtcgetaccesspolicyleasefail012881f6d64a6fac7e4e8Fri, 06 Sep 2019 19:05:18 GMT\"0x8D732FD28D28F07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "28030dc5-c8aa-4234-9273-e1ba1e6ec82b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyleasefail012881f6d64a6fac7e4e8?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" : "73a3e929-893c-4228-bfb3-493a77ab7138" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637c10-001e-001f-6ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "73a3e929-893c-4228-bfb3-493a77ab7138" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicyleasefail012881f6d64a6fac7e4e8" ] +} \ 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..cf94433d65b7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0containerapitestgetaccountinfo4623112513d?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" : "3b4e8ad7-3b0c-402e-af04-f6f7a90056d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA8FB4573\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65bdce-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "3b4e8ad7-3b0c-402e-af04-f6f7a90056d1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ee64200c-8d17-4ad4-a5fc-c985471bc9d5" + }, + "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" : "ec65bde0-001e-001f-5de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "ee64200c-8d17-4ad4-a5fc-c985471bc9d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b55fd9e2-8f8a-470e-b561-94a8bbdb5bc6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bdf1-001e-001f-6ce6-64eb66000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0containerapitestgetaccountinfo4623112513dFri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA8FB4573\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "b55fd9e2-8f8a-470e-b561-94a8bbdb5bc6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0containerapitestgetaccountinfo4623112513d?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" : "5580bbb6-01a1-4b05-b0c0-5a4216d3a598" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65be07-001e-001f-7fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "5580bbb6-01a1-4b05-b0c0-5a4216d3a598" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0containerapitestgetaccountinfo4623112513d" ] +} \ 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..2628dec5cd9a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror097552c63c9b0e0e4a4d729?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" : "8d170751-285b-472b-9516-eeacf610e917" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA926F3E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65be9e-001e-001f-79e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "8d170751-285b-472b-9516-eeacf610e917" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror1055441823a419afb74fc5b?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4dde2055-c2a3-43f9-96b0-ee329b8a3e85" + }, + "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" : "ec65beb4-001e-001f-0ae6-64eb66000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:ec65beb4-001e-001f-0ae6-64eb66000000\nTime:2019-09-06T19:08:54.2571839Z", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "4dde2055-c2a3-43f9-96b0-ee329b8a3e85", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c1a8fc36-74f4-430c-906b-5e1c57afd68a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bec6-001e-001f-1ae6-64eb66000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror097552c63c9b0e0e4a4d729Fri, 06 Sep 2019 19:08:54 GMT\"0x8D732FDA926F3E6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "c1a8fc36-74f4-430c-906b-5e1c57afd68a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror097552c63c9b0e0e4a4d729?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" : "0edc1e3a-fe6d-42d9-8db9-8dd7e5bd0ad0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65bed4-001e-001f-28e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "0edc1e3a-fe6d-42d9-8db9-8dd7e5bd0ad0" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror097552c63c9b0e0e4a4d729", "jtcgetaccountinfoerror1055441823a419afb74fc5b" ] +} \ 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..be2c8a6a0436 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0containerapitestgetaccountinfominc9f44361?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" : "cc8e707b-58e0-413b-893b-1cc832661e4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA91318EE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65be47-001e-001f-31e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "cc8e707b-58e0-413b-893b-1cc832661e4d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7d742389-9f56-4187-b976-b3d69504f718" + }, + "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" : "ec65be5b-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "7d742389-9f56-4187-b976-b3d69504f718" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "abc04599-aa1a-4d19-98af-1cd80b33ad44" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65be6a-001e-001f-4be6-64eb66000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0containerapitestgetaccountinfominc9f44361Fri, 06 Sep 2019 19:08:54 GMT\"0x8D732FDA91318EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "abc04599-aa1a-4d19-98af-1cd80b33ad44", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0containerapitestgetaccountinfominc9f44361?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" : "b1dca109-da9f-4afc-9502-4c73d2ed63f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65be80-001e-001f-5fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "b1dca109-da9f-4afc-9502-4c73d2ed63f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0containerapitestgetaccountinfominc9f44361" ] +} \ 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..6c227ae00800 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror052410e3cde092ebbc41f2bd?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" : "b165f877-bda4-4d58-808f-2bdfca4afd4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2449F25A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6367b7-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "b165f877-bda4-4d58-808f-2bdfca4afd4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror169114dc394207c9b04cf581?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" : "e03c8721-72e8-430a-9529-418692acae9b" + }, + "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" : "ec6367db-001e-001f-5ce6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec6367db-001e-001f-5ce6-64eb66000000\nTime:2019-09-06T19:05:11.3535517Z", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "e03c8721-72e8-430a-9529-418692acae9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "856dd262-694c-4f83-af4b-7dc472a29ddb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6367eb-001e-001f-6ae6-64eb66000000", + "Body" : "jtcgetpropertieserrorjtcgetpropertieserror052410e3cde092ebbc41f2bdFri, 06 Sep 2019 19:05:11 GMT\"0x8D732FD2449F25A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "856dd262-694c-4f83-af4b-7dc472a29ddb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror052410e3cde092ebbc41f2bd?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" : "fee308ae-120c-4a3f-8159-93fad5c53342" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6367fa-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "fee308ae-120c-4a3f-8159-93fad5c53342" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieserror052410e3cde092ebbc41f2bd", "jtcgetpropertieserror169114dc394207c9b04cf581" ] +} \ 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..1bd0c3d36e3d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease083397f5496755667d42e28c?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" : "af4acbd1-9ff9-4b34-b158-689c351000db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2409090B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6366a1-001e-001f-4fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "af4acbd1-9ff9-4b34-b158-689c351000db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease083397f5496755667d42e28c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "88d1af25-6e7e-432a-a76e-ff786f5f3ede" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2409090B\"", + "x-ms-lease-id" : "35c2f375-ba80-4eea-a186-de5ed590018f", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6366bd-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "88d1af25-6e7e-432a-a76e-ff786f5f3ede" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease083397f5496755667d42e28c?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" : "5d40f86b-4bcc-46cf-ad72-4427830b2b6a" + }, + "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" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD2409090B\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "ec6366d9-001e-001f-02e6-64eb66000000", + "x-ms-client-request-id" : "5d40f86b-4bcc-46cf-ad72-4427830b2b6a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cedb13c9-5108-4b42-a2a5-7e67b98fd4fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6366e4-001e-001f-0ce6-64eb66000000", + "Body" : "jtcgetpropertiesleasejtcgetpropertieslease083397f5496755667d42e28cFri, 06 Sep 2019 19:05:10 GMT\"0x8D732FD2409090B\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "cedb13c9-5108-4b42-a2a5-7e67b98fd4fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease083397f5496755667d42e28c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a432a8f1-f206-4826-b5a8-1b408f2253e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2409090B\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6366f6-001e-001f-1be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "a432a8f1-f206-4826-b5a8-1b408f2253e0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease083397f5496755667d42e28c?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" : "99b6671a-ff2e-4885-a4cb-3641e9439586" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63671f-001e-001f-3ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "99b6671a-ff2e-4885-a4cb-3641e9439586" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieslease083397f5496755667d42e28c" ] +} \ 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..04e1865134bd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesleasefail052045fa35a4c522df4400?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" : "16488e28-8caa-4aae-9f8c-b9bc2050fb14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD242FAD39\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636747-001e-001f-5ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "16488e28-8caa-4aae-9f8c-b9bc2050fb14" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesleasefail052045fa35a4c522df4400?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" : "dfa3df52-aa39-4714-88ae-7858ffae0fef" + }, + "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" : "ec636768-001e-001f-76e6-64eb66000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ec636768-001e-001f-76e6-64eb66000000\nTime:2019-09-06T19:05:11.1773860Zx-ms-lease-idgarbage", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "dfa3df52-aa39-4714-88ae-7858ffae0fef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d8524639-c3ab-4cb7-9868-b56ddbdc8e54" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63677d-001e-001f-09e6-64eb66000000", + "Body" : "jtcgetpropertiesleasefailjtcgetpropertiesleasefail052045fa35a4c522df4400Fri, 06 Sep 2019 19:05:11 GMT\"0x8D732FD242FAD39\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "d8524639-c3ab-4cb7-9868-b56ddbdc8e54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesleasefail052045fa35a4c522df4400?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" : "1d6eb6f2-2034-4a62-90a8-05714cf37d30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636797-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "1d6eb6f2-2034-4a62-90a8-05714cf37d30" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesleasefail052045fa35a4c522df4400" ] +} \ 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..2d805bf31d47 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json @@ -0,0 +1,92 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmin4a1327421?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" : "70509e6c-85f6-4de7-8f56-4162abe825ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD23F3800B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636636-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "70509e6c-85f6-4de7-8f56-4162abe825ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmin4a1327421?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" : "90a5650e-bd94-4bef-bde2-4d0debed9421" + }, + "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" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD23F3800B\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec636660-001e-001f-14e6-64eb66000000", + "x-ms-client-request-id" : "90a5650e-bd94-4bef-bde2-4d0debed9421" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "11f64776-b7a3-44bc-867d-dcf4fd1b628c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636677-001e-001f-28e6-64eb66000000", + "Body" : "jtcgetpropertiesminjtcgetpropertiesmin0containerapitestgetpropertiesmin4a1327421Fri, 06 Sep 2019 19:05:10 GMT\"0x8D732FD23F3800B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "11f64776-b7a3-44bc-867d-dcf4fd1b628c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmin4a1327421?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" : "b991a245-5693-46c6-ae9c-03400707e5f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63668a-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "b991a245-5693-46c6-ae9c-03400707e5f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesmin0containerapitestgetpropertiesmin4a1327421" ] +} \ 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..91eb8544097e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json @@ -0,0 +1,92 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnullbd068151?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" : "83e528aa-73be-44db-b1cb-08f9488833e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD23DB5E5D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6365c7-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "83e528aa-73be-44db-b1cb-08f9488833e1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnullbd068151?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" : "96f37d36-3c4f-4b31-a849-a6c2a3e03f6e" + }, + "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" : "Fri, 06 Sep 2019 19:05:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD23DB5E5D\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec6365e3-001e-001f-2ce6-64eb66000000", + "x-ms-client-request-id" : "96f37d36-3c4f-4b31-a849-a6c2a3e03f6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2f3c1049-19ea-478c-a29d-1d7983c39839" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6365f4-001e-001f-3de6-64eb66000000", + "Body" : "jtcgetpropertiesnulljtcgetpropertiesnull0containerapitestgetpropertiesnullbd068151Fri, 06 Sep 2019 19:05:10 GMT\"0x8D732FD23DB5E5D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "2f3c1049-19ea-478c-a29d-1d7983c39839", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnullbd068151?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" : "3d8fd4ea-86ec-472e-9377-a8726de19102" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63660f-001e-001f-54e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:10 GMT", + "x-ms-client-request-id" : "3d8fd4ea-86ec-472e-9377-a8726de19102" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesnull0containerapitestgetpropertiesnullbd068151" ] +} \ 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..795c9d70b549 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat70c69704d7cf?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" : "058783b2-ecc3-4238-9b8e-9360117d686b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A4712AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6382e1-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "058783b2-ecc3-4238-9b8e-9360117d686b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat70c69704d7cf/javabloblistblobsflat1containerapitestlistblobsflat70c57186ad", + "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" : "adba350e-e516-460e-a60f-147bb92e8337" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A4DCD8D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6382f8-001e-001f-26e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "adba350e-e516-460e-a60f-147bb92e8337" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat70c69704d7cf?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e15d1b36-7109-4105-9780-d73eef6e3f39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec638310-001e-001f-3be6-64eb66000000", + "Body" : "javabloblistblobsflat1containerapitestlistblobsflat70c57186adFri, 06 Sep 2019 19:05:21 GMTFri, 06 Sep 2019 19:05:21 GMT0x8D732FD2A4DCD8D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "e15d1b36-7109-4105-9780-d73eef6e3f39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1e8f7448-57ea-475d-a78c-ce30546e7297" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63832a-001e-001f-52e6-64eb66000000", + "Body" : "jtclistblobsflatjtclistblobsflat0containerapitestlistblobsflat70c69704d7cfFri, 06 Sep 2019 19:05:21 GMT\"0x8D732FD2A4712AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "1e8f7448-57ea-475d-a78c-ce30546e7297", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat70c69704d7cf?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" : "b305e14d-6518-48ab-b34b-e1627797fc94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63833d-001e-001f-63e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "b305e14d-6518-48ab-b34b-e1627797fc94" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflat0containerapitestlistblobsflat70c69704d7cf", "javabloblistblobsflat1containerapitestlistblobsflat70c57186ad" ] +} \ 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..c42f030a0f5a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflaterror087390f79752e501174cdd96?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" : "624df889-9c80-4f62-9033-7714263563f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD55CF86B0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2934-f01e-00ef-7fe6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "624df889-9c80-4f62-9033-7714263563f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflaterror17025313e415ce753446a181?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "64eac86c-3bf4-475a-a82f-829876c1c2d3" + }, + "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" : "adac296c-f01e-00ef-35e6-643b08000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:adac296c-f01e-00ef-35e6-643b08000000\nTime:2019-09-06T19:06:34.4783745Z", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "64eac86c-3bf4-475a-a82f-829876c1c2d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ab2523a6-1f4e-466e-98c1-9c7341d1937e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac299d-f01e-00ef-62e6-643b08000000", + "Body" : "jtclistblobsflaterrorjtclistblobsflaterror087390f79752e501174cdd96Fri, 06 Sep 2019 19:06:34 GMT\"0x8D732FD55CF86B0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "ab2523a6-1f4e-466e-98c1-9c7341d1937e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflaterror087390f79752e501174cdd96?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" : "cf1e306b-3fc9-4308-adde-417bff5063c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac29b9-f01e-00ef-7ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "cf1e306b-3fc9-4308-adde-417bff5063c0" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflaterror087390f79752e501174cdd96", "jtclistblobsflaterror17025313e415ce753446a181" ] +} \ 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..33c9e0b2cffd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json @@ -0,0 +1,390 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?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" : "71ee8d4b-2ba0-42b5-ae43-db8f35dffa41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD553171DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2604-f01e-00ef-09e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "71ee8d4b-2ba0-42b5-ae43-db8f35dffa41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker175321cd7343542a5c448", + "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" : "fedb9c00-9e6e-46cb-a8b6-b0be15a8c6f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD553757B0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2627-f01e-00ef-29e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "fedb9c00-9e6e-46cb-a8b6-b0be15a8c6f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker26389952281bf188174a7", + "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" : "b05493fa-306d-4db3-89f1-d9cabe1c56b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD553D9AB5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac264b-f01e-00ef-48e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "b05493fa-306d-4db3-89f1-d9cabe1c56b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker301459ede7258c4d3d4dc", + "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" : "2b30b8b7-7f20-4f3c-ac27-883ce4bba0da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD55478823\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2677-f01e-00ef-74e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "2b30b8b7-7f20-4f3c-ac27-883ce4bba0da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker4887062a0b41b33ca54ef", + "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" : "efb906cd-101e-4759-ac8e-771f887f5755" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD554D7CFB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac269b-f01e-00ef-18e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "efb906cd-101e-4759-ac8e-771f887f5755" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker5917377bb1b06a9ed64c9", + "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" : "5b7bf145-218d-4164-a24b-dcd12c484db2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD555371D8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac26b5-f01e-00ef-32e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "5b7bf145-218d-4164-a24b-dcd12c484db2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker62108026c4f0aa7f55455", + "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" : "53d48416-9a90-4539-9f52-9b98bbd711e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD55598DCB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac26d1-f01e-00ef-4de6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "53d48416-9a90-4539-9f52-9b98bbd711e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker72180865d31c863d7e4e1", + "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" : "c427517b-9ef3-4ee2-895b-ff9f1a96cc78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD555F82AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac26ed-f01e-00ef-66e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "c427517b-9ef3-4ee2-895b-ff9f1a96cc78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker8294913f4c0a448d714e3", + "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" : "b9f3ea01-ae01-4145-82c4-00eefd329ba8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD556613E9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac270d-f01e-00ef-03e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "b9f3ea01-ae01-4145-82c4-00eefd329ba8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker94439550ea047350b64d5", + "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" : "819ae34f-b2a8-40d5-b5f1-a968f17a3521" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD556D68B5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2730-f01e-00ef-24e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "819ae34f-b2a8-40d5-b5f1-a968f17a3521" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb/javabloblistblobsflatmarker1020187134d4da7e10a46", + "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" : "cc4dd272-1495-453e-9896-ed8233aefdc6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD557ED1EB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2791-f01e-00ef-7fe6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "cc4dd272-1495-453e-9896-ed8233aefdc6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac1d32fe-8350-49d4-b436-365df73483f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac27b9-f01e-00ef-24e6-643b08000000", + "Body" : "6javabloblistblobsflatmarker1020187134d4da7e10a46Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD557ED1EB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker175321cd7343542a5c448Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD553757B0512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker26389952281bf188174a7Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD553D9AB5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker301459ede7258c4d3d4dcFri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD55478823512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker4887062a0b41b33ca54efFri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD554D7CFB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker5917377bb1b06a9ed64c9Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD555371D8512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "ac1d32fe-8350-49d4-b436-365df73483f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fff88868-3bf7-42ed-bfb2-1d083961ca5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec644825-001e-001f-64e6-64eb66000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker62108026c4f0aa7f55455Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD55598DCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker72180865d31c863d7e4e1Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD555F82AC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker8294913f4c0a448d714e3Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD556613E9512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker94439550ea047350b64d5Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD556D68B5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "fff88868-3bf7-42ed-bfb2-1d083961ca5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2eb54f9-6400-4f81-8169-daf536ffe75d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac27ed-f01e-00ef-57e6-643b08000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker62108026c4f0aa7f55455Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD55598DCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker72180865d31c863d7e4e1Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD555F82AC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker8294913f4c0a448d714e3Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD556613E9512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker94439550ea047350b64d5Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD556D68B5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "d2eb54f9-6400-4f81-8169-daf536ffe75d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6645e70e-8f28-4d37-9a1a-c8bd51bf0b36" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac286e-f01e-00ef-4be6-643b08000000", + "Body" : "6javabloblistblobsflatmarker1020187134d4da7e10a46Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD557ED1EB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker175321cd7343542a5c448Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD553757B0512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker26389952281bf188174a7Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD553D9AB5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker301459ede7258c4d3d4dcFri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD55478823512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker4887062a0b41b33ca54efFri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD554D7CFB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker5917377bb1b06a9ed64c9Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD555371D8512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "6645e70e-8f28-4d37-9a1a-c8bd51bf0b36", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d0183acd-63a7-4342-beb9-9c2145bf275e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac289f-f01e-00ef-77e6-643b08000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYyMTA4MDI2YzRmMGFhN2Y1NTQ1NSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker62108026c4f0aa7f55455Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD55598DCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker72180865d31c863d7e4e1Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD555F82AC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker8294913f4c0a448d714e3Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD556613E9512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker94439550ea047350b64d5Fri, 06 Sep 2019 19:06:33 GMTFri, 06 Sep 2019 19:06:33 GMT0x8D732FD556D68B5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "d0183acd-63a7-4342-beb9-9c2145bf275e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d539ae4f-f9ca-4a8b-b005-f59c46afa0de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac28f9-f01e-00ef-45e6-643b08000000", + "Body" : "jtclistblobsflatmarkerjtclistblobsflatmarker088482635cf8cbf85c4abbbFri, 06 Sep 2019 19:06:33 GMT\"0x8D732FD553171DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "d539ae4f-f9ca-4a8b-b005-f59c46afa0de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker088482635cf8cbf85c4abbb?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" : "fd1d80e1-557f-4530-b296-c44d3636589c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac290a-f01e-00ef-56e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "fd1d80e1-557f-4530-b296-c44d3636589c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatmarker088482635cf8cbf85c4abbb", "javabloblistblobsflatmarker175321cd7343542a5c448", "javabloblistblobsflatmarker26389952281bf188174a7", "javabloblistblobsflatmarker301459ede7258c4d3d4dc", "javabloblistblobsflatmarker4887062a0b41b33ca54ef", "javabloblistblobsflatmarker5917377bb1b06a9ed64c9", "javabloblistblobsflatmarker62108026c4f0aa7f55455", "javabloblistblobsflatmarker72180865d31c863d7e4e1", "javabloblistblobsflatmarker8294913f4c0a448d714e3", "javabloblistblobsflatmarker94439550ea047350b64d5", "javabloblistblobsflatmarker1020187134d4da7e10a46" ] +} \ 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..7c206b935774 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin6c7729727?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" : "adfa462a-e6ea-4135-aa1e-845f8c4e4c59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A69E55A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63835b-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "adfa462a-e6ea-4135-aa1e-845f8c4e4c59" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin6c7729727?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9eb3c558-40bb-42fb-9c4c-ee254afd28a1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec638396-001e-001f-36e6-64eb66000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "9eb3c558-40bb-42fb-9c4c-ee254afd28a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "500bed3c-97f2-427a-b233-b3d6b038e872" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6383ae-001e-001f-4be6-64eb66000000", + "Body" : "jtclistblobsflatminjtclistblobsflatmin0containerapitestlistblobsflatmin6c7729727Fri, 06 Sep 2019 19:05:21 GMT\"0x8D732FD2A69E55A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "500bed3c-97f2-427a-b233-b3d6b038e872", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin6c7729727?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" : "74da0008-8010-4f07-8027-598714e736cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6383ca-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "74da0008-8010-4f07-8027-598714e736cf" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatmin0containerapitestlistblobsflatmin6c7729727" ] +} \ 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..00e190ffe726 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c?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" : "4189ceea-f505-4713-820f-265d9fad740f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A7F957B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6383e3-001e-001f-7ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "4189ceea-f505-4713-820f-265d9fad740f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/ajavabloblistblobsflatoptionscopy1544483e0271b0e79f", + "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" : "17090f7e-50a9-4169-af2b-1b7849a27244" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A87B003\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63840c-001e-001f-23e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:21 GMT", + "x-ms-client-request-id" : "17090f7e-50a9-4169-af2b-1b7849a27244" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/cjavabloblistblobsflatoptionscopy201206bfffc13c6f6a", + "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" : "e22f0380-da2c-48ae-a310-652fd0eda1d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "fb9a9006-d66a-4c27-9fcc-894963af21fc", + "ETag" : "\"0x8D732FD2AE2DE02\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "ec638425-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:22 GMT", + "x-ms-client-request-id" : "e22f0380-da2c-48ae-a310-652fd0eda1d4" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/cjavabloblistblobsflatoptionscopy201206bfffc13c6f6a", + "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" : "a3217051-ca85-4f6e-a4c9-00a162994a2e" + }, + "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" : "Fri, 06 Sep 2019 19:05: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" : "Fri, 06 Sep 2019 19:05:22 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec6385c8-001e-001f-37e6-64eb66000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "fb9a9006-d66a-4c27-9fcc-894963af21fc", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/ajavabloblistblobsflatoptionscopy1544483e0271b0e79f", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:05:22 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:05:22 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD2AE2DE02\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "a3217051-ca85-4f6e-a4c9-00a162994a2e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/mjavabloblistblobsflatoptionscopy3475399de9abe95584", + "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" : "8a57f806-1fd1-42df-abeb-aed82da64020" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2B92819D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6388fb-001e-001f-2ee6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "8a57f806-1fd1-42df-abeb-aed82da64020" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/ajavabloblistblobsflatoptionscopy1544483e0271b0e79f?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", + "x-ms-client-request-id" : "fde49b50-879f-47f7-92c1-f71b8125c1ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:05:23.5781333Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2A87B003\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63892a-001e-001f-54e6-64eb66000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "fde49b50-879f-47f7-92c1-f71b8125c1ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/ujavabloblistblobsflatoptionscopy412577d5a3afb9d61e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8b9ede6c-eeed-4bcf-bc59-56f12699fee1", + "Content-Type" : "application/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" : "ec638948-001e-001f-6fe6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "8b9ede6c-eeed-4bcf-bc59-56f12699fee1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "14da3083-ff48-4ad0-abcd-e289bf1868c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63896b-001e-001f-0ae6-64eb66000000", + "Body" : "ajavabloblistblobsflatoptionscopy1544483e0271b0e79fFri, 06 Sep 2019 19:05:21 GMTFri, 06 Sep 2019 19:05:21 GMT0x8D732FD2A87B003512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionscopy201206bfffc13c6f6aFri, 06 Sep 2019 19:05:22 GMTFri, 06 Sep 2019 19:05:22 GMT0x8D732FD2AE2DE02512application/octet-stream0PageBlobHottrueunlockedavailablefb9a9006-d66a-4c27-9fcc-894963af21fchttps://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c/ajavabloblistblobsflatoptionscopy1544483e0271b0e79fsuccess512/512Fri, 06 Sep 2019 19:05:22 GMTtrue0mjavabloblistblobsflatoptionscopy3475399de9abe95584Fri, 06 Sep 2019 19:05:23 GMTFri, 06 Sep 2019 19:05:23 GMT0x8D732FD2B92819D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "14da3083-ff48-4ad0-abcd-e289bf1868c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "537e3c94-e9bc-4c84-b433-ecfc40362e1f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63898f-001e-001f-2ce6-64eb66000000", + "Body" : "jtclistblobsflatoptionscopyjtclistblobsflatoptionscopy0426361abebadca12648cFri, 06 Sep 2019 19:05:21 GMT\"0x8D732FD2A7F957B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "537e3c94-e9bc-4c84-b433-ecfc40362e1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0426361abebadca12648c?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" : "ff28a0db-dbcc-47a8-8bbe-839320cba9a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6389a2-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "ff28a0db-dbcc-47a8-8bbe-839320cba9a3" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionscopy0426361abebadca12648c", "javabloblistblobsflatoptionscopy1544483e0271b0e79f", "javabloblistblobsflatoptionscopy201206bfffc13c6f6a", "javabloblistblobsflatoptionscopy3475399de9abe95584", "javabloblistblobsflatoptionscopy412577d5a3afb9d61e" ] +} \ 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..91395c52de80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted05643347d61ab72b7a4?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" : "3bb0ab0c-60c3-45ad-9a8b-3d41a7814ae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2EEC3EFA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6397c2-001e-001f-07e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "3bb0ab0c-60c3-45ad-9a8b-3d41a7814ae2" + }, + "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" : "1f70d627-e7cb-45e4-a2cd-d7987a6cbf49", + "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" : "ec6397d6-001e-001f-19e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:29 GMT", + "x-ms-client-request-id" : "1f70d627-e7cb-45e4-a2cd-d7987a6cbf49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted05643347d61ab72b7a4/javabloblistblobsflatoptionsdeleted1789229ffe7cc0871", + "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" : "b2f05a20-137d-49c5-b270-2c091546a03e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD40EB2C8D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63e98c-001e-001f-57e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:59 GMT", + "x-ms-client-request-id" : "b2f05a20-137d-49c5-b270-2c091546a03e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted05643347d61ab72b7a4/javabloblistblobsflatoptionsdeleted1789229ffe7cc0871", + "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" : "6d7d6514-0dea-4fe5-96ec-85d5ca1e4e9f" + }, + "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" : "ec63e9ae-001e-001f-72e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:59 GMT", + "x-ms-client-request-id" : "6d7d6514-0dea-4fe5-96ec-85d5ca1e4e9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted05643347d61ab72b7a4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e724c03c-14a5-429e-ad9c-fac4130ffe74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63e9cf-001e-001f-11e6-64eb66000000", + "Body" : "javabloblistblobsflatoptionsdeleted1789229ffe7cc0871trueFri, 06 Sep 2019 19:05:59 GMTFri, 06 Sep 2019 19:05:59 GMT0x8D732FD40EB2C8D0application/octet-streamAppendBlobHottruetrueFri, 06 Sep 2019 19:05:59 GMT10", + "Date" : "Fri, 06 Sep 2019 19:05:59 GMT", + "x-ms-client-request-id" : "e724c03c-14a5-429e-ad9c-fac4130ffe74", + "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" : "6985e967-3bb1-4d2e-8c76-f7218e2a6023", + "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" : "ec63e9e8-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:59 GMT", + "x-ms-client-request-id" : "6985e967-3bb1-4d2e-8c76-f7218e2a6023" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5a7734b5-b3fa-4f40-802d-6fc52cdf5f9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec643d34-001e-001f-43e6-64eb66000000", + "Body" : "jtclistblobsflatoptionsdeletedjtclistblobsflatoptionsdeleted05643347d61ab72b7a4Fri, 06 Sep 2019 19:05:29 GMT\"0x8D732FD2EEC3EFA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:29 GMT", + "x-ms-client-request-id" : "5a7734b5-b3fa-4f40-802d-6fc52cdf5f9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted05643347d61ab72b7a4?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" : "503d54d4-aa2f-4332-8857-58e1d26d0e94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec643d89-001e-001f-11e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:06:29 GMT", + "x-ms-client-request-id" : "503d54d4-aa2f-4332-8857-58e1d26d0e94" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsdeleted05643347d61ab72b7a4", "javabloblistblobsflatoptionsdeleted1789229ffe7cc0871" ] +} \ 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..5cbb4b634569 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsfail070199b252ab2874b14e5?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" : "7ecb0ab7-2492-4886-9d4f-f0926af24b2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD550AA66E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac24e9-f01e-00ef-05e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "7ecb0ab7-2492-4886-9d4f-f0926af24b2f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "572e04ef-dff0-4791-a301-7b17ee7556db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac25aa-f01e-00ef-36e6-643b08000000", + "Body" : "jtclistblobsflatoptionsfailjtclistblobsflatoptionsfail070199b252ab2874b14e5Fri, 06 Sep 2019 19:06:33 GMT\"0x8D732FD550AA66E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "572e04ef-dff0-4791-a301-7b17ee7556db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsfail070199b252ab2874b14e5?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" : "15835639-93f3-4c70-aca5-5da535e4b47a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac25de-f01e-00ef-64e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:33 GMT", + "x-ms-client-request-id" : "15835639-93f3-4c70-aca5-5da535e4b47a" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsfail070199b252ab2874b14e5" ] +} \ 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..a80d24be36f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json @@ -0,0 +1,298 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd?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" : "63a85e98-284c-4531-9fd0-ed28737347ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD540DFE39\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec644214-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-client-request-id" : "63a85e98-284c-4531-9fd0-ed28737347ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/ajavabloblistblobsflatoptionsmaxresults189271bb0553c60", + "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" : "5bfece45-c444-44b5-bfc2-873f223576e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD54146480\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec644233-001e-001f-24e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-client-request-id" : "5bfece45-c444-44b5-bfc2-873f223576e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/cjavabloblistblobsflatoptionsmaxresults2505599636c0367", + "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" : "f9697057-9461-42fc-8cee-ee39c5435efa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "052b96ec-6ea6-45f2-8651-b4e942a7bce3", + "ETag" : "\"0x8D732FD5420C387\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "ec644248-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-client-request-id" : "f9697057-9461-42fc-8cee-ee39c5435efa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/cjavabloblistblobsflatoptionsmaxresults2505599636c0367", + "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" : "d35b7dc3-d672-4be3-bf80-96ae3bb37cc3" + }, + "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" : "Fri, 06 Sep 2019 19:06: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" : "Fri, 06 Sep 2019 19:06:31 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec64427c-001e-001f-68e6-64eb66000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "052b96ec-6ea6-45f2-8651-b4e942a7bce3", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/ajavabloblistblobsflatoptionsmaxresults189271bb0553c60", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:06:31 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD5420C387\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "d35b7dc3-d672-4be3-bf80-96ae3bb37cc3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/mjavabloblistblobsflatoptionsmaxresults32490646d42a437", + "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" : "b75cf3a4-bbde-48fb-9e74-1429a85c0d94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD54C58F18\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec64450c-001e-001f-2de6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "b75cf3a4-bbde-48fb-9e74-1429a85c0d94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/ajavabloblistblobsflatoptionsmaxresults189271bb0553c60?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", + "x-ms-client-request-id" : "9de335c0-1e51-448f-ba78-d893b7cd764c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:06:32.6952948Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD54146480\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec644519-001e-001f-37e6-64eb66000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "9de335c0-1e51-448f-ba78-d893b7cd764c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/ujavabloblistblobsflatoptionsmaxresults4331350fb72e1db?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "664f7d15-c5ff-45b2-b41c-149fc89b2f47", + "Content-Type" : "application/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" : "ec64452c-001e-001f-46e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "664f7d15-c5ff-45b2-b41c-149fc89b2f47" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ee27c93d-0740-4bf3-9c0f-077c0515fccb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec644546-001e-001f-5ce6-64eb66000000", + "Body" : "2ajavabloblistblobsflatoptionsmaxresults189271bb0553c602019-09-06T19:06:32.6952948ZFri, 06 Sep 2019 19:06:31 GMTFri, 06 Sep 2019 19:06:31 GMT0x8D732FD54146480512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionsmaxresults189271bb0553c60Fri, 06 Sep 2019 19:06:31 GMTFri, 06 Sep 2019 19:06:31 GMT0x8D732FD54146480512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1MDU1OTk2MzZjMDM2NyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "ee27c93d-0740-4bf3-9c0f-077c0515fccb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd?marker=2%21132%21MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1MDU1OTk2MzZjMDM2NyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "17e30dd9-d5b0-48f7-a946-2e900e527ede" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec644551-001e-001f-66e6-64eb66000000", + "Body" : "2!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1MDU1OTk2MzZjMDM2NyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-2cjavabloblistblobsflatoptionsmaxresults2505599636c0367Fri, 06 Sep 2019 19:06:31 GMTFri, 06 Sep 2019 19:06:31 GMT0x8D732FD5420C387512application/octet-stream0PageBlobHottrueunlockedavailable052b96ec-6ea6-45f2-8651-b4e942a7bce3https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd/ajavabloblistblobsflatoptionsmaxresults189271bb0553c60success512/512Fri, 06 Sep 2019 19:06:31 GMTtrue0mjavabloblistblobsflatoptionsmaxresults32490646d42a437Fri, 06 Sep 2019 19:06:32 GMTFri, 06 Sep 2019 19:06:32 GMT0x8D732FD54C58F18512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQzMzEzNTBmYjcyZTFkYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "17e30dd9-d5b0-48f7-a946-2e900e527ede", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd?marker=2%21132%21MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQzMzEzNTBmYjcyZTFkYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6cec7922-c3dc-499a-9308-c7bb6bb4900e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec644579-001e-001f-04e6-64eb66000000", + "Body" : "2!132!MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQzMzEzNTBmYjcyZTFkYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-2ujavabloblistblobsflatoptionsmaxresults4331350fb72e1db0BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "6cec7922-c3dc-499a-9308-c7bb6bb4900e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "70b44ca0-1c1b-4c0e-b89b-d13098e21281" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2460-f01e-00ef-07e6-643b08000000", + "Body" : "2ajavabloblistblobsflatoptionsmaxresults189271bb0553c602019-09-06T19:06:32.6952948ZFri, 06 Sep 2019 19:06:31 GMTFri, 06 Sep 2019 19:06:31 GMT0x8D732FD54146480512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionsmaxresults189271bb0553c60Fri, 06 Sep 2019 19:06:31 GMTFri, 06 Sep 2019 19:06:31 GMT0x8D732FD54146480512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1MDU1OTk2MzZjMDM2NyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "70b44ca0-1c1b-4c0e-b89b-d13098e21281", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0c09211e-9474-431a-8e72-8934fffea86e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac24ae-f01e-00ef-4ee6-643b08000000", + "Body" : "jtclistblobsflatoptionsmaxresultsjtclistblobsflatoptionsmaxresults038568c0850db2a5fdFri, 06 Sep 2019 19:06:31 GMT\"0x8D732FD540DFE39\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "0c09211e-9474-431a-8e72-8934fffea86e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults038568c0850db2a5fd?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" : "2e27d854-8bb6-4b3d-b3d8-9c1395ee6d6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac24c6-f01e-00ef-64e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:32 GMT", + "x-ms-client-request-id" : "2e27d854-8bb6-4b3d-b3d8-9c1395ee6d6d" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsmaxresults038568c0850db2a5fd", "javabloblistblobsflatoptionsmaxresults189271bb0553c60", "javabloblistblobsflatoptionsmaxresults2505599636c0367", "javabloblistblobsflatoptionsmaxresults32490646d42a437", "javabloblistblobsflatoptionsmaxresults4331350fb72e1db" ] +} \ 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..694b6a286a9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314?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" : "8f5ddc97-1ef5-4d5e-aa61-025352acedfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2BC3D56F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6389cd-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "8f5ddc97-1ef5-4d5e-aa61-025352acedfa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/ajavabloblistblobsflatoptionsmetadata1028568eac1a4c15", + "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" : "f5c4b48e-3fdc-4db8-aa7e-4ff377df4d8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2BCB2B36\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638a07-001e-001f-14e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "f5c4b48e-3fdc-4db8-aa7e-4ff377df4d8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/cjavabloblistblobsflatoptionsmetadata28469639c3129db5", + "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" : "316564ac-f3c2-47fe-bcb9-9c0f73c8c5aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0b1d41fb-1e4f-46eb-ac9b-617453cdd04c", + "ETag" : "\"0x8D732FD2BE21407\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "ec638a28-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-client-request-id" : "316564ac-f3c2-47fe-bcb9-9c0f73c8c5aa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/cjavabloblistblobsflatoptionsmetadata28469639c3129db5", + "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" : "47d28f6c-8d0f-4ebc-a901-4d5aca6b1178" + }, + "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" : "Fri, 06 Sep 2019 19:05:24 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" : "Fri, 06 Sep 2019 19:05:24 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec638aa3-001e-001f-14e6-64eb66000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "0b1d41fb-1e4f-46eb-ac9b-617453cdd04c", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/ajavabloblistblobsflatoptionsmetadata1028568eac1a4c15", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:05:23 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:05:24 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD2BE21407\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "47d28f6c-8d0f-4ebc-a901-4d5aca6b1178" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/mjavabloblistblobsflatoptionsmetadata3482718bfbbb65bd", + "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" : "d337589a-67e6-453b-8ef2-279378fe9ac1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2C8706B3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638d6a-001e-001f-6ee6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:24 GMT", + "x-ms-client-request-id" : "d337589a-67e6-453b-8ef2-279378fe9ac1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/ajavabloblistblobsflatoptionsmetadata1028568eac1a4c15?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", + "x-ms-client-request-id" : "d77ae0e8-e519-41e8-ab62-dc5dcb271f20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:05:25.1746136Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2BCB2B36\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638d87-001e-001f-0ae6-64eb66000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "d77ae0e8-e519-41e8-ab62-dc5dcb271f20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314/ujavabloblistblobsflatoptionsmetadata440956cd7148a247?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "25be7e2b-4f23-4484-a8e9-517e3e5e11b9", + "Content-Type" : "application/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" : "ec638ee6-001e-001f-3fe6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "25be7e2b-4f23-4484-a8e9-517e3e5e11b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2ecaba7-445d-4ada-b654-d6f283e5f14b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec638efb-001e-001f-53e6-64eb66000000", + "Body" : "ajavabloblistblobsflatoptionsmetadata1028568eac1a4c15Fri, 06 Sep 2019 19:05:23 GMTFri, 06 Sep 2019 19:05:23 GMT0x8D732FD2BCB2B36512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionsmetadata28469639c3129db5Fri, 06 Sep 2019 19:05:24 GMTFri, 06 Sep 2019 19:05:24 GMT0x8D732FD2BE21407512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionsmetadata3482718bfbbb65bdFri, 06 Sep 2019 19:05:25 GMTFri, 06 Sep 2019 19:05:25 GMT0x8D732FD2C8706B3512application/octet-stream0PageBlobHottrueunlockedavailabletrue0bar", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "f2ecaba7-445d-4ada-b654-d6f283e5f14b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "169be2c5-2907-4734-b839-a68393c2c2e5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec638f33-001e-001f-02e6-64eb66000000", + "Body" : "jtclistblobsflatoptionsmetadatajtclistblobsflatoptionsmetadata0895249682e2a8f6314Fri, 06 Sep 2019 19:05:23 GMT\"0x8D732FD2BC3D56F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "169be2c5-2907-4734-b839-a68393c2c2e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata0895249682e2a8f6314?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" : "1fbfbb13-fa93-44d9-8aa6-5bc150e4c9bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec638f4a-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "1fbfbb13-fa93-44d9-8aa6-5bc150e4c9bd" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsmetadata0895249682e2a8f6314", "javabloblistblobsflatoptionsmetadata1028568eac1a4c15", "javabloblistblobsflatoptionsmetadata28469639c3129db5", "javabloblistblobsflatoptionsmetadata3482718bfbbb65bd", "javabloblistblobsflatoptionsmetadata440956cd7148a247" ] +} \ 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..ba769460d205 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640?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" : "cd26ef61-ce6d-41fd-bb24-49a3fb02128f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD530E51AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec643dcb-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:06:29 GMT", + "x-ms-client-request-id" : "cd26ef61-ce6d-41fd-bb24-49a3fb02128f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/ajavabloblistblobsflatoptionsprefix1495618209a3a7742", + "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" : "6fd434b1-11e0-4263-9f00-ecd0e5778349" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD5317A014\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec643df9-001e-001f-74e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:29 GMT", + "x-ms-client-request-id" : "6fd434b1-11e0-4263-9f00-ecd0e5778349" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/cjavabloblistblobsflatoptionsprefix204202630f0f097f8", + "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" : "24eb85f0-f21c-4fb8-bfbc-af286b2d250e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d9a9700e-4617-42fa-ac96-b9b46e6294d2", + "ETag" : "\"0x8D732FD53358F6B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "ec643e14-001e-001f-0be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:06:29 GMT", + "x-ms-client-request-id" : "24eb85f0-f21c-4fb8-bfbc-af286b2d250e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/cjavabloblistblobsflatoptionsprefix204202630f0f097f8", + "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" : "861f5f6f-8cbd-4c01-b0c5-243ac34d0590" + }, + "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" : "Fri, 06 Sep 2019 19:06:30 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" : "Fri, 06 Sep 2019 19:06:30 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec643ee8-001e-001f-4ce6-64eb66000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "d9a9700e-4617-42fa-ac96-b9b46e6294d2", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/ajavabloblistblobsflatoptionsprefix1495618209a3a7742", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:06:29 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:06:30 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD53358F6B\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "861f5f6f-8cbd-4c01-b0c5-243ac34d0590" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/mjavabloblistblobsflatoptionsprefix344992b028b6c0796", + "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" : "d83e1744-b6ba-4206-9eb6-f3c733e32dee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD53E92B93\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec644164-001e-001f-79e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:30 GMT", + "x-ms-client-request-id" : "d83e1744-b6ba-4206-9eb6-f3c733e32dee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/ajavabloblistblobsflatoptionsprefix1495618209a3a7742?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", + "x-ms-client-request-id" : "33ec3f99-9306-43fc-b3b6-76940ffcf4d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:06:31.2469510Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD5317A014\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec644180-001e-001f-10e6-64eb66000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:06:30 GMT", + "x-ms-client-request-id" : "33ec3f99-9306-43fc-b3b6-76940ffcf4d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640/ujavabloblistblobsflatoptionsprefix494078b3894465d7c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2850d7a6-6fca-46c2-bb9e-c59d2e808ebb", + "Content-Type" : "application/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" : "ec644198-001e-001f-25e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:30 GMT", + "x-ms-client-request-id" : "2850d7a6-6fca-46c2-bb9e-c59d2e808ebb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "78fbb37e-e8ff-43a7-b4b6-6b4858c272b9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6441b3-001e-001f-38e6-64eb66000000", + "Body" : "aajavabloblistblobsflatoptionsprefix1495618209a3a7742Fri, 06 Sep 2019 19:06:29 GMTFri, 06 Sep 2019 19:06:29 GMT0x8D732FD5317A014512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-client-request-id" : "78fbb37e-e8ff-43a7-b4b6-6b4858c272b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1a170a7d-b19e-45d9-84a8-a4fbd1fcdf28" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6441d9-001e-001f-59e6-64eb66000000", + "Body" : "jtclistblobsflatoptionsprefixjtclistblobsflatoptionsprefix047260847e3ad7f6c640Fri, 06 Sep 2019 19:06:29 GMT\"0x8D732FD530E51AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-client-request-id" : "1a170a7d-b19e-45d9-84a8-a4fbd1fcdf28", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix047260847e3ad7f6c640?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" : "1b762eb2-fc68-40b7-a688-88aab8e4f6e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6441f7-001e-001f-71e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:06:31 GMT", + "x-ms-client-request-id" : "1b762eb2-fc68-40b7-a688-88aab8e4f6e6" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsprefix047260847e3ad7f6c640", "javabloblistblobsflatoptionsprefix1495618209a3a7742", "javabloblistblobsflatoptionsprefix204202630f0f097f8", "javabloblistblobsflatoptionsprefix344992b028b6c0796", "javabloblistblobsflatoptionsprefix494078b3894465d7c" ] +} \ 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..a6de04358a1c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1?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" : "4069c425-1c30-4c6f-8635-8b8d618ba97e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2D05A411\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638f6f-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "4069c425-1c30-4c6f-8635-8b8d618ba97e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/ajavabloblistblobsflatoptionssnapshots153870037eacc66d", + "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" : "77d4108a-2ba8-4464-b11d-83ae2d07c3a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2D0B986F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec638fbd-001e-001f-77e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "77d4108a-2ba8-4464-b11d-83ae2d07c3a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/cjavabloblistblobsflatoptionssnapshots2587521a921c6016", + "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" : "a12352b5-53c9-4578-8183-285a4d44e7c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "452cf95e-6a47-4e5f-9e76-645c19d4bf5d", + "ETag" : "\"0x8D732FD2D242F5D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "ec638fde-001e-001f-15e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:25 GMT", + "x-ms-client-request-id" : "a12352b5-53c9-4578-8183-285a4d44e7c4" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/cjavabloblistblobsflatoptionssnapshots2587521a921c6016", + "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" : "3b33813c-84e7-4711-a647-8117d36ad530" + }, + "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" : "Fri, 06 Sep 2019 19:05:26 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" : "Fri, 06 Sep 2019 19:05:26 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec639061-001e-001f-0be6-64eb66000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "452cf95e-6a47-4e5f-9e76-645c19d4bf5d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/ajavabloblistblobsflatoptionssnapshots153870037eacc66d", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:05:26 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:05:26 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD2D242F5D\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "3b33813c-84e7-4711-a647-8117d36ad530" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/mjavabloblistblobsflatoptionssnapshots396001a7309aeeb7", + "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" : "3004cf0d-1f4c-4004-8366-e5d43c744dfe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2DD4E4A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec639311-001e-001f-61e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "3004cf0d-1f4c-4004-8366-e5d43c744dfe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/ajavabloblistblobsflatoptionssnapshots153870037eacc66d?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", + "x-ms-client-request-id" : "1b28d477-6944-4416-893d-df89ca43bd51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:05:27.3836646Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2D0B986F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63932f-001e-001f-7fe6-64eb66000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "1b28d477-6944-4416-893d-df89ca43bd51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1/ujavabloblistblobsflatoptionssnapshots42016168876c2176?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "db361e17-4aa3-4d8f-bcaf-408e54f6b39e", + "Content-Type" : "application/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" : "ec639353-001e-001f-1be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "db361e17-4aa3-4d8f-bcaf-408e54f6b39e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "84461a05-39cc-42eb-831a-ebdee0a0a53d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec639372-001e-001f-37e6-64eb66000000", + "Body" : "ajavabloblistblobsflatoptionssnapshots153870037eacc66d2019-09-06T19:05:27.3836646ZFri, 06 Sep 2019 19:05:26 GMTFri, 06 Sep 2019 19:05:26 GMT0x8D732FD2D0B986F512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionssnapshots153870037eacc66dFri, 06 Sep 2019 19:05:26 GMTFri, 06 Sep 2019 19:05:26 GMT0x8D732FD2D0B986F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionssnapshots2587521a921c6016Fri, 06 Sep 2019 19:05:26 GMTFri, 06 Sep 2019 19:05:26 GMT0x8D732FD2D242F5D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionssnapshots396001a7309aeeb7Fri, 06 Sep 2019 19:05:27 GMTFri, 06 Sep 2019 19:05:27 GMT0x8D732FD2DD4E4A2512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "84461a05-39cc-42eb-831a-ebdee0a0a53d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a66a43ff-8e9a-4424-93d8-1e664277cb81" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6393aa-001e-001f-6de6-64eb66000000", + "Body" : "jtclistblobsflatoptionssnapshotsjtclistblobsflatoptionssnapshots027991d1e2650fa6a1Fri, 06 Sep 2019 19:05:25 GMT\"0x8D732FD2D05A411\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "a66a43ff-8e9a-4424-93d8-1e664277cb81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots027991d1e2650fa6a1?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" : "d1382f27-dfaa-474e-b9d2-1f848eb338d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6393bc-001e-001f-7ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "d1382f27-dfaa-474e-b9d2-1f848eb338d1" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionssnapshots027991d1e2650fa6a1", "javabloblistblobsflatoptionssnapshots153870037eacc66d", "javabloblistblobsflatoptionssnapshots2587521a921c6016", "javabloblistblobsflatoptionssnapshots396001a7309aeeb7", "javabloblistblobsflatoptionssnapshots42016168876c2176" ] +} \ 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..7eb925461912 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274?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" : "9a2ef5a6-dd54-4a12-9a87-c5ee7a3febd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2E068960\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6393e0-001e-001f-1fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "9a2ef5a6-dd54-4a12-9a87-c5ee7a3febd7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/ajavabloblistblobsflatoptionsuncommitted115126505538cbc", + "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" : "a63e10cd-99bd-4e5e-9994-2f786df89b65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2E0C5576\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6393fa-001e-001f-31e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "a63e10cd-99bd-4e5e-9994-2f786df89b65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/cjavabloblistblobsflatoptionsuncommitted27711813ba5cd1f", + "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" : "a4a021c1-6deb-46fd-89a2-437bbc3fd617" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "aee7bd59-feb9-41a0-8c26-4f95c3f0068f", + "ETag" : "\"0x8D732FD2E1929CF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "ec639415-001e-001f-49e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-client-request-id" : "a4a021c1-6deb-46fd-89a2-437bbc3fd617" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/cjavabloblistblobsflatoptionsuncommitted27711813ba5cd1f", + "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" : "88edf735-7eee-4551-8a73-9e9e86ebad60" + }, + "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" : "Fri, 06 Sep 2019 19:05:27 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" : "Fri, 06 Sep 2019 19:05:27 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec639447-001e-001f-76e6-64eb66000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "aee7bd59-feb9-41a0-8c26-4f95c3f0068f", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/ajavabloblistblobsflatoptionsuncommitted115126505538cbc", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:05:27 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:05:27 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD2E1929CF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "88edf735-7eee-4551-8a73-9e9e86ebad60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/mjavabloblistblobsflatoptionsuncommitted337150a0e72bed5", + "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" : "28a773f6-ddab-4874-aba1-31ebf0df0bd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2EBEB914\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6396fa-001e-001f-51e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "28a773f6-ddab-4874-aba1-31ebf0df0bd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/ajavabloblistblobsflatoptionsuncommitted115126505538cbc?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", + "x-ms-client-request-id" : "201e8ebb-c062-4caa-bd75-7b89dd052d10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:05:28.8980739Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2E0C5576\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec639715-001e-001f-67e6-64eb66000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "201e8ebb-c062-4caa-bd75-7b89dd052d10" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274/ujavabloblistblobsflatoptionsuncommitted41661683dab0796?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7d3d94c6-212c-40a9-bed6-bcb8205e0a82", + "Content-Type" : "application/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" : "ec639728-001e-001f-7ae6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "7d3d94c6-212c-40a9-bed6-bcb8205e0a82" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "75c8ea3c-f6f6-42f1-8e1e-50025fb8067c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec639747-001e-001f-16e6-64eb66000000", + "Body" : "ajavabloblistblobsflatoptionsuncommitted115126505538cbcFri, 06 Sep 2019 19:05:27 GMTFri, 06 Sep 2019 19:05:27 GMT0x8D732FD2E0C5576512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionsuncommitted27711813ba5cd1fFri, 06 Sep 2019 19:05:27 GMTFri, 06 Sep 2019 19:05:27 GMT0x8D732FD2E1929CF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionsuncommitted337150a0e72bed5Fri, 06 Sep 2019 19:05:28 GMTFri, 06 Sep 2019 19:05:28 GMT0x8D732FD2EBEB914512application/octet-stream0PageBlobHottrueunlockedavailabletrue0ujavabloblistblobsflatoptionsuncommitted41661683dab07960BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "75c8ea3c-f6f6-42f1-8e1e-50025fb8067c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ed1860e6-21de-45cf-b018-7fdd0cb723ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec639788-001e-001f-51e6-64eb66000000", + "Body" : "jtclistblobsflatoptionsuncommittedjtclistblobsflatoptionsuncommitted0512082aff4a06274Fri, 06 Sep 2019 19:05:27 GMT\"0x8D732FD2E068960\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "ed1860e6-21de-45cf-b018-7fdd0cb723ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted0512082aff4a06274?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" : "64ae1cb2-96fb-45f0-a8dd-7b0604bf89eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec639798-001e-001f-61e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:28 GMT", + "x-ms-client-request-id" : "64ae1cb2-96fb-45f0-a8dd-7b0604bf89eb" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsuncommitted0512082aff4a06274", "javabloblistblobsflatoptionsuncommitted115126505538cbc", "javabloblistblobsflatoptionsuncommitted27711813ba5cd1f", "javabloblistblobsflatoptionsuncommitted337150a0e72bed5", "javabloblistblobsflatoptionsuncommitted41661683dab0796" ] +} \ 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..6c69e2c2e81e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json @@ -0,0 +1,369 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba?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" : "a05f9bc4-f332-4899-869b-c4ad84c7e012" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81849665\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6510a6-001e-001f-5ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "a05f9bc4-f332-4899-869b-c4ad84c7e012" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple14472077db0dfbcd2b40d", + "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" : "988101fe-b30d-4343-ae30-c7ef7f300ecf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD818ADA18\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6510b9-001e-001f-6ce6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "988101fe-b30d-4343-ae30-c7ef7f300ecf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple264313194bcac09c84432", + "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" : "9c6741a0-0819-4cbf-8ddf-5400812c65cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8191E09F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6510c8-001e-001f-78e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "9c6741a0-0819-4cbf-8ddf-5400812c65cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple363214b59077ffc2144b6", + "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" : "35a7d2e4-4878-4da9-81c9-6bd270439396" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81976036\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6510e9-001e-001f-14e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "35a7d2e4-4878-4da9-81c9-6bd270439396" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple4473315f24e0486b6542d", + "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" : "e8316236-09a9-4555-94d8-708077f7f830" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD819DA33C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65110b-001e-001f-32e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "e8316236-09a9-4555-94d8-708077f7f830" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple52560167bdd655ebf646e", + "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" : "0816fca5-baf0-4367-a341-14045cca8217" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81A4F803\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651126-001e-001f-4de6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "0816fca5-baf0-4367-a341-14045cca8217" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple632611713f38b15749416", + "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" : "6b4e8e72-44cc-48ac-b39b-16334cc87379" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81AB6224\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651141-001e-001f-67e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "6b4e8e72-44cc-48ac-b39b-16334cc87379" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple71753399a02a0f9d4d4e7", + "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" : "647968cc-61e5-4ef8-b57b-a32e6da4cadc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81B15701\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651158-001e-001f-7be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "647968cc-61e5-4ef8-b57b-a32e6da4cadc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple858958d0c1a977c4c44c6", + "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" : "d04975ac-4651-49cd-8625-5d616558fad5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81BACF2A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651197-001e-001f-32e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "d04975ac-4651-49cd-8625-5d616558fad5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple9158608c37f84251444b4", + "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" : "0a2cbcc8-ed22-4e50-9227-2a1c4d74a456" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81C2E75A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6511ad-001e-001f-47e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "0a2cbcc8-ed22-4e50-9227-2a1c4d74a456" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba/javabloblistblobsflatsimple10531010728985effd344", + "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" : "e9a2c4de-f137-4ac5-994a-3948335cfaaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81CA3C26\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6511cc-001e-001f-62e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "e9a2c4de-f137-4ac5-994a-3948335cfaaa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aa8fa2a1-6672-40d0-a70f-9118c0a7ddcf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6511e8-001e-001f-7ae6-64eb66000000", + "Body" : "3javabloblistblobsflatsimple10531010728985effd344Fri, 06 Sep 2019 19:07:48 GMTFri, 06 Sep 2019 19:07:48 GMT0x8D732FD81CA3C26512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple14472077db0dfbcd2b40dFri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD818ADA18512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple264313194bcac09c84432Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD8191E09F512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTM2MzIxNGI1OTA3N2ZmYzIxNDRiNiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "aa8fa2a1-6672-40d0-a70f-9118c0a7ddcf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTM2MzIxNGI1OTA3N2ZmYzIxNDRiNiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "53f424e1-782a-4a99-bb8d-3f8b3f1d759a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec651216-001e-001f-1de6-64eb66000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTM2MzIxNGI1OTA3N2ZmYzIxNDRiNiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple363214b59077ffc2144b6Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD81976036512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple4473315f24e0486b6542dFri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD819DA33C512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple52560167bdd655ebf646eFri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD81A4F803512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTYzMjYxMTcxM2YzOGIxNTc0OTQxNiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "53f424e1-782a-4a99-bb8d-3f8b3f1d759a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTYzMjYxMTcxM2YzOGIxNTc0OTQxNiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cd06ed4f-0247-4fd5-a564-870f50e09aaa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec651263-001e-001f-61e6-64eb66000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTYzMjYxMTcxM2YzOGIxNTc0OTQxNiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple632611713f38b15749416Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD81AB6224512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple71753399a02a0f9d4d4e7Fri, 06 Sep 2019 19:07:48 GMTFri, 06 Sep 2019 19:07:48 GMT0x8D732FD81B15701512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple858958d0c1a977c4c44c6Fri, 06 Sep 2019 19:07:48 GMTFri, 06 Sep 2019 19:07:48 GMT0x8D732FD81BACF2A512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTkxNTg2MDhjMzdmODQyNTE0NDRiNCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "cd06ed4f-0247-4fd5-a564-870f50e09aaa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTkxNTg2MDhjMzdmODQyNTE0NDRiNCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "062ba3f9-61f4-49b6-bb7d-551c2f9f0a7c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65127a-001e-001f-77e6-64eb66000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTkxNTg2MDhjMzdmODQyNTE0NDRiNCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple9158608c37f84251444b4Fri, 06 Sep 2019 19:07:48 GMTFri, 06 Sep 2019 19:07:48 GMT0x8D732FD81C2E75A512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "062ba3f9-61f4-49b6-bb7d-551c2f9f0a7c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "409e911b-30dd-47be-9a02-c0a4843376ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65128f-001e-001f-08e6-64eb66000000", + "Body" : "jtclistblobsflatsimplejtclistblobsflatsimple066333a85c5d495a4e4dcbaFri, 06 Sep 2019 19:07:47 GMT\"0x8D732FD81849665\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "409e911b-30dd-47be-9a02-c0a4843376ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple066333a85c5d495a4e4dcba?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" : "f9dbc0ae-ad4a-4574-926c-f837d39808db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6512a3-001e-001f-18e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "f9dbc0ae-ad4a-4574-926c-f837d39808db" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatsimple066333a85c5d495a4e4dcba", "javabloblistblobsflatsimple14472077db0dfbcd2b40d", "javabloblistblobsflatsimple264313194bcac09c84432", "javabloblistblobsflatsimple363214b59077ffc2144b6", "javabloblistblobsflatsimple4473315f24e0486b6542d", "javabloblistblobsflatsimple52560167bdd655ebf646e", "javabloblistblobsflatsimple632611713f38b15749416", "javabloblistblobsflatsimple71753399a02a0f9d4d4e7", "javabloblistblobsflatsimple858958d0c1a977c4c44c6", "javabloblistblobsflatsimple9158608c37f84251444b4", "javabloblistblobsflatsimple10531010728985effd344" ] +} \ 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..38a85411aed5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,232 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725?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" : "d7309506-e7a9-4e9a-8333-d53d0e785b3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD55ED00F7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac29e0-f01e-00ef-1ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "d7309506-e7a9-4e9a-8333-d53d0e785b3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725/javabloblistblobsflatwithtimeoutstillbackedbypagedflux1336031", + "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" : "64a39ed3-ddc0-49e9-b140-d1b07dc3760e", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD55F5089B\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2a06-f01e-00ef-3fe6-643b08000000", + "x-ms-client-request-id" : "64a39ed3-ddc0-49e9-b140-d1b07dc3760e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725/javabloblistblobsflatwithtimeoutstillbackedbypagedflux265271f", + "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" : "f1799c4a-c8db-4102-85bc-a42a68b50d27", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD55FE80B0\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2a3a-f01e-00ef-70e6-643b08000000", + "x-ms-client-request-id" : "f1799c4a-c8db-4102-85bc-a42a68b50d27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725/javabloblistblobsflatwithtimeoutstillbackedbypagedflux3297916", + "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" : "c99323d4-07b1-48b7-9552-579c4dd5f689", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD56049CAB\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2a55-f01e-00ef-09e6-643b08000000", + "x-ms-client-request-id" : "c99323d4-07b1-48b7-9552-579c4dd5f689" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725/javabloblistblobsflatwithtimeoutstillbackedbypagedflux4955800", + "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" : "85c79552-8d2f-4608-81a1-a09838a41d6c", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD560BA337\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2a81-f01e-00ef-30e6-643b08000000", + "x-ms-client-request-id" : "85c79552-8d2f-4608-81a1-a09838a41d6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725/javabloblistblobsflatwithtimeoutstillbackedbypagedflux5800087", + "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" : "49d92cb4-a37e-42cd-bcde-b38866d1729e", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD561605EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2aa9-f01e-00ef-56e6-643b08000000", + "x-ms-client-request-id" : "49d92cb4-a37e-42cd-bcde-b38866d1729e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "29ed3f87-1725-4cf0-8786-e771e32b4421" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2adc-f01e-00ef-07e6-643b08000000", + "Body" : "3javabloblistblobsflatwithtimeoutstillbackedbypagedflux1336031Fri, 06 Sep 2019 19:06:34 GMTFri, 06 Sep 2019 19:06:34 GMT0x8D732FD55F5089B7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux265271fFri, 06 Sep 2019 19:06:34 GMTFri, 06 Sep 2019 19:06:34 GMT0x8D732FD55FE80B07application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux3297916Fri, 06 Sep 2019 19:06:34 GMTFri, 06 Sep 2019 19:06:34 GMT0x8D732FD56049CAB7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue02!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5NTU4MDAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "29ed3f87-1725-4cf0-8786-e771e32b4421", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725?marker=2%21140%21MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5NTU4MDAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f616a2d0-01f1-46b3-95b5-82f358c915ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2b42-f01e-00ef-63e6-643b08000000", + "Body" : "2!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5NTU4MDAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh3javabloblistblobsflatwithtimeoutstillbackedbypagedflux4955800Fri, 06 Sep 2019 19:06:34 GMTFri, 06 Sep 2019 19:06:34 GMT0x8D732FD560BA3377application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux5800087Fri, 06 Sep 2019 19:06:34 GMTFri, 06 Sep 2019 19:06:34 GMT0x8D732FD561605EF7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "f616a2d0-01f1-46b3-95b5-82f358c915ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "19bfe7b8-652d-4124-8ff3-f3d83cfa9372" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2b62-f01e-00ef-02e6-643b08000000", + "Body" : "jtclistblobsflatwithtimeoutstillbackedbypagedfluxjtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725Fri, 06 Sep 2019 19:06:34 GMT\"0x8D732FD55ED00F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "19bfe7b8-652d-4124-8ff3-f3d83cfa9372", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725?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" : "c361ba4b-3267-4254-a10a-11a3442d02e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac2b7f-f01e-00ef-1ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:34 GMT", + "x-ms-client-request-id" : "c361ba4b-3267-4254-a10a-11a3442d02e7" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatwithtimeoutstillbackedbypagedflux0172068725", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux1336031", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux265271f", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux3297916", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux4955800", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux5800087" ] +} \ 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..eee09254ec55 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy02790186ee29fcdf0340d3bd?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" : "17dbf84c-5dfa-402b-a8cf-edc195168a49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD56A1896B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2d5d-f01e-00ef-55e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "17dbf84c-5dfa-402b-a8cf-edc195168a49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy02790186ee29fcdf0340d3bd/javabloblistblobshierarchy18561058fda9f76ff4434", + "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" : "7cd1b8ac-e6d7-48ca-885a-f12b72e29c7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD56B72725\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2de6-f01e-00ef-52e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "7cd1b8ac-e6d7-48ca-885a-f12b72e29c7e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy02790186ee29fcdf0340d3bd?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3f2f877b-354f-4122-8c37-18d11e2fd72a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2e0c-f01e-00ef-75e6-643b08000000", + "Body" : "/javabloblistblobshierarchy18561058fda9f76ff4434Fri, 06 Sep 2019 19:06:35 GMTFri, 06 Sep 2019 19:06:35 GMT0x8D732FD56B72725512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "3f2f877b-354f-4122-8c37-18d11e2fd72a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "df2ac808-b2b1-46d7-834f-3d4756a69382" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2e2b-f01e-00ef-13e6-643b08000000", + "Body" : "jtclistblobshierarchyjtclistblobshierarchy02790186ee29fcdf0340d3bdFri, 06 Sep 2019 19:06:35 GMT\"0x8D732FD56A1896B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "df2ac808-b2b1-46d7-834f-3d4756a69382", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy02790186ee29fcdf0340d3bd?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" : "643b168b-2fba-4481-9331-4c921503e8fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac2e45-f01e-00ef-2ae6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "643b168b-2fba-4481-9331-4c921503e8fe" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierarchy02790186ee29fcdf0340d3bd", "javabloblistblobshierarchy18561058fda9f76ff4434" ] +} \ 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..044ef8021c5f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchymin0504243c4aafae77244c3f?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" : "1f1cc139-7e61-4357-b7de-44a46ca0606e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD56CEE632\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2e71-f01e-00ef-52e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "1f1cc139-7e61-4357-b7de-44a46ca0606e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchymin0504243c4aafae77244c3f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "033798d3-0072-488b-a65e-53e20a30d8aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2ea3-f01e-00ef-7fe6-643b08000000", + "Body" : "//", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "033798d3-0072-488b-a65e-53e20a30d8aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "12509a92-f81e-45f4-af67-2c905848f30f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2eb9-f01e-00ef-15e6-643b08000000", + "Body" : "jtclistblobshierarchyminjtclistblobshierarchymin0504243c4aafae77244c3fFri, 06 Sep 2019 19:06:36 GMT\"0x8D732FD56CEE632\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "12509a92-f81e-45f4-af67-2c905848f30f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchymin0504243c4aafae77244c3f?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" : "eab7961d-6493-4747-9dc3-b6c09bc28233" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac2ed4-f01e-00ef-2ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:36 GMT", + "x-ms-client-request-id" : "eab7961d-6493-4747-9dc3-b6c09bc28233" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierarchymin0504243c4aafae77244c3f" ] +} \ 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..3cd4faf0269d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json @@ -0,0 +1,240 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf?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" : "a15c385b-36f7-402d-9dbe-3fb780ba5ca4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8077CB2B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccb24-f01e-00ef-73e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "a15c385b-36f7-402d-9dbe-3fb780ba5ca4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/a", + "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" : "5941c611-28c8-4293-9721-86d26748b892" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD807ECFC2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccb48-f01e-00ef-14e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "5941c611-28c8-4293-9721-86d26748b892" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/b/a", + "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" : "7ea4474c-2629-4dc1-b783-407d379b56bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD808560FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccb64-f01e-00ef-2ee6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "7ea4474c-2629-4dc1-b783-407d379b56bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/c", + "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" : "ade601e4-d817-4e12-92f6-9f1e711d7b99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD808C1953\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccb8e-f01e-00ef-55e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "ade601e4-d817-4e12-92f6-9f1e711d7b99" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/d/a", + "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" : "63afea76-0caf-40e4-9350-a8a9c5fa0551" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8093952C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccbc3-f01e-00ef-80e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "63afea76-0caf-40e4-9350-a8a9c5fa0551" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/e", + "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" : "024ede19-1a1f-4549-97c9-d7c265e192ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD809B5F34\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccbf0-f01e-00ef-2ae6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "024ede19-1a1f-4549-97c9-d7c265e192ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/f", + "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" : "db051d9b-3f99-4cd0-8c9e-5ed15a1c04e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD80A30229\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccc0c-f01e-00ef-46e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "db051d9b-3f99-4cd0-8c9e-5ed15a1c04e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf/g/a", + "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" : "6dc4cc6e-534c-437d-89cf-5cd2cb20a476" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD80AC5336\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccc35-f01e-00ef-6ae6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "6dc4cc6e-534c-437d-89cf-5cd2cb20a476" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a27f4481-8606-4e17-a5fb-2b4ce20ee5ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adaccc58-f01e-00ef-0de6-643b08000000", + "Body" : "/aFri, 06 Sep 2019 19:07:46 GMTFri, 06 Sep 2019 19:07:46 GMT0x8D732FD807ECFC20application/octet-streamAppendBlobHottrueunlockedavailabletrue0b/cFri, 06 Sep 2019 19:07:46 GMTFri, 06 Sep 2019 19:07:46 GMT0x8D732FD808C19530application/octet-streamAppendBlobHottrueunlockedavailabletrue0d/eFri, 06 Sep 2019 19:07:46 GMTFri, 06 Sep 2019 19:07:46 GMT0x8D732FD809B5F340application/octet-streamAppendBlobHottrueunlockedavailabletrue0fFri, 06 Sep 2019 19:07:46 GMTFri, 06 Sep 2019 19:07:46 GMT0x8D732FD80A302290application/octet-streamAppendBlobHottrueunlockedavailabletrue0g/", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "a27f4481-8606-4e17-a5fb-2b4ce20ee5ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "98092e4c-f7c1-4149-a8e3-fbac74128486" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adaccca6-f01e-00ef-53e6-643b08000000", + "Body" : "jtclistblobshierdelimjtclistblobshierdelim006205e9841106b4954310bfFri, 06 Sep 2019 19:07:45 GMT\"0x8D732FD8077CB2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "98092e4c-f7c1-4149-a8e3-fbac74128486", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim006205e9841106b4954310bf?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" : "ccbff0a3-48a4-4b1b-af72-7aedf7464ad6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adacccb4-f01e-00ef-60e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "ccbff0a3-48a4-4b1b-af72-7aedf7464ad6" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierdelim006205e9841106b4954310bf" ] +} \ 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..94f67876eae1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiererror01467784f5ad9c631745d0b3?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" : "2791a003-2459-45a5-8845-0417cb17df74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD82077A71\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6512b6-001e-001f-28e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "2791a003-2459-45a5-8845-0417cb17df74" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiererror179023cf79c9403643418fbb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b0f0fbc7-9bf2-4568-afcd-80b7dc6bba25" + }, + "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" : "ec6512d6-001e-001f-3fe6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec6512d6-001e-001f-3fe6-64eb66000000\nTime:2019-09-06T19:07:48.6257774Z", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "b0f0fbc7-9bf2-4568-afcd-80b7dc6bba25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4e83ba2d-2fdd-4df2-b373-bd4baf32396c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6512e6-001e-001f-4ee6-64eb66000000", + "Body" : "jtclistblobshiererrorjtclistblobshiererror01467784f5ad9c631745d0b3Fri, 06 Sep 2019 19:07:48 GMT\"0x8D732FD82077A71\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "4e83ba2d-2fdd-4df2-b373-bd4baf32396c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiererror01467784f5ad9c631745d0b3?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" : "e1b0e756-93d2-4ec9-98ca-c89ba3ec913b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6512fd-001e-001f-60e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:48 GMT", + "x-ms-client-request-id" : "e1b0e756-93d2-4ec9-98ca-c89ba3ec913b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshiererror01467784f5ad9c631745d0b3", "jtclistblobshiererror179023cf79c9403643418fbb" ] +} \ 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..6efecd6a6551 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json @@ -0,0 +1,348 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268?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" : "301f8784-3873-4949-8c61-bb49bdfce02b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8105AF4A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccd75-f01e-00ef-0be6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "301f8784-3873-4949-8c61-bb49bdfce02b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker197534c49ca4a82ad5455", + "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" : "eb435dcf-8c9a-485b-ad26-817e513ba4b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD810C8B70\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccda1-f01e-00ef-33e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "eb435dcf-8c9a-485b-ad26-817e513ba4b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker207886768f39693223434", + "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" : "3da14e10-f56e-4bb7-b45a-e13fd160484a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81158E41\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccdb1-f01e-00ef-41e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "3da14e10-f56e-4bb7-b45a-e13fd160484a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker399073dbbc0f3117bb4b0", + "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" : "33b5c9f0-24a1-47d1-ad7f-dacbaa3babd4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD811D0A1B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccdc6-f01e-00ef-51e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "33b5c9f0-24a1-47d1-ad7f-dacbaa3babd4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker472403ddb0e023398243a", + "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" : "77e115f0-a08a-4d0e-b3d5-f404f748b097" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD812437B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccdea-f01e-00ef-72e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "77e115f0-a08a-4d0e-b3d5-f404f748b097" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker55827024e76a57599b427", + "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" : "9b716810-8917-4be4-b539-a3106e6ef9b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD812AC8FA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacce04-f01e-00ef-06e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "9b716810-8917-4be4-b539-a3106e6ef9b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker674549533235d6a83d4d7", + "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" : "601b6895-712e-438e-b9e3-0ecb732d088b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8133CBCB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacce3b-f01e-00ef-31e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "601b6895-712e-438e-b9e3-0ecb732d088b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker7677425cea1f19a0204d1", + "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" : "561d7eaa-9fd7-4ff6-9b21-b6595115dc2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD813AAB3F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacce4e-f01e-00ef-43e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:46 GMT", + "x-ms-client-request-id" : "561d7eaa-9fd7-4ff6-9b21-b6595115dc2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker87700603cdc7cac3aa4cc", + "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" : "6097d80d-dfd5-4be7-af10-affa92f6f117" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8141B1C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacce64-f01e-00ef-56e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "6097d80d-dfd5-4be7-af10-affa92f6f117" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker9222171f563b1699dd406", + "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" : "c60fcf6d-5818-4031-85c4-5a3e00b6e721" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD81477F8B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacce79-f01e-00ef-68e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "c60fcf6d-5818-4031-85c4-5a3e00b6e721" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268/javabloblistblobshiermarker1064746cb32fc98fa8641", + "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" : "354fd26c-e237-4210-b332-a2215f7a7c54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD814E8617\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacce93-f01e-00ef-7ee6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "354fd26c-e237-4210-b332-a2215f7a7c54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "baa1c541-2c5a-4c57-a6c3-88f75a172900" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacceb1-f01e-00ef-18e6-643b08000000", + "Body" : "6/javabloblistblobshiermarker1064746cb32fc98fa8641Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD814E8617512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker197534c49ca4a82ad5455Fri, 06 Sep 2019 19:07:46 GMTFri, 06 Sep 2019 19:07:46 GMT0x8D732FD810C8B70512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker207886768f39693223434Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD81158E41512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker399073dbbc0f3117bb4b0Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD811D0A1B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker472403ddb0e023398243aFri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD812437B8512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker55827024e76a57599b427Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD812AC8FA512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY3NDU0OTUzMzIzNWQ2YTgzZDRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "baa1c541-2c5a-4c57-a6c3-88f75a172900", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268?delimiter=/&marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY3NDU0OTUzMzIzNWQ2YTgzZDRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "45ed89d5-e3e0-44da-a107-5f884f1c3858" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adaccecd-f01e-00ef-31e6-643b08000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY3NDU0OTUzMzIzNWQ2YTgzZDRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6/javabloblistblobshiermarker674549533235d6a83d4d7Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD8133CBCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker7677425cea1f19a0204d1Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD813AAB3F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker87700603cdc7cac3aa4ccFri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD8141B1C6512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker9222171f563b1699dd406Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD81477F8B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "45ed89d5-e3e0-44da-a107-5f884f1c3858", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268?delimiter=/&marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY3NDU0OTUzMzIzNWQ2YTgzZDRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5f1d8d27-1aae-459f-9293-96465307d5cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec650ff6-001e-001f-3ae6-64eb66000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY3NDU0OTUzMzIzNWQ2YTgzZDRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6/javabloblistblobshiermarker674549533235d6a83d4d7Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD8133CBCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker7677425cea1f19a0204d1Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD813AAB3F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker87700603cdc7cac3aa4ccFri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD8141B1C6512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker9222171f563b1699dd406Fri, 06 Sep 2019 19:07:47 GMTFri, 06 Sep 2019 19:07:47 GMT0x8D732FD81477F8B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "5f1d8d27-1aae-459f-9293-96465307d5cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ee421ed8-c8fc-410f-9be5-6780c7e27d82" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65104a-001e-001f-05e6-64eb66000000", + "Body" : "jtclistblobshiermarkerjtclistblobshiermarker019203d082e8a89b624e268Fri, 06 Sep 2019 19:07:46 GMT\"0x8D732FD8105AF4A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "ee421ed8-c8fc-410f-9be5-6780c7e27d82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker019203d082e8a89b624e268?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" : "fe06c09a-5adb-4a9b-8f95-10d376385625" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec651060-001e-001f-1be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:47 GMT", + "x-ms-client-request-id" : "fe06c09a-5adb-4a9b-8f95-10d376385625" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshiermarker019203d082e8a89b624e268", "javabloblistblobshiermarker197534c49ca4a82ad5455", "javabloblistblobshiermarker207886768f39693223434", "javabloblistblobshiermarker399073dbbc0f3117bb4b0", "javabloblistblobshiermarker472403ddb0e023398243a", "javabloblistblobshiermarker55827024e76a57599b427", "javabloblistblobshiermarker674549533235d6a83d4d7", "javabloblistblobshiermarker7677425cea1f19a0204d1", "javabloblistblobshiermarker87700603cdc7cac3aa4cc", "javabloblistblobshiermarker9222171f563b1699dd406", "javabloblistblobshiermarker1064746cb32fc98fa8641" ] +} \ 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..6914962c6542 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb?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" : "f57b3df2-4f08-4a42-95f4-6e24456eb356" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD56E5CF44\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2ef2-f01e-00ef-4be6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:36 GMT", + "x-ms-client-request-id" : "f57b3df2-4f08-4a42-95f4-6e24456eb356" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/ajavabloblistblobshieroptionscopy11441496dc8dfde8ca", + "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" : "6ee65a7e-f4df-45cf-acad-1ba2bfd3933b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD56EBFF57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2f14-f01e-00ef-6ae6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:36 GMT", + "x-ms-client-request-id" : "6ee65a7e-f4df-45cf-acad-1ba2bfd3933b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/cjavabloblistblobshieroptionscopy2635574413c05c2628", + "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" : "552ea2fe-92e7-49aa-abdc-bef039ccfac1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4dd5ae96-1369-4813-8fad-a7a28034bc48", + "ETag" : "\"0x8D732FD57035D6C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "adac2f36-f01e-00ef-08e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:36 GMT", + "x-ms-client-request-id" : "552ea2fe-92e7-49aa-abdc-bef039ccfac1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/cjavabloblistblobshieroptionscopy2635574413c05c2628", + "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" : "93c07561-9a20-4b6e-b377-6622b7287089" + }, + "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" : "Fri, 06 Sep 2019 19:06: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" : "Fri, 06 Sep 2019 19:06:36 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "adac2fc0-f01e-00ef-03e6-643b08000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "4dd5ae96-1369-4813-8fad-a7a28034bc48", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/ajavabloblistblobshieroptionscopy11441496dc8dfde8ca", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:06:36 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:06:36 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD57035D6C\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "93c07561-9a20-4b6e-b377-6622b7287089" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/mjavabloblistblobshieroptionscopy3670990e8bc9679507", + "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" : "c973b471-7671-4400-8225-9af6452be7e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD57B39D63\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac326c-f01e-00ef-6ee6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "c973b471-7671-4400-8225-9af6452be7e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/ajavabloblistblobshieroptionscopy11441496dc8dfde8ca?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", + "x-ms-client-request-id" : "888f168c-65b5-40ad-84c1-8bd270d662fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:06:37.6118615Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD56EBFF57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac328b-f01e-00ef-04e6-643b08000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "888f168c-65b5-40ad-84c1-8bd270d662fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/ujavabloblistblobshieroptionscopy444799a67a6c9799c5?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dfb7e128-9030-4e7f-ba44-0781acbef950", + "Content-Type" : "application/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" : "adac32b4-f01e-00ef-20e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "dfb7e128-9030-4e7f-ba44-0781acbef950" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6204bd8b-b7f6-40ed-904c-c18a759304f9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac32ce-f01e-00ef-34e6-643b08000000", + "Body" : "ajavabloblistblobshieroptionscopy11441496dc8dfde8caFri, 06 Sep 2019 19:06:36 GMTFri, 06 Sep 2019 19:06:36 GMT0x8D732FD56EBFF57512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionscopy2635574413c05c2628Fri, 06 Sep 2019 19:06:36 GMTFri, 06 Sep 2019 19:06:36 GMT0x8D732FD57035D6C512application/octet-stream0PageBlobHottrueunlockedavailable4dd5ae96-1369-4813-8fad-a7a28034bc48https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb/ajavabloblistblobshieroptionscopy11441496dc8dfde8casuccess512/512Fri, 06 Sep 2019 19:06:36 GMTtrue0mjavabloblistblobshieroptionscopy3670990e8bc9679507Fri, 06 Sep 2019 19:06:37 GMTFri, 06 Sep 2019 19:06:37 GMT0x8D732FD57B39D63512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "6204bd8b-b7f6-40ed-904c-c18a759304f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "51b0aa73-40ba-4c04-8058-b0abce24672e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac331b-f01e-00ef-74e6-643b08000000", + "Body" : "jtclistblobshieroptionscopyjtclistblobshieroptionscopy081637af704fdbafe94cbFri, 06 Sep 2019 19:06:36 GMT\"0x8D732FD56E5CF44\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "51b0aa73-40ba-4c04-8058-b0abce24672e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy081637af704fdbafe94cb?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" : "8f863e06-171d-41a9-b061-eea74dab56e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac332d-f01e-00ef-02e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "8f863e06-171d-41a9-b061-eea74dab56e6" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionscopy081637af704fdbafe94cb", "javabloblistblobshieroptionscopy11441496dc8dfde8ca", "javabloblistblobshieroptionscopy2635574413c05c2628", "javabloblistblobshieroptionscopy3670990e8bc9679507", "javabloblistblobshieroptionscopy444799a67a6c9799c5" ] +} \ 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..96cdc96833fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0108010fd22b3cf11c4?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" : "1a3acb13-a25f-4c3a-8381-5e506764514e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD5A212D27\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3e94-f01e-00ef-42e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "1a3acb13-a25f-4c3a-8381-5e506764514e" + }, + "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" : "ee02682b-a0b6-4861-9b77-0c3dc5824f95", + "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" : "adac3eae-f01e-00ef-57e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "ee02682b-a0b6-4861-9b77-0c3dc5824f95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0108010fd22b3cf11c4/javabloblistblobshieroptionsdeleted1441593c8b3c8e598", + "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" : "609008dc-dbe4-43bf-add2-e4d236991072" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD6C19BF4C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac8153-f01e-00ef-01e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:11 GMT", + "x-ms-client-request-id" : "609008dc-dbe4-43bf-add2-e4d236991072" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0108010fd22b3cf11c4/javabloblistblobshieroptionsdeleted1441593c8b3c8e598", + "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" : "d72cc14a-c34e-488d-bd3a-1aacce21a270" + }, + "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" : "adac8190-f01e-00ef-30e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:11 GMT", + "x-ms-client-request-id" : "d72cc14a-c34e-488d-bd3a-1aacce21a270" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0108010fd22b3cf11c4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8d4ee252-2f2e-4245-b18a-e5e77fdb9a5d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac81f9-f01e-00ef-07e6-643b08000000", + "Body" : "javabloblistblobshieroptionsdeleted1441593c8b3c8e598trueFri, 06 Sep 2019 19:07:11 GMTFri, 06 Sep 2019 19:07:11 GMT0x8D732FD6C19BF4C0application/octet-streamAppendBlobHottruetrueFri, 06 Sep 2019 19:07:11 GMT10", + "Date" : "Fri, 06 Sep 2019 19:07:11 GMT", + "x-ms-client-request-id" : "8d4ee252-2f2e-4245-b18a-e5e77fdb9a5d", + "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" : "d393a130-c84f-4933-8fc3-8c4e2d3f90c0", + "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" : "adac821d-f01e-00ef-28e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:11 GMT", + "x-ms-client-request-id" : "d393a130-c84f-4933-8fc3-8c4e2d3f90c0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "86150efa-a071-45e9-a718-9378b8e65698" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacc22f-f01e-00ef-1de6-643b08000000", + "Body" : "jtclistblobshieroptionsdeletedjtclistblobshieroptionsdeleted0108010fd22b3cf11c4Fri, 06 Sep 2019 19:06:41 GMT\"0x8D732FD5A212D27\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:41 GMT", + "x-ms-client-request-id" : "86150efa-a071-45e9-a718-9378b8e65698", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0108010fd22b3cf11c4?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" : "508aa5d9-ce98-4edd-8144-5b26c3bdb187" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adacc251-f01e-00ef-3ce6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:41 GMT", + "x-ms-client-request-id" : "508aa5d9-ce98-4edd-8144-5b26c3bdb187" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsdeleted0108010fd22b3cf11c4", "javabloblistblobshieroptionsdeleted1441593c8b3c8e598" ] +} \ 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..cc7b02114c67 --- /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://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail0401991650a079968f459?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" : "d368c361-daa9-4030-ab4d-6096d9bd2f3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD804B0AD0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacca58-f01e-00ef-3ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "d368c361-daa9-4030-ab4d-6096d9bd2f3b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b4c27dc7-49b4-4bf4-b406-e9be6094e058" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacca87-f01e-00ef-63e6-643b08000000", + "Body" : "jtclistblobshieroptionsfailjtclistblobshieroptionsfail0401991650a079968f459Fri, 06 Sep 2019 19:07:45 GMT\"0x8D732FD804B0AD0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "b4c27dc7-49b4-4bf4-b406-e9be6094e058", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail0401991650a079968f459?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" : "dd2fb957-1e20-4443-94bf-2162787b912d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adaccaa1-f01e-00ef-7ae6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "dd2fb957-1e20-4443-94bf-2162787b912d" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsfail0401991650a079968f459" ] +} \ 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..468b175595d9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail01141250ac597eaf4644e?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" : "50543ee7-d1ee-4324-9332-abe2b740cae9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8062DE77\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adaccad4-f01e-00ef-2ae6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "50543ee7-d1ee-4324-9332-abe2b740cae9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b08a0404-a87d-43a4-ad88-8c2dcfdc3f42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adaccaef-f01e-00ef-44e6-643b08000000", + "Body" : "jtclistblobshieroptionsfailjtclistblobshieroptionsfail01141250ac597eaf4644eFri, 06 Sep 2019 19:07:45 GMT\"0x8D732FD8062DE77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "b08a0404-a87d-43a4-ad88-8c2dcfdc3f42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail01141250ac597eaf4644e?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" : "4ce7919e-31db-4e22-9a2d-eb742258e2df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adaccb09-f01e-00ef-5ae6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "4ce7919e-31db-4e22-9a2d-eb742258e2df" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsfail01141250ac597eaf4644e" ] +} \ 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..0c35dbba085a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2?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" : "74bfabe9-e552-4d3f-802f-fc465c5626e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7F4344BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc65a-f01e-00ef-35e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "74bfabe9-e552-4d3f-802f-fc465c5626e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/ajavabloblistblobshieroptionsmaxresults146112c7c53c052", + "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" : "875ed929-b24d-46be-8b4b-d5a4ed13bcf2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7F49AFE6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc669-f01e-00ef-43e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "875ed929-b24d-46be-8b4b-d5a4ed13bcf2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/cjavabloblistblobshieroptionsmaxresults241807615637adf", + "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" : "af892a7c-af35-4ee0-862b-c89280a75ae0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "a3a41e63-493f-4cce-890e-f520cffb6e40", + "ETag" : "\"0x8D732FD7F61AA5D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "adacc675-f01e-00ef-4fe6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "af892a7c-af35-4ee0-862b-c89280a75ae0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/cjavabloblistblobshieroptionsmaxresults241807615637adf", + "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" : "9be8728e-4453-408a-823b-e9e304a44310" + }, + "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" : "Fri, 06 Sep 2019 19:07: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" : "Fri, 06 Sep 2019 19:07:44 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "adacc6eb-f01e-00ef-2ee6-643b08000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "a3a41e63-493f-4cce-890e-f520cffb6e40", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/ajavabloblistblobshieroptionsmaxresults146112c7c53c052", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:07:44 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD7F61AA5D\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "9be8728e-4453-408a-823b-e9e304a44310" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/mjavabloblistblobshieroptionsmaxresults3481572e86ea032", + "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" : "50481f62-ad82-43a9-8be1-3b2acdfe7014" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD800CB8FC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc933-f01e-00ef-2fe6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "50481f62-ad82-43a9-8be1-3b2acdfe7014" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/ajavabloblistblobshieroptionsmaxresults146112c7c53c052?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", + "x-ms-client-request-id" : "4ad89285-dd9a-48e0-a7e3-19260e0020b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:07:45.3037012Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7F49AFE6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc954-f01e-00ef-49e6-643b08000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "4ad89285-dd9a-48e0-a7e3-19260e0020b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2/ujavabloblistblobshieroptionsmaxresults4362238bf6d0a0b?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "074df05b-c34d-4eb1-b04c-cab2862ae9de", + "Content-Type" : "application/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" : "adacc98b-f01e-00ef-79e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "074df05b-c34d-4eb1-b04c-cab2862ae9de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "adff0ba4-4b5e-41ee-adef-9da68db4971d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacc9a7-f01e-00ef-14e6-643b08000000", + "Body" : "1ajavabloblistblobshieroptionsmaxresults146112c7c53c052Fri, 06 Sep 2019 19:07:43 GMTFri, 06 Sep 2019 19:07:43 GMT0x8D732FD7F49AFE6512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2hpZXJvcHRpb25zbWF4cmVzdWx0czI0MTgwNzYxNTYzN2FkZiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "adff0ba4-4b5e-41ee-adef-9da68db4971d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c0dfd8a-49e2-4e3d-8ca9-4ca580905fc5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacc9c4-f01e-00ef-30e6-643b08000000", + "Body" : "jtclistblobshieroptionsmaxresultsjtclistblobshieroptionsmaxresults0721032655319fe3c2Fri, 06 Sep 2019 19:07:43 GMT\"0x8D732FD7F4344BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "4c0dfd8a-49e2-4e3d-8ca9-4ca580905fc5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0721032655319fe3c2?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" : "e3a2f2bc-a029-45e0-846c-2011392062f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adacc9ea-f01e-00ef-55e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:45 GMT", + "x-ms-client-request-id" : "e3a2f2bc-a029-45e0-846c-2011392062f3" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsmaxresults0721032655319fe3c2", "javabloblistblobshieroptionsmaxresults146112c7c53c052", "javabloblistblobshieroptionsmaxresults241807615637adf", "javabloblistblobshieroptionsmaxresults3481572e86ea032", "javabloblistblobshieroptionsmaxresults4362238bf6d0a0b" ] +} \ 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..46abdeb13349 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4?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" : "fbc62e69-8508-4c54-b61b-71e02bd5f182" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD57F1DC1E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac336e-f01e-00ef-3ae6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "fbc62e69-8508-4c54-b61b-71e02bd5f182" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/ajavabloblistblobshieroptionsmetadata17774145a0c0dee0", + "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" : "bc628fbb-cd6f-44ab-8b9f-167e6a090195" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD57F7E28C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3395-f01e-00ef-58e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:37 GMT", + "x-ms-client-request-id" : "bc628fbb-cd6f-44ab-8b9f-167e6a090195" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/cjavabloblistblobshieroptionsmetadata2817241491baa06d", + "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" : "573b478d-d415-4742-8615-e80e387591e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "69d42191-071c-4f21-be46-1e7afd8c2d11", + "ETag" : "\"0x8D732FD58118B29\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "adac33ba-f01e-00ef-73e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:38 GMT", + "x-ms-client-request-id" : "573b478d-d415-4742-8615-e80e387591e8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/cjavabloblistblobshieroptionsmetadata2817241491baa06d", + "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" : "1b3791be-5101-430d-b1a1-b94c68c62fe7" + }, + "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" : "Fri, 06 Sep 2019 19:06: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" : "Fri, 06 Sep 2019 19:06:38 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "adac3469-f01e-00ef-79e6-643b08000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "69d42191-071c-4f21-be46-1e7afd8c2d11", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/ajavabloblistblobshieroptionsmetadata17774145a0c0dee0", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:06:38 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:06:38 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD58118B29\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "1b3791be-5101-430d-b1a1-b94c68c62fe7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/mjavabloblistblobshieroptionsmetadata38967437610b8797", + "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" : "30a30d19-f6c7-4482-a0bb-4e9901bb273c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD58BDF9A5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3801-f01e-00ef-0de6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "30a30d19-f6c7-4482-a0bb-4e9901bb273c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/ajavabloblistblobshieroptionsmetadata17774145a0c0dee0?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", + "x-ms-client-request-id" : "bd8c8b5a-3073-4870-8330-2b3b877979a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:06:39.3614846Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD57F7E28C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3816-f01e-00ef-20e6-643b08000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "bd8c8b5a-3073-4870-8330-2b3b877979a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4/ujavabloblistblobshieroptionsmetadata425067c5c586f7b4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "86062f73-742a-40c9-a582-0b0c7ef0d921", + "Content-Type" : "application/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" : "adac3837-f01e-00ef-3ce6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "86062f73-742a-40c9-a582-0b0c7ef0d921" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ab4f4562-b5d4-4c36-9443-023b266cdee1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac385c-f01e-00ef-5fe6-643b08000000", + "Body" : "ajavabloblistblobshieroptionsmetadata17774145a0c0dee0Fri, 06 Sep 2019 19:06:38 GMTFri, 06 Sep 2019 19:06:38 GMT0x8D732FD57F7E28C512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionsmetadata2817241491baa06dFri, 06 Sep 2019 19:06:38 GMTFri, 06 Sep 2019 19:06:38 GMT0x8D732FD58118B29512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobshieroptionsmetadata38967437610b8797Fri, 06 Sep 2019 19:06:39 GMTFri, 06 Sep 2019 19:06:39 GMT0x8D732FD58BDF9A5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0bar", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "ab4f4562-b5d4-4c36-9443-023b266cdee1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cec69939-d897-46e5-ad60-282f0c534384" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac3884-f01e-00ef-07e6-643b08000000", + "Body" : "jtclistblobshieroptionsmetadatajtclistblobshieroptionsmetadata02616722102a28e38d4Fri, 06 Sep 2019 19:06:37 GMT\"0x8D732FD57F1DC1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "cec69939-d897-46e5-ad60-282f0c534384", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02616722102a28e38d4?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" : "3ab71b16-8f43-4e37-9f66-0d40e645bd8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac38aa-f01e-00ef-24e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "3ab71b16-8f43-4e37-9f66-0d40e645bd8c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsmetadata02616722102a28e38d4", "javabloblistblobshieroptionsmetadata17774145a0c0dee0", "javabloblistblobshieroptionsmetadata2817241491baa06d", "javabloblistblobshieroptionsmetadata38967437610b8797", "javabloblistblobshieroptionsmetadata425067c5c586f7b4" ] +} \ 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..8cb750374d8d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40?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" : "97554d62-b58a-438b-8494-02aa8655bdfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7E3E8CAF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc26f-f01e-00ef-55e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:41 GMT", + "x-ms-client-request-id" : "97554d62-b58a-438b-8494-02aa8655bdfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/ajavabloblistblobshieroptionsprefix115447dd826b7e428", + "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" : "40ba07d3-f608-4737-9692-426ea2fa323e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7E45E4D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc285-f01e-00ef-69e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:42 GMT", + "x-ms-client-request-id" : "40ba07d3-f608-4737-9692-426ea2fa323e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/cjavabloblistblobshieroptionsprefix2415965273efcc57c", + "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" : "990dbd74-f00f-4208-99b8-1f44b2ea7e8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "99a08399-e74e-4cdb-8201-1c49f915b3af", + "ETag" : "\"0x8D732FD7E579C48\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "adacc29f-f01e-00ef-7ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:42 GMT", + "x-ms-client-request-id" : "990dbd74-f00f-4208-99b8-1f44b2ea7e8f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/cjavabloblistblobshieroptionsprefix2415965273efcc57c", + "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" : "29091f71-a0d8-41a3-8015-3da39521d821" + }, + "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" : "Fri, 06 Sep 2019 19:07:42 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" : "Fri, 06 Sep 2019 19:07:42 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "adacc2f8-f01e-00ef-48e6-643b08000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "99a08399-e74e-4cdb-8201-1c49f915b3af", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/ajavabloblistblobshieroptionsprefix115447dd826b7e428", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:07:42 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:07:42 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD7E579C48\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "29091f71-a0d8-41a3-8015-3da39521d821" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/mjavabloblistblobshieroptionsprefix326042257212f1559", + "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" : "429c0fd8-4142-4a7d-b96c-d7ec7864f07a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7F04A738\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc56d-f01e-00ef-66e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "429c0fd8-4142-4a7d-b96c-d7ec7864f07a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/ajavabloblistblobshieroptionsprefix115447dd826b7e428?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", + "x-ms-client-request-id" : "dc128ac3-beef-44c0-b8c4-0aeae307e592" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:07:43.5811034Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD7E45E4D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adacc590-f01e-00ef-06e6-643b08000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "dc128ac3-beef-44c0-b8c4-0aeae307e592" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40/ujavabloblistblobshieroptionsprefix47584023e5910ed44?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5eba4c2b-00b1-4c76-aee4-89379f78c8e5", + "Content-Type" : "application/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" : "adacc5b8-f01e-00ef-28e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "5eba4c2b-00b1-4c76-aee4-89379f78c8e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "420dd460-2866-453a-a013-c1796d015392" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacc617-f01e-00ef-79e6-643b08000000", + "Body" : "aajavabloblistblobshieroptionsprefix115447dd826b7e428Fri, 06 Sep 2019 19:07:42 GMTFri, 06 Sep 2019 19:07:42 GMT0x8D732FD7E45E4D3512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "420dd460-2866-453a-a013-c1796d015392", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c31df934-dbb8-460a-9ced-516add964451" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adacc62c-f01e-00ef-0ae6-643b08000000", + "Body" : "jtclistblobshieroptionsprefixjtclistblobshieroptionsprefix00476241f508c02ade40Fri, 06 Sep 2019 19:07:42 GMT\"0x8D732FD7E3E8CAF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "c31df934-dbb8-460a-9ced-516add964451", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix00476241f508c02ade40?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" : "7911f09d-e4cb-40fe-88ba-e44f321163c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adacc642-f01e-00ef-1ee6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:07:43 GMT", + "x-ms-client-request-id" : "7911f09d-e4cb-40fe-88ba-e44f321163c0" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsprefix00476241f508c02ade40", "javabloblistblobshieroptionsprefix115447dd826b7e428", "javabloblistblobshieroptionsprefix2415965273efcc57c", "javabloblistblobshieroptionsprefix326042257212f1559", "javabloblistblobshieroptionsprefix47584023e5910ed44" ] +} \ 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..79a969579f4b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2?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" : "ff754da4-2459-4489-96be-ca1d038512d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD58EB9500\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac38d3-f01e-00ef-47e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "ff754da4-2459-4489-96be-ca1d038512d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/ajavabloblistblobshieroptionsuncommitted126982414406a1c", + "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" : "5ab06e0b-62ca-4cdb-b44b-9edbe47bd720" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD58F1C028\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3902-f01e-00ef-6de6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:39 GMT", + "x-ms-client-request-id" : "5ab06e0b-62ca-4cdb-b44b-9edbe47bd720" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/cjavabloblistblobshieroptionsuncommitted292558ce7159bd8", + "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" : "47fc4b59-c52b-4c4e-95a9-4000f756e09a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ae13e8f3-8a2d-4b58-9a41-781f6f604067", + "ETag" : "\"0x8D732FD5944D5DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "adac391b-f01e-00ef-04e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:40 GMT", + "x-ms-client-request-id" : "47fc4b59-c52b-4c4e-95a9-4000f756e09a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/cjavabloblistblobshieroptionsuncommitted292558ce7159bd8", + "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" : "2e2271f8-3524-48f5-b9d8-3af512dd3553" + }, + "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" : "Fri, 06 Sep 2019 19:06:40 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" : "Fri, 06 Sep 2019 19:06:40 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "adac3aca-f01e-00ef-6ee6-643b08000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "ae13e8f3-8a2d-4b58-9a41-781f6f604067", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/ajavabloblistblobshieroptionsuncommitted126982414406a1c", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:06:40 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:06:40 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FD5944D5DE\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "2e2271f8-3524-48f5-b9d8-3af512dd3553" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/mjavabloblistblobshieroptionsuncommitted3038942047b2890", + "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" : "9e713b0a-e3a4-4242-96f5-d9c323ea1a71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD59F3B5F4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3dc1-f01e-00ef-10e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "9e713b0a-e3a4-4242-96f5-d9c323ea1a71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/ajavabloblistblobshieroptionsuncommitted126982414406a1c?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", + "x-ms-client-request-id" : "db4f45f4-4e4f-4354-a70e-3134dc37d8e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:06:41.3853626Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD58F1C028\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac3ddb-f01e-00ef-26e6-643b08000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "db4f45f4-4e4f-4354-a70e-3134dc37d8e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2/ujavabloblistblobshieroptionsuncommitted433352227d1ad2b?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bf86a612-bd2d-4bbc-aff0-ad377488d0f3", + "Content-Type" : "application/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" : "adac3df7-f01e-00ef-3de6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "bf86a612-bd2d-4bbc-aff0-ad377488d0f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a95c0131-37ce-45e4-9e05-d15436a90e34" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac3e1b-f01e-00ef-5be6-643b08000000", + "Body" : "ajavabloblistblobshieroptionsuncommitted126982414406a1cFri, 06 Sep 2019 19:06:39 GMTFri, 06 Sep 2019 19:06:39 GMT0x8D732FD58F1C028512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionsuncommitted292558ce7159bd8Fri, 06 Sep 2019 19:06:40 GMTFri, 06 Sep 2019 19:06:40 GMT0x8D732FD5944D5DE512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobshieroptionsuncommitted3038942047b2890Fri, 06 Sep 2019 19:06:41 GMTFri, 06 Sep 2019 19:06:41 GMT0x8D732FD59F3B5F4512application/octet-stream0PageBlobHottrueunlockedavailabletrue0ujavabloblistblobshieroptionsuncommitted433352227d1ad2b0BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "a95c0131-37ce-45e4-9e05-d15436a90e34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0b8db042-a5aa-4b23-bfa3-1a04acd186e4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac3e5b-f01e-00ef-11e6-643b08000000", + "Body" : "jtclistblobshieroptionsuncommittedjtclistblobshieroptionsuncommitted0972400ea6f5f18e2Fri, 06 Sep 2019 19:06:39 GMT\"0x8D732FD58EB9500\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "0b8db042-a5aa-4b23-bfa3-1a04acd186e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0972400ea6f5f18e2?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" : "502b9602-18cc-4503-bef1-c74d10b40515" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac3e70-f01e-00ef-23e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:41 GMT", + "x-ms-client-request-id" : "502b9602-18cc-4503-bef1-c74d10b40515" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsuncommitted0972400ea6f5f18e2", "javabloblistblobshieroptionsuncommitted126982414406a1c", "javabloblistblobshieroptionsuncommitted292558ce7159bd8", "javabloblistblobshieroptionsuncommitted3038942047b2890", "javabloblistblobshieroptionsuncommitted433352227d1ad2b" ] +} \ 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..d252daaa2cf4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,232 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1?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" : "85946cd1-437a-4ea5-8483-8f28d18f5662" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD5647BA85\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:06:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adac2b9e-f01e-00ef-3be6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "85946cd1-437a-4ea5-8483-8f28d18f5662" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1/javabloblistblobshierwithtimeoutstillbackedbypagedflux1809726", + "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" : "b7a0f015-dde0-4f05-b7b0-aeea9202bcf7", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD564EFDC4\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2bcc-f01e-00ef-65e6-643b08000000", + "x-ms-client-request-id" : "b7a0f015-dde0-4f05-b7b0-aeea9202bcf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1/javabloblistblobshierwithtimeoutstillbackedbypagedflux2878473", + "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" : "c22028fa-478f-42b5-abc0-22487cb4e7a9", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD5655B618\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2be9-f01e-00ef-80e6-643b08000000", + "x-ms-client-request-id" : "c22028fa-478f-42b5-abc0-22487cb4e7a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1/javabloblistblobshierwithtimeoutstillbackedbypagedflux3877026", + "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" : "bc8c4856-4e37-4683-acb2-a63bbb119231", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD565BAAF9\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2c09-f01e-00ef-1be6-643b08000000", + "x-ms-client-request-id" : "bc8c4856-4e37-4683-acb2-a63bbb119231" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1/javabloblistblobshierwithtimeoutstillbackedbypagedflux493284e", + "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" : "ca6a6a6b-b710-415f-9144-cb02c3cd9795", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD56623C3A\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2c3c-f01e-00ef-45e6-643b08000000", + "x-ms-client-request-id" : "ca6a6a6b-b710-415f-9144-cb02c3cd9795" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1/javabloblistblobshierwithtimeoutstillbackedbypagedflux534192c", + "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" : "064c2be2-5bfa-435b-8a65-34f07c79d911", + "Content-Type" : "application/octet-stream" + }, + "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 19:06:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FD566AC9BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "adac2c6f-f01e-00ef-77e6-643b08000000", + "x-ms-client-request-id" : "064c2be2-5bfa-435b-8a65-34f07c79d911" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bde04975-8adc-4374-b21d-a704f25788da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2c92-f01e-00ef-18e6-643b08000000", + "Body" : "3/javabloblistblobshierwithtimeoutstillbackedbypagedflux1809726Fri, 06 Sep 2019 19:06:35 GMTFri, 06 Sep 2019 19:06:35 GMT0x8D732FD564EFDC47application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux2878473Fri, 06 Sep 2019 19:06:35 GMTFri, 06 Sep 2019 19:06:35 GMT0x8D732FD5655B6187application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux3877026Fri, 06 Sep 2019 19:06:35 GMTFri, 06 Sep 2019 19:06:35 GMT0x8D732FD565BAAF97application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue02!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5MzI4NGUhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "bde04975-8adc-4374-b21d-a704f25788da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1?delimiter=/&marker=2%21140%21MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5MzI4NGUhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0d26a149-0a38-4488-bbdb-51cb8e22d7f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2cf5-f01e-00ef-74e6-643b08000000", + "Body" : "2!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5MzI4NGUhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh3/javabloblistblobshierwithtimeoutstillbackedbypagedflux493284eFri, 06 Sep 2019 19:06:35 GMTFri, 06 Sep 2019 19:06:35 GMT0x8D732FD56623C3A7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux534192cFri, 06 Sep 2019 19:06:35 GMTFri, 06 Sep 2019 19:06:35 GMT0x8D732FD566AC9BE7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "0d26a149-0a38-4488-bbdb-51cb8e22d7f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "35a6ec80-a59d-4342-8f13-259e95da643b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adac2d10-f01e-00ef-0fe6-643b08000000", + "Body" : "jtclistblobshierwithtimeoutstillbackedbypagedfluxjtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1Fri, 06 Sep 2019 19:06:35 GMT\"0x8D732FD5647BA85\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "35a6ec80-a59d-4342-8f13-259e95da643b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1?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" : "bfe32886-dc44-4713-a4e6-4f98707d62c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adac2d2e-f01e-00ef-2ce6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:06:35 GMT", + "x-ms-client-request-id" : "bfe32886-dc44-4713-a4e6-4f98707d62c2" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierwithtimeoutstillbackedbypagedflux01843557e1", "javabloblistblobshierwithtimeoutstillbackedbypagedflux1809726", "javabloblistblobshierwithtimeoutstillbackedbypagedflux2878473", "javabloblistblobshierwithtimeoutstillbackedbypagedflux3877026", "javabloblistblobshierwithtimeoutstillbackedbypagedflux493284e", "javabloblistblobshierwithtimeoutstillbackedbypagedflux534192c" ] +} \ 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..e8d7adfa227c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease67d954392bf6a?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" : "80e90c8b-9511-49b9-8c61-4548dcb11d8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8EFDB838\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655025-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "80e90c8b-9511-49b9-8c61-4548dcb11d8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease67d954392bf6a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6d1f916e-4ad5-4f85-8d3b-455b59b09f9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8EFDB838\"", + "x-ms-lease-id" : "d7b1cf6a-d39d-4228-a2b7-2b34e5146a2c", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65505d-001e-001f-60e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "6d1f916e-4ad5-4f85-8d3b-455b59b09f9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease67d954392bf6a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cc18226f-2aae-473c-816c-2c2b725c4fbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8EFDB838\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655083-001e-001f-01e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "cc18226f-2aae-473c-816c-2c2b725c4fbf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease67d954392bf6a?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" : "076aece3-fd03-4aa6-9e46-37c5eec659eb" + }, + "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" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD8EFDB838\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec6550a0-001e-001f-19e6-64eb66000000", + "x-ms-client-request-id" : "076aece3-fd03-4aa6-9e46-37c5eec659eb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3ff067de-b621-42dd-a23a-6555dc114b84" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6550b6-001e-001f-2ce6-64eb66000000", + "Body" : "jtcreleaseleasejtcreleaselease0containerapitestreleaselease67d954392bf6aFri, 06 Sep 2019 19:08:10 GMT\"0x8D732FD8EFDB838\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "3ff067de-b621-42dd-a23a-6555dc114b84", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease67d954392bf6a?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" : "a9671e89-cb96-4b76-8a6d-288cc13e122a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6550cb-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "a9671e89-cb96-4b76-8a6d-288cc13e122a" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaselease0containerapitestreleaselease67d954392bf6a" ] +} \ 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..358fc78d74c1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac55859536868?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" : "1d27ed0d-2bff-40aa-8df6-269adaed4e5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F3D1A68\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655161-001e-001f-3de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "1d27ed0d-2bff-40aa-8df6-269adaed4e5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac55859536868?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d82fc0af-99ab-4a82-88bc-0425864e4e3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F3D1A68\"", + "x-ms-lease-id" : "02530ec2-eae1-4a00-b3db-761227b50f64", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65517a-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "d82fc0af-99ab-4a82-88bc-0425864e4e3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac55859536868?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aebe1bb2-50b8-4e6b-9bc9-c4ee82c17aff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F3D1A68\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655190-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "aebe1bb2-50b8-4e6b-9bc9-c4ee82c17aff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e7b3dc4-2aee-4e16-9d5b-a46c764ad59d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6551e4-001e-001f-32e6-64eb66000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseac55859536868Fri, 06 Sep 2019 19:08:10 GMT\"0x8D732FD8F3D1A68\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "3e7b3dc4-2aee-4e16-9d5b-a46c764ad59d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac55859536868?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" : "cad5ce84-73c7-42cb-9922-7b120d745ddc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6551fc-001e-001f-49e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "cad5ce84-73c7-42cb-9922-7b120d745ddc" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseac55859536868" ] +} \ 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..2a55e586f226 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacf0b28953787?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" : "9ba60b47-1038-4521-aae5-03d01a809b76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F68A1AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655231-001e-001f-7ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "9ba60b47-1038-4521-aae5-03d01a809b76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacf0b28953787?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "46d416f2-f50a-45fd-9b93-95a8d989ee19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F68A1AD\"", + "x-ms-lease-id" : "c2175947-2675-4548-ade6-4f7440d4a486", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655251-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "46d416f2-f50a-45fd-9b93-95a8d989ee19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacf0b28953787?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0cc2f310-46bb-4f59-8536-612cbfa8983f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F68A1AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65526d-001e-001f-2de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "0cc2f310-46bb-4f59-8536-612cbfa8983f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b37c6793-071b-451e-a4aa-7296c8a61710" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655289-001e-001f-47e6-64eb66000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseacf0b28953787Fri, 06 Sep 2019 19:08:11 GMT\"0x8D732FD8F68A1AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "b37c6793-071b-451e-a4aa-7296c8a61710", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacf0b28953787?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" : "1b8ad528-c990-4c8e-814b-26e91201b34d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655297-001e-001f-55e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "1b8ad528-c990-4c8e-814b-26e91201b34d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseacf0b28953787" ] +} \ 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..d73c1c730d46 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac0ff76843ddf?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" : "a36aa9c1-c5cd-493b-8fcb-eca889b38168" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F850A2C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6552bc-001e-001f-72e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "a36aa9c1-c5cd-493b-8fcb-eca889b38168" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac0ff76843ddf?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "97de438f-20ea-4c73-bbd7-cd43edd0e5e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F850A2C\"", + "x-ms-lease-id" : "9402e2e8-2031-47e7-9d31-bb38cbd1e4b3", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6552d5-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "97de438f-20ea-4c73-bbd7-cd43edd0e5e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac0ff76843ddf?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "92248374-cb87-4ab8-900d-0f932a629ad1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F850A2C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6552fb-001e-001f-23e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "92248374-cb87-4ab8-900d-0f932a629ad1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c01c9b8a-bd91-4857-b5bf-007fd0348685" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655318-001e-001f-3ce6-64eb66000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseac0ff76843ddfFri, 06 Sep 2019 19:08:11 GMT\"0x8D732FD8F850A2C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "c01c9b8a-bd91-4857-b5bf-007fd0348685", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac0ff76843ddf?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" : "6083a91f-f56a-46c9-85ce-6d500543722c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65532d-001e-001f-4fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "6083a91f-f56a-46c9-85ce-6d500543722c" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseac0ff76843ddf" ] +} \ 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..cded6828d435 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail01195456ca4ef16dfb442190?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" : "23b61c12-7804-45b6-9014-72b1ec108b9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FA36EE8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65533b-001e-001f-5de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "23b61c12-7804-45b6-9014-72b1ec108b9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail01195456ca4ef16dfb442190?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2fa512d6-0d8e-472f-89f1-f0c60ba005a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FA36EE8\"", + "x-ms-lease-id" : "aa451893-49e5-4c9b-8e62-830b3d04c4e8", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655359-001e-001f-73e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "2fa512d6-0d8e-472f-89f1-f0c60ba005a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail01195456ca4ef16dfb442190?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c134f257-c901-4be8-9511-4daaa030da68" + }, + "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" : "ec655369-001e-001f-7fe6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec655369-001e-001f-7fe6-64eb66000000\nTime:2019-09-06T19:08:11.4852496Z", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "c134f257-c901-4be8-9511-4daaa030da68", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "49f7d081-179a-4d69-bdc6-6b05bacff473" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655378-001e-001f-0ce6-64eb66000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail01195456ca4ef16dfb442190Fri, 06 Sep 2019 19:08:11 GMT\"0x8D732FD8FA36EE8\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "49f7d081-179a-4d69-bdc6-6b05bacff473", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail01195456ca4ef16dfb442190?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fa48ed85-9567-4024-8372-6bf778c357ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FA36EE8\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655388-001e-001f-1ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "fa48ed85-9567-4024-8372-6bf778c357ec" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail01195456ca4ef16dfb442190?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" : "b6e7772c-0c4a-4d69-abb6-b07e75e52f7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655396-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "b6e7772c-0c4a-4d69-abb6-b07e75e52f7d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail01195456ca4ef16dfb442190" ] +} \ 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..a45cd35f0b16 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail068085d98609cd90c6444eae?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" : "58cbe340-7148-42fa-b9c2-4023fd83cf52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FC4E19C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6553c2-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "58cbe340-7148-42fa-b9c2-4023fd83cf52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail068085d98609cd90c6444eae?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f1ab6ce5-b0ee-4866-be6a-10fa1e9f2b5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FC4E19C\"", + "x-ms-lease-id" : "873826e5-97b0-46df-8619-ccaf14b8c18c", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6553e0-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "f1ab6ce5-b0ee-4866-be6a-10fa1e9f2b5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail068085d98609cd90c6444eae?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "781d3d40-b392-44f2-8a48-6f7db82085bb" + }, + "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" : "ec6553fb-001e-001f-7de6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec6553fb-001e-001f-7de6-64eb66000000\nTime:2019-09-06T19:08:11.7124628Z", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "781d3d40-b392-44f2-8a48-6f7db82085bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e5d48642-239c-4c11-bdcc-c9a3b931ee08" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655413-001e-001f-13e6-64eb66000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail068085d98609cd90c6444eaeFri, 06 Sep 2019 19:08:11 GMT\"0x8D732FD8FC4E19C\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "e5d48642-239c-4c11-bdcc-c9a3b931ee08", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail068085d98609cd90c6444eae?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "84bf694a-d76d-4e22-995c-be1a3a6c03a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FC4E19C\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655421-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "84bf694a-d76d-4e22-995c-be1a3a6c03a4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail068085d98609cd90c6444eae?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" : "1a5250d6-296e-499c-98b0-db2eb27d64ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655433-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "1a5250d6-296e-499c-98b0-db2eb27d64ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail068085d98609cd90c6444eae" ] +} \ 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..57fc589d6f08 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal050776fccf959a70ad4aef?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" : "ee6d9bf0-ed55-4715-a653-55958acbea58" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FE6C9A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655451-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "ee6d9bf0-ed55-4715-a653-55958acbea58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a1c4fe27-a0a5-4bc8-b21d-3c971ee94d59" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65546f-001e-001f-64e6-64eb66000000", + "Body" : "jtcreleaseleaseacillegaljtcreleaseleaseacillegal050776fccf959a70ad4aefFri, 06 Sep 2019 19:08:11 GMT\"0x8D732FD8FE6C9A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "a1c4fe27-a0a5-4bc8-b21d-3c971ee94d59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal050776fccf959a70ad4aef?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" : "8b28db1f-ec44-41eb-96f6-c0136749aa0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65547f-001e-001f-73e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "8b28db1f-ec44-41eb-96f6-c0136749aa0a" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacillegal050776fccf959a70ad4aef" ] +} \ 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..49d553a8c4da --- /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://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal0175707e8cbc19b9d24453?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" : "5e2e56ba-43b6-495d-8508-d94625f3720a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8FFD8B6A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65549e-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "5e2e56ba-43b6-495d-8508-d94625f3720a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "28179280-4722-4c1f-9740-565366bd99b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6554cf-001e-001f-37e6-64eb66000000", + "Body" : "jtcreleaseleaseacillegaljtcreleaseleaseacillegal0175707e8cbc19b9d24453Fri, 06 Sep 2019 19:08:12 GMT\"0x8D732FD8FFD8B6A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "28179280-4722-4c1f-9740-565366bd99b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal0175707e8cbc19b9d24453?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" : "46082722-4f96-4480-86c2-9a714df75cb5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6554ea-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "46082722-4f96-4480-86c2-9a714df75cb5" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacillegal0175707e8cbc19b9d24453" ] +} \ 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..5f2675cf9f35 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0containerapitestreleaseleaseerrorb3985457?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" : "7f743be1-6bb0-4d7e-99ac-459d5d09d576" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD901893FD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655525-001e-001f-7ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "7f743be1-6bb0-4d7e-99ac-459d5d09d576" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror1containerapitestreleaseleaseerrorb3930712?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0a0e60d5-c1b2-4269-a309-766335cca96d" + }, + "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" : "ec65556d-001e-001f-39e6-64eb66000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ec65556d-001e-001f-39e6-64eb66000000\nTime:2019-09-06T19:08:12.2269456Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "0a0e60d5-c1b2-4269-a309-766335cca96d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "753dfa36-e8be-4982-8a50-3f50fb69d238" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655594-001e-001f-5ce6-64eb66000000", + "Body" : "jtcreleaseleaseerrorjtcreleaseleaseerror0containerapitestreleaseleaseerrorb3985457Fri, 06 Sep 2019 19:08:12 GMT\"0x8D732FD901893FD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "753dfa36-e8be-4982-8a50-3f50fb69d238", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0containerapitestreleaseleaseerrorb3985457?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" : "63c0b939-2a1f-4256-a76b-8c2d73d3e2eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6555ad-001e-001f-73e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:11 GMT", + "x-ms-client-request-id" : "63c0b939-2a1f-4256-a76b-8c2d73d3e2eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseerror0containerapitestreleaseleaseerrorb3985457", "jtcreleaseleaseerror1containerapitestreleaseleaseerrorb3930712" ] +} \ 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..46f6536537c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin4699718994?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" : "044bdaf6-f65a-47ae-82db-bc283326b943" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F219C91\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6550e4-001e-001f-56e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "044bdaf6-f65a-47ae-82db-bc283326b943" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin4699718994?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9139e28d-fee5-4ec5-8f34-95a66c03a092" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F219C91\"", + "x-ms-lease-id" : "3d2e302f-aeb3-46e3-bc7c-f3f29b3399cd", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec655101-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "9139e28d-fee5-4ec5-8f34-95a66c03a092" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin4699718994?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5818545b-38fb-44e3-9526-5b04d364ebe4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8F219C91\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec655116-001e-001f-7ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "5818545b-38fb-44e3-9526-5b04d364ebe4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "68862417-e679-4b11-bca9-d1e85c81fc60" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65512a-001e-001f-0de6-64eb66000000", + "Body" : "jtcreleaseleaseminjtcreleaseleasemin0containerapitestreleaseleasemin4699718994Fri, 06 Sep 2019 19:08:10 GMT\"0x8D732FD8F219C91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "68862417-e679-4b11-bca9-d1e85c81fc60", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin4699718994?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" : "7c747852-7f8f-46a4-89af-8ed71bce958f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65513c-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:10 GMT", + "x-ms-client-request-id" : "7c747852-7f8f-46a4-89af-8ed71bce958f" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleasemin0containerapitestreleaseleasemin4699718994" ] +} \ 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..c2420a18a2ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasedaf59254716fdba?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" : "1c7919c2-5f9b-4579-80c5-dfdff654cc1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83F56957\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651a03-001e-001f-1be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "1c7919c2-5f9b-4579-80c5-dfdff654cc1d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasedaf59254716fdba?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ca45d013-0e6b-43eb-95d2-d68f025feb79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83F56957\"", + "x-ms-lease-id" : "0d4de512-e289-4048-beca-a3fe14c06968", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec651a32-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:07:51 GMT", + "x-ms-client-request-id" : "ca45d013-0e6b-43eb-95d2-d68f025feb79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasedaf59254716fdba?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cc6bd30a-19e7-443a-aae5-f4c696d58b62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83F56957\"", + "x-ms-lease-id" : "0d4de512-e289-4048-beca-a3fe14c06968", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654915-001e-001f-53e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "cc6bd30a-19e7-443a-aae5-f4c696d58b62" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasedaf59254716fdba?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" : "6f20860a-d89a-45ac-bb99-d23a563bab75" + }, + "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" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD83F56957\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "ec654946-001e-001f-7de6-64eb66000000", + "x-ms-client-request-id" : "6f20860a-d89a-45ac-bb99-d23a563bab75" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7538868d-6597-42e2-8f92-25308b149ff8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654956-001e-001f-0be6-64eb66000000", + "Body" : "jtcrenewleasejtcrenewlease0containerapitestrenewleasedaf59254716fdbaFri, 06 Sep 2019 19:07:51 GMT\"0x8D732FD83F56957\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "7538868d-6597-42e2-8f92-25308b149ff8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasedaf59254716fdba?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4e9cfed3-ca9b-489b-8a0f-6911eace29da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD83F56957\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:07:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65496c-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "4e9cfed3-ca9b-489b-8a0f-6911eace29da" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasedaf59254716fdba?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" : "2b90ad64-146a-40b3-84e9-f6d062319671" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65498e-001e-001f-3de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "2b90ad64-146a-40b3-84e9-f6d062319671" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewlease0containerapitestrenewleasedaf59254716fdba" ] +} \ 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..186acb96cb69 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace9759123d38ea?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" : "61247dd6-10b1-47eb-8a12-9b584e446dd8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DCDEFDE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654ac6-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "61247dd6-10b1-47eb-8a12-9b584e446dd8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace9759123d38ea?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96d50ca0-d4f2-44af-bd42-a121940bce5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DCDEFDE\"", + "x-ms-lease-id" : "eb7ab68e-d058-475c-9dc6-f92e320bd35f", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654ae2-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "96d50ca0-d4f2-44af-bd42-a121940bce5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace9759123d38ea?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cf3f59c4-b8bc-4997-8d01-4f1582da5692" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DCDEFDE\"", + "x-ms-lease-id" : "eb7ab68e-d058-475c-9dc6-f92e320bd35f", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654b05-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "cf3f59c4-b8bc-4997-8d01-4f1582da5692" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e7d3c97e-01ed-4862-8156-3121a90d2af3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654b1f-001e-001f-7de6-64eb66000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseace9759123d38eaFri, 06 Sep 2019 19:08:08 GMT\"0x8D732FD8DCDEFDE\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "e7d3c97e-01ed-4862-8156-3121a90d2af3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace9759123d38ea?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9637b0e8-74e6-49bd-85e0-457ead07146d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DCDEFDE\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654b35-001e-001f-11e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "9637b0e8-74e6-49bd-85e0-457ead07146d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace9759123d38ea?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" : "8f04ccce-78c3-4e31-8764-e1ef8f14f45a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654b4e-001e-001f-23e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "8f04ccce-78c3-4e31-8764-e1ef8f14f45a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseace9759123d38ea" ] +} \ 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..7febaa8d38a4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7?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" : "072c28d8-495a-468e-810f-9680e358f271" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DF137CC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654b7b-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "072c28d8-495a-468e-810f-9680e358f271" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8e68217b-3690-4a88-a488-1b3979c8994e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DF137CC\"", + "x-ms-lease-id" : "c5cc63c0-4d0a-4762-93b5-5cbbfc38b0d6", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654b9e-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "8e68217b-3690-4a88-a488-1b3979c8994e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f846edbb-f6ad-431f-9ddd-1e0d1629a0ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DF137CC\"", + "x-ms-lease-id" : "c5cc63c0-4d0a-4762-93b5-5cbbfc38b0d6", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654bb7-001e-001f-7be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "f846edbb-f6ad-431f-9ddd-1e0d1629a0ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c04db043-6a0b-4401-a51c-26efc3492cd6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654bd5-001e-001f-11e6-64eb66000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7Fri, 06 Sep 2019 19:08:08 GMT\"0x8D732FD8DF137CC\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "c04db043-6a0b-4401-a51c-26efc3492cd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3a9774f0-1be3-4bf3-9fd1-928321be1225" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DF137CC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654bed-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "3a9774f0-1be3-4bf3-9fd1-928321be1225" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7?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" : "12fca4f2-de53-42a8-b8f3-3de7476a82cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654ca5-001e-001f-39e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "12fca4f2-de53-42a8-b8f3-3de7476a82cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseaccca94543ae3b7" ] +} \ 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..2d02d8644669 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaceb2121999275a?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" : "40f22de9-ab5b-472a-b176-c6355f4ee052" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E3A604D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654cc5-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "40f22de9-ab5b-472a-b176-c6355f4ee052" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaceb2121999275a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "07965456-1796-427c-a0fb-57d13438b5b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E3A604D\"", + "x-ms-lease-id" : "bee4dcd5-a583-4324-a6d3-b635b0fda27f", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654cec-001e-001f-71e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "07965456-1796-427c-a0fb-57d13438b5b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaceb2121999275a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5a32b48b-4a0b-4984-a564-a9518b08d104" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E3A604D\"", + "x-ms-lease-id" : "bee4dcd5-a583-4324-a6d3-b635b0fda27f", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654d05-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "5a32b48b-4a0b-4984-a564-a9518b08d104" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "210926a2-a305-40c9-a4ac-ffc0914e8f67" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654d1a-001e-001f-18e6-64eb66000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseaceb2121999275aFri, 06 Sep 2019 19:08:09 GMT\"0x8D732FD8E3A604D\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "210926a2-a305-40c9-a4ac-ffc0914e8f67", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaceb2121999275a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "770a2fc0-ed12-4ead-87b5-04d4584527f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E3A604D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654d27-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "770a2fc0-ed12-4ead-87b5-04d4584527f0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaceb2121999275a?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" : "2f5ea11c-6e09-4062-8e31-fe26620c16c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654d40-001e-001f-3ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "2f5ea11c-6e09-4062-8e31-fe26620c16c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseaceb2121999275a" ] +} \ 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..1e4f12f77bad --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276f?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" : "81cc05c3-e5cb-47da-92b0-713867cdf92b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E5B0F8D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654d55-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "81cc05c3-e5cb-47da-92b0-713867cdf92b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4c2450a1-6ac7-44ff-b3b5-fee03fce29c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E5B0F8D\"", + "x-ms-lease-id" : "214024cf-3d01-4e01-ac3c-8860d880f3ba", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654d7c-001e-001f-71e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "4c2450a1-6ac7-44ff-b3b5-fee03fce29c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5a83f41f-68e8-4768-98e9-2741ead604d3" + }, + "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" : "ec654d90-001e-001f-02e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec654d90-001e-001f-02e6-64eb66000000\nTime:2019-09-06T19:08:09.3352292Z", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "5a83f41f-68e8-4768-98e9-2741ead604d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8e9ff2d8-048b-4f14-a1d1-9f1ce33ba614" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654da5-001e-001f-17e6-64eb66000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276fFri, 06 Sep 2019 19:08:09 GMT\"0x8D732FD8E5B0F8D\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "8e9ff2d8-048b-4f14-a1d1-9f1ce33ba614", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4cfc958a-fd41-4ee9-97bd-5d5430d8841d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E5B0F8D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654db4-001e-001f-25e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:08 GMT", + "x-ms-client-request-id" : "4cfc958a-fd41-4ee9-97bd-5d5430d8841d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276f?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" : "dc382197-e637-42ef-be32-2ace1d0f328a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654dc8-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "dc382197-e637-42ef-be32-2ace1d0f328a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0containerapitestrenewleaseacfaila0632276f" ] +} \ 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..5f7a7f2d5254 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406?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" : "3dce6e21-e286-4c36-8eda-b40a157e188f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E7B7097\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654df1-001e-001f-5ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "3dce6e21-e286-4c36-8eda-b40a157e188f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aee41b93-3473-43ec-b30f-006168673ef7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E7B7097\"", + "x-ms-lease-id" : "b40e5742-2319-4af7-bc3c-e3d648dbed96", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654e0a-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "aee41b93-3473-43ec-b30f-006168673ef7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "581bd289-60b9-4d6a-9603-5453aeea2929" + }, + "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" : "ec654e1a-001e-001f-7ae6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec654e1a-001e-001f-7ae6-64eb66000000\nTime:2019-09-06T19:08:09.5504320Z", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "581bd289-60b9-4d6a-9603-5453aeea2929", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eb3d60ff-0d39-46c6-b585-48da9a456c42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654e39-001e-001f-12e6-64eb66000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406Fri, 06 Sep 2019 19:08:09 GMT\"0x8D732FD8E7B7097\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "eb3d60ff-0d39-46c6-b585-48da9a456c42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "66c4a413-dadb-4e78-9962-aa679723575a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8E7B7097\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654e50-001e-001f-25e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "66c4a413-dadb-4e78-9962-aa679723575a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406?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" : "59df0db3-caf8-48c5-9cce-8dd79d1f87dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654e68-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "59df0db3-caf8-48c5-9cce-8dd79d1f87dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0containerapitestrenewleaseacfail03b995406" ] +} \ 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..e31e4d3b003f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal07533499e2bb39b24640f39?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" : "91a36ac7-f8ad-44d2-94fe-418c15677239" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8EB24534\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654ee2-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "91a36ac7-f8ad-44d2-94fe-418c15677239" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9bd0ce0d-6604-4dc2-ba27-09c86c0baac3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654f02-001e-001f-37e6-64eb66000000", + "Body" : "jtcrenewleaseacillegaljtcrenewleaseacillegal07533499e2bb39b24640f39Fri, 06 Sep 2019 19:08:09 GMT\"0x8D732FD8EB24534\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "9bd0ce0d-6604-4dc2-ba27-09c86c0baac3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal07533499e2bb39b24640f39?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" : "2a599e0a-0af5-4cf9-bb0c-5a1e74aa132a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654f17-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "2a599e0a-0af5-4cf9-bb0c-5a1e74aa132a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacillegal07533499e2bb39b24640f39" ] +} \ 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..c98c026e137a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal0030876ca39883abaf4387a?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" : "540d5101-6b6d-47c5-a53f-c00b880a7995" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8EC423E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654f3b-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "540d5101-6b6d-47c5-a53f-c00b880a7995" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc3dfb4a-472e-4dcf-9a1a-5633f30689eb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654f4e-001e-001f-7de6-64eb66000000", + "Body" : "jtcrenewleaseacillegaljtcrenewleaseacillegal0030876ca39883abaf4387aFri, 06 Sep 2019 19:08:09 GMT\"0x8D732FD8EC423E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "bc3dfb4a-472e-4dcf-9a1a-5633f30689eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal0030876ca39883abaf4387a?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" : "e1afdacc-1444-4267-94e6-ed0bc08615ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654f5a-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "e1afdacc-1444-4267-94e6-ed0bc08615ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacillegal0030876ca39883abaf4387a" ] +} \ 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..c1d36b0888e3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0containerapitestrenewleaseerror49c1890340?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" : "2e5a34f7-e034-4067-a89d-f09260ff9330" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8EDE41C7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec654f8c-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "2e5a34f7-e034-4067-a89d-f09260ff9330" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror1containerapitestrenewleaseerror49c32228e3?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a134f755-ed04-4ea4-b1d0-c4d00fd410f5" + }, + "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" : "ec654fd0-001e-001f-68e6-64eb66000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ec654fd0-001e-001f-68e6-64eb66000000\nTime:2019-09-06T19:08:10.1680119Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "a134f755-ed04-4ea4-b1d0-c4d00fd410f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1107a748-4b9d-49e0-8457-3cc3b3c5cd69" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654fde-001e-001f-75e6-64eb66000000", + "Body" : "jtcrenewleaseerrorjtcrenewleaseerror0containerapitestrenewleaseerror49c1890340Fri, 06 Sep 2019 19:08:10 GMT\"0x8D732FD8EDE41C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "1107a748-4b9d-49e0-8457-3cc3b3c5cd69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0containerapitestrenewleaseerror49c1890340?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" : "7c96f157-e521-44a1-a298-e0bf9cb19df5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec655005-001e-001f-17e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:09 GMT", + "x-ms-client-request-id" : "7c96f157-e521-44a1-a298-e0bf9cb19df5" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseerror0containerapitestrenewleaseerror49c1890340", "jtcrenewleaseerror1containerapitestrenewleaseerror49c32228e3" ] +} \ 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..0da1189b3115 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleaseminf7d89816d880?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" : "17c9bfbf-cb86-45de-a046-5eb6205c1b90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DAA0B8A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6549cd-001e-001f-70e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "17c9bfbf-cb86-45de-a046-5eb6205c1b90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleaseminf7d89816d880?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "49a907be-67be-4f1b-bc78-0109f0d34ee5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DAA0B8A\"", + "x-ms-lease-id" : "ccf174e1-f5fe-4bbf-abde-dfff4358e891", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6549fc-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "49a907be-67be-4f1b-bc78-0109f0d34ee5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleaseminf7d89816d880?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "783f1e42-ed58-4f66-ab6c-77e516ef2ae4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DAA0B8A\"", + "x-ms-lease-id" : "ccf174e1-f5fe-4bbf-abde-dfff4358e891", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654a1f-001e-001f-2ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "783f1e42-ed58-4f66-ab6c-77e516ef2ae4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "01f9c0d3-761f-4cc3-bd4f-9614c3fb7b72" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec654a41-001e-001f-47e6-64eb66000000", + "Body" : "jtcrenewleaseminjtcrenewleasemin0containerapitestrenewleaseminf7d89816d880Fri, 06 Sep 2019 19:08:08 GMT\"0x8D732FD8DAA0B8A\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "01f9c0d3-761f-4cc3-bd4f-9614c3fb7b72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleaseminf7d89816d880?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "10d2618f-0f47-4569-83bc-fdc724d781da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD8DAA0B8A\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654a6b-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "10d2618f-0f47-4569-83bc-fdc724d781da" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleaseminf7d89816d880?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" : "192dd928-902b-4036-8042-d3a4783dc16b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec654aa0-001e-001f-12e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:07 GMT", + "x-ms-client-request-id" : "192dd928-902b-4036-8042-d3a4783dc16b" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleasemin0containerapitestrenewleaseminf7d89816d880" ] +} \ 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..ada05c63e0c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicit0containerapitestrootexplicit2712174572387?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" : "57260898-687e-435e-9e6d-1c6804a6c13e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA870E54D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65baf4-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "57260898-687e-435e-9e6d-1c6804a6c13e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c155a28-85a9-4933-9b78-fe1c047c8b50" + }, + "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" : "Fri, 23 Aug 2019 21:31:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72811318929AD\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec65bb27-001e-001f-3de6-64eb66000000", + "x-ms-client-request-id" : "1c155a28-85a9-4933-9b78-fe1c047c8b50" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b55cfb7c-ca4c-44ad-9eab-f2b2dee7802f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA883007A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65bb6a-001e-001f-6be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "b55cfb7c-ca4c-44ad-9eab-f2b2dee7802f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "02440bfb-825f-46a3-8359-ddbd95bb5a31" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bbb7-001e-001f-2be6-64eb66000000", + "Body" : "jtcrootexplicitjtcrootexplicit0containerapitestrootexplicit2712174572387Fri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA870E54D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "02440bfb-825f-46a3-8359-ddbd95bb5a31", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicit0containerapitestrootexplicit2712174572387?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" : "a49e7117-43be-435b-8fcb-7be5c86a82d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65bbd3-001e-001f-42e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "a49e7117-43be-435b-8fcb-7be5c86a82d7" + }, + "Exception" : null + } ], + "variables" : [ "jtcrootexplicit0containerapitestrootexplicit2712174572387" ] +} \ 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..7defec411c43 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicitinendpoint063388d1de46e11a11444e?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" : "61c86c8c-d6f3-4fa8-b8e4-919f27f50523" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA89650AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65bbfa-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "61c86c8c-d6f3-4fa8-b8e4-919f27f50523" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9639abd2-adfc-489a-9500-376573b1ac84" + }, + "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" : "Fri, 23 Aug 2019 21:31:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72811318929AD\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec65bc14-001e-001f-75e6-64eb66000000", + "x-ms-client-request-id" : "9639abd2-adfc-489a-9500-376573b1ac84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8e252368-5993-4375-acb2-ca15bd775c2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA8B1958E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef6eec8e-701e-007d-5be6-64acbe000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:52 GMT", + "x-ms-client-request-id" : "8e252368-5993-4375-acb2-ca15bd775c2a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "http://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e68e51bc-a9f5-414f-93f1-c82c5a9d3194" + }, + "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" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08: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" : "\"0x8D732FDA8B1958E\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:31:00 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ef6eec9e-701e-007d-64e6-64acbe000000", + "x-ms-client-request-id" : "e68e51bc-a9f5-414f-93f1-c82c5a9d3194", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "13cb2831-ba40-4617-ad7c-06f350ad30ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bcfa-001e-001f-28e6-64eb66000000", + "Body" : "jtcrootexplicitinendpointjtcrootexplicitinendpoint063388d1de46e11a11444eFri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA89650AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "13cb2831-ba40-4617-ad7c-06f350ad30ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicitinendpoint063388d1de46e11a11444e?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" : "f0403689-98d0-4d14-baf7-a778ae8e84a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65bd1c-001e-001f-41e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "f0403689-98d0-4d14-baf7-a778ae8e84a8" + }, + "Exception" : null + } ], + "variables" : [ "jtcrootexplicitinendpoint063388d1de46e11a11444e" ] +} \ 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..bc2917144869 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy1e1592237a?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" : "89d21849-dd02-425f-b366-daa793f149b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2668E8FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637047-001e-001f-59e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "89d21849-dd02-425f-b366-daa793f149b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy1e1592237a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "22790fc3-f5b1-430f-9d30-1c84cfab497d", + "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" : "\"0x8D732FD266E666F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637091-001e-001f-1ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "22790fc3-f5b1-430f-9d30-1c84cfab497d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy1e1592237a?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" : "ccfe520e-3ff0-4e59-8bf3-4550380df382" + }, + "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" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD266E666F\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "ec6370f2-001e-001f-76e6-64eb66000000", + "x-ms-client-request-id" : "ccfe520e-3ff0-4e59-8bf3-4550380df382" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "847cd05a-1671-459b-b622-db7fbba3af88" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63710b-001e-001f-0ee6-64eb66000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicy1e1592237aFri, 06 Sep 2019 19:05:14 GMT\"0x8D732FD266E666F\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "847cd05a-1671-459b-b622-db7fbba3af88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy1e1592237a?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" : "50806d00-f7bc-4a2c-a8d1-bcbc76a42b29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63711d-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "50806d00-f7bc-4a2c-a8d1-bcbc76a42b29" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicy1e1592237a" ] +} \ 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..36ff7c7a0b03 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8c17793190?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" : "4b3f5b47-eb3a-426a-b34a-3be52133f031" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2692E962\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63713c-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "4b3f5b47-eb3a-426a-b34a-3be52133f031" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8c17793190?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "db131e4c-8bd7-4615-a0f2-f1c23a6287e7", + "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" : "\"0x8D732FD2698DC15\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63715d-001e-001f-58e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "db131e4c-8bd7-4615-a0f2-f1c23a6287e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8c17793190?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" : "7743f52d-4ccc-489d-b6e3-227b7af7c6a1" + }, + "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" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD2698DC15\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "ec637179-001e-001f-6de6-64eb66000000", + "x-ms-client-request-id" : "7743f52d-4ccc-489d-b6e3-227b7af7c6a1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cbedcc08-7d11-44ed-8852-ce4f02c4431b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63718f-001e-001f-01e6-64eb66000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicy8c17793190Fri, 06 Sep 2019 19:05:15 GMT\"0x8D732FD2698DC15\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "cbedcc08-7d11-44ed-8852-ce4f02c4431b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8c17793190?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" : "6ba41b7c-05d1-4f66-9e33-63e3ed8ab6b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6371a6-001e-001f-16e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "6ba41b7c-05d1-4f66-9e33-63e3ed8ab6b0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicy8c17793190" ] +} \ 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..189268e679a2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyec869128f0?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" : "e4956b5a-b012-440c-8ded-be02c3f4fcab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD26AFC728\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6371c9-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "e4956b5a-b012-440c-8ded-be02c3f4fcab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyec869128f0?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0fb2e4b7-388e-4b61-9076-13393f3b4c61", + "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" : "\"0x8D732FD26B5E100\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6371e6-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "0fb2e4b7-388e-4b61-9076-13393f3b4c61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyec869128f0?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" : "f5bf5867-90ea-4669-8c6e-6e3244f457cb" + }, + "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" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD26B5E100\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec637204-001e-001f-61e6-64eb66000000", + "x-ms-client-request-id" : "f5bf5867-90ea-4669-8c6e-6e3244f457cb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e92fdb9d-cd2b-487b-a742-bb4437d55486" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63721e-001e-001f-79e6-64eb66000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicyec869128f0Fri, 06 Sep 2019 19:05:15 GMT\"0x8D732FD26B5E100\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "e92fdb9d-cd2b-487b-a742-bb4437d55486", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyec869128f0?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" : "6a54229d-9ca6-46de-b1c7-1bd13e24ba8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63722f-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "6a54229d-9ca6-46de-b1c7-1bd13e24ba8a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicyec869128f0" ] +} \ 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..d3e6ec460f6c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac9ba77757?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" : "eb295767-de52-4740-9a43-f7c012cde5a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD27581692\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6374b5-001e-001f-56e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "eb295767-de52-4740-9a43-f7c012cde5a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac9ba77757?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "33fb1217-56b5-4047-b3cd-7a5749c229da", + "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" : "\"0x8D732FD275F4223\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6374d9-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "33fb1217-56b5-4047-b3cd-7a5749c229da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "51c6ced4-045f-4cb1-908b-e2ee5218d059" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6374f7-001e-001f-0fe6-64eb66000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac9ba77757Fri, 06 Sep 2019 19:05:16 GMT\"0x8D732FD275F4223\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "51c6ced4-045f-4cb1-908b-e2ee5218d059", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac9ba77757?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" : "26bc8b46-b9d2-46b2-afc6-ae5df9dae534" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63750e-001e-001f-23e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "26bc8b46-b9d2-46b2-afc6-ae5df9dae534" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac9ba77757" ] +} \ 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..73f21958e5cb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacbdc07707?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" : "48edd939-abad-497d-9e56-b2924f87a6dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD277AE936\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637559-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "48edd939-abad-497d-9e56-b2924f87a6dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacbdc07707?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5bda0ca8-e790-4642-95f2-633fcc9c9bb6", + "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" : "\"0x8D732FD27812A2D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63757a-001e-001f-07e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "5bda0ca8-e790-4642-95f2-633fcc9c9bb6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96bc3ec6-e217-42a0-92c8-e429aa3876d8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6375a5-001e-001f-2ee6-64eb66000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyacbdc07707Fri, 06 Sep 2019 19:05:16 GMT\"0x8D732FD27812A2D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "96bc3ec6-e217-42a0-92c8-e429aa3876d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacbdc07707?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" : "e231f3be-2b3d-4329-a7a0-0ea70a8f05a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6375ba-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "e231f3be-2b3d-4329-a7a0-0ea70a8f05a8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyacbdc07707" ] +} \ 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..5c6bb618a3ec --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac89f06262?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" : "4960e688-0026-49ce-bca4-506f1e98e7b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2796DC68\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6375da-001e-001f-5fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "4960e688-0026-49ce-bca4-506f1e98e7b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac89f06262?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6d7822db-40ae-4570-acdb-9648b15db0d9", + "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" : "\"0x8D732FD279C80EF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6375f0-001e-001f-73e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "6d7822db-40ae-4570-acdb-9648b15db0d9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ba300a83-4180-4b9e-b92e-3cb2ba6a847c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637600-001e-001f-03e6-64eb66000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac89f06262Fri, 06 Sep 2019 19:05:16 GMT\"0x8D732FD279C80EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "ba300a83-4180-4b9e-b92e-3cb2ba6a847c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac89f06262?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" : "b9cbf170-a84f-4223-b5e4-ff666927c8ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637611-001e-001f-13e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "b9cbf170-a84f-4223-b5e4-ff666927c8ea" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac89f06262" ] +} \ 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..d15e1a524071 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789?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" : "fbf793ef-04d2-4231-bac1-9be88ae69048" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD27AF2537\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637628-001e-001f-2ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "fbf793ef-04d2-4231-bac1-9be88ae69048" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "97d61b13-fc5e-44fa-858d-34993b419bca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD27AF2537\"", + "x-ms-lease-id" : "4eaf7ed5-f22b-43b2-8835-f74e23c326f1", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637649-001e-001f-48e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "97d61b13-fc5e-44fa-858d-34993b419bca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d5f3df78-b0e7-42de-ae5d-a40aa4011f99", + "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" : "\"0x8D732FD27BCBAF3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63766a-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "d5f3df78-b0e7-42de-ae5d-a40aa4011f99" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "19a07568-33b1-4adb-b8e1-bfc6b59ac0d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637689-001e-001f-03e6-64eb66000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789Fri, 06 Sep 2019 19:05:17 GMT\"0x8D732FD27BCBAF3\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "19a07568-33b1-4adb-b8e1-bfc6b59ac0d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e3a91647-8646-49c6-83b3-bda338151e6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD27BCBAF3\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6376a3-001e-001f-1be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "e3a91647-8646-49c6-83b3-bda338151e6a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789?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" : "126aa6fa-293b-4d8b-ab6f-85c6a95becbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6376c4-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "126aa6fa-293b-4d8b-ab6f-85c6a95becbf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac46403789" ] +} \ 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..dfc56d6edc20 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail098386b34d20b9acde4bff?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" : "aa188233-9aed-4e06-b4db-4841bfc98050" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD27D5A249\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6376e0-001e-001f-54e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "aa188233-9aed-4e06-b4db-4841bfc98050" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail098386b34d20b9acde4bff?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dfb20394-3c78-4409-98d5-4764ae32f23b", + "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" : "ec637702-001e-001f-72e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec637702-001e-001f-72e6-64eb66000000\nTime:2019-09-06T19:05:17.3061760Z", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "dfb20394-3c78-4409-98d5-4764ae32f23b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "717ba84e-7af2-41f6-8456-a207c5dc6ca8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637720-001e-001f-0de6-64eb66000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail098386b34d20b9acde4bffFri, 06 Sep 2019 19:05:17 GMT\"0x8D732FD27D5A249\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "717ba84e-7af2-41f6-8456-a207c5dc6ca8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail098386b34d20b9acde4bff?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" : "14e30007-d24a-42c1-ae30-e5fde17af4e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637740-001e-001f-2ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "14e30007-d24a-42c1-ae30-e5fde17af4e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail098386b34d20b9acde4bff" ] +} \ 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..f128e69824d9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0263615f7c9b990d154189?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" : "fc6e0756-9256-4633-80bf-afc6338f64f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD27EED5BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637764-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "fc6e0756-9256-4633-80bf-afc6338f64f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0263615f7c9b990d154189?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f9e994d-e058-4c00-988c-b20999277238", + "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" : "ec6377c6-001e-001f-22e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec6377c6-001e-001f-22e6-64eb66000000\nTime:2019-09-06T19:05:17.5834376Z", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "8f9e994d-e058-4c00-988c-b20999277238", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e5ee457d-d74b-4df9-8024-4b18741924ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6377de-001e-001f-35e6-64eb66000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail0263615f7c9b990d154189Fri, 06 Sep 2019 19:05:17 GMT\"0x8D732FD27EED5BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "e5ee457d-d74b-4df9-8024-4b18741924ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0263615f7c9b990d154189?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" : "5dabd0fa-4db5-47c7-99f4-f0add502a0cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6377fb-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "5dabd0fa-4db5-47c7-99f4-f0add502a0cd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail0263615f7c9b990d154189" ] +} \ 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..4984ede813cc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0959303ee7968f6a2041d2?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" : "5f871c9f-942f-4f9c-a121-df52edab97e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD281A35F6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637825-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "5f871c9f-942f-4f9c-a121-df52edab97e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0959303ee7968f6a2041d2?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4f2bb52c-a1ca-48cc-8839-06cae87e6b41", + "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" : "ec637849-001e-001f-0fe6-64eb66000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:ec637849-001e-001f-0fe6-64eb66000000\nTime:2019-09-06T19:05:17.7596051Z", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "4f2bb52c-a1ca-48cc-8839-06cae87e6b41", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4053f164-6b12-45af-95f9-2b641ba54bdc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637866-001e-001f-29e6-64eb66000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail0959303ee7968f6a2041d2Fri, 06 Sep 2019 19:05:17 GMT\"0x8D732FD281A35F6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "4053f164-6b12-45af-95f9-2b641ba54bdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0959303ee7968f6a2041d2?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" : "413e3932-4c96-4d69-b0ef-1e5b8bad8792" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637888-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "413e3932-4c96-4d69-b0ef-1e5b8bad8792" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail0959303ee7968f6a2041d2" ] +} \ 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..df6ceba1cd44 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal042145cd792adc90e14ea?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" : "7337093b-99bf-4c86-a4ec-441b57880065" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28336963\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6378ac-001e-001f-63e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "7337093b-99bf-4c86-a4ec-441b57880065" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0da380c0-3e5b-4857-9dff-b3a016948190" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6378cd-001e-001f-80e6-64eb66000000", + "Body" : "jtcsetaccesspolicyacillegaljtcsetaccesspolicyacillegal042145cd792adc90e14eaFri, 06 Sep 2019 19:05:17 GMT\"0x8D732FD28336963\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "0da380c0-3e5b-4857-9dff-b3a016948190", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal042145cd792adc90e14ea?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" : "729c42bd-7468-42d8-9181-a09a0d898605" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6378f0-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "729c42bd-7468-42d8-9181-a09a0d898605" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacillegal042145cd792adc90e14ea" ] +} \ 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..a8b20aa6b2d7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal0173818551ba2eb75f497?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" : "79a38bc8-0d06-402a-840c-dbda6c98835f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD28482EEF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637910-001e-001f-39e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "79a38bc8-0d06-402a-840c-dbda6c98835f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4a3cc9f4-d93f-4188-bf36-b5ff63465a1e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637927-001e-001f-4ce6-64eb66000000", + "Body" : "jtcsetaccesspolicyacillegaljtcsetaccesspolicyacillegal0173818551ba2eb75f497Fri, 06 Sep 2019 19:05:18 GMT\"0x8D732FD28482EEF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "4a3cc9f4-d93f-4188-bf36-b5ff63465a1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal0173818551ba2eb75f497?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" : "87f5d0ce-54a5-4cfe-b992-a485b542585f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec63794e-001e-001f-6de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:17 GMT", + "x-ms-client-request-id" : "87f5d0ce-54a5-4cfe-b992-a485b542585f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacillegal0173818551ba2eb75f497" ] +} \ 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..7c4ad5ffbf8d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyerror053941ce863fa8fade482ba?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" : "850db203-8197-489d-91f8-46345daed7cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2875645D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6379f1-001e-001f-7be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "850db203-8197-489d-91f8-46345daed7cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyerror15515657edba90f9174d578?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "52d084ae-c396-4cbe-b96a-a2527df68a86", + "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" : "ec637a12-001e-001f-19e6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec637a12-001e-001f-19e6-64eb66000000\nTime:2019-09-06T19:05:18.3471606Z", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "52d084ae-c396-4cbe-b96a-a2527df68a86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4a2b9653-2e55-4867-b923-5c6882a7ca0e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637a28-001e-001f-2de6-64eb66000000", + "Body" : "jtcsetaccesspolicyerrorjtcsetaccesspolicyerror053941ce863fa8fade482baFri, 06 Sep 2019 19:05:18 GMT\"0x8D732FD2875645D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "4a2b9653-2e55-4867-b923-5c6882a7ca0e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyerror053941ce863fa8fade482ba?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" : "a142619d-f95d-4bab-b289-72e2ab5e296c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637a3a-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:18 GMT", + "x-ms-client-request-id" : "a142619d-f95d-4bab-b289-72e2ab5e296c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyerror053941ce863fa8fade482ba", "jtcsetaccesspolicyerror15515657edba90f9174d578" ] +} \ 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..259141e2b341 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids051652ed00f7a7ec0340d39c?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" : "1d339dd9-6c78-49d1-9d1e-aee813b8e8fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD271B7427\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec637378-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "1d339dd9-6c78-49d1-9d1e-aee813b8e8fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids051652ed00f7a7ec0340d39c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f98d5250-3f64-4167-8503-16c4512d55a8", + "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" : "\"0x8D732FD273B0F9D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637421-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "f98d5250-3f64-4167-8503-16c4512d55a8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids051652ed00f7a7ec0340d39c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bf515a6e-bf51-4ded-81b6-675724b7461a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD273B0F9D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63744d-001e-001f-77e6-64eb66000000", + "Body" : "00002019-09-06T19:05:16.0000000Z2019-09-07T19:05:16.0000000Zr00012019-09-06T19:05:16.0000000Z2019-09-08T19:05:16.0000000Zw", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "bf515a6e-bf51-4ded-81b6-675724b7461a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3389075a-041b-4701-8b3d-3c02cdc6651b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637470-001e-001f-18e6-64eb66000000", + "Body" : "jtcsetaccesspolicyidsjtcsetaccesspolicyids051652ed00f7a7ec0340d39cFri, 06 Sep 2019 19:05:16 GMT\"0x8D732FD273B0F9D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "3389075a-041b-4701-8b3d-3c02cdc6651b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids051652ed00f7a7ec0340d39c?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" : "1fc9600d-0859-4d51-b997-660bb724e2ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637492-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:16 GMT", + "x-ms-client-request-id" : "1fc9600d-0859-4d51-b997-660bb724e2ad" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyids051652ed00f7a7ec0340d39c", "2019-09-06T19:05:16.233Z", "2019-09-06T19:05:16.233Z", "2019-09-06T19:05:16.233Z", "2019-09-06T19:05:16.233Z" ] +} \ 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..b6554180026b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess045079ddf6f457c72446f?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" : "b3660ae8-a622-4405-a4d2-f118a1172acc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD26D09D8D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63724b-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "b3660ae8-a622-4405-a4d2-f118a1172acc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess045079ddf6f457c72446f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "542f5cd7-3f45-418c-8b64-73d844498ba5", + "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" : "\"0x8D732FD26D72CB3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63726f-001e-001f-42e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "542f5cd7-3f45-418c-8b64-73d844498ba5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess045079ddf6f457c72446f?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" : "e198fed9-6f63-4ef3-a0b9-e2e3fd81adb0" + }, + "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" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD26D72CB3\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "ec63728e-001e-001f-5be6-64eb66000000", + "x-ms-client-request-id" : "e198fed9-6f63-4ef3-a0b9-e2e3fd81adb0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d29ca1c7-380c-48d7-97fe-683011f1872a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6372a3-001e-001f-70e6-64eb66000000", + "Body" : "jtcsetaccesspolicyminaccessjtcsetaccesspolicyminaccess045079ddf6f457c72446fFri, 06 Sep 2019 19:05:15 GMT\"0x8D732FD26D72CB3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "d29ca1c7-380c-48d7-97fe-683011f1872a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess045079ddf6f457c72446f?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" : "15f759ff-2b8c-4eb1-aabf-0fded0526941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec6372b3-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "15f759ff-2b8c-4eb1-aabf-0fded0526941" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyminaccess045079ddf6f457c72446f" ] +} \ 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..c06d03a6981d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids06072119c9e4c15ce84a47?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" : "6bb39a6f-f3dd-4dc5-9f78-c83ffa7a5551" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD26EE8CFF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec6372d0-001e-001f-1de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "6bb39a6f-f3dd-4dc5-9f78-c83ffa7a5551" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids06072119c9e4c15ce84a47?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "73ec794e-58f6-45a4-98ab-3bd0e8175e86", + "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" : "\"0x8D732FD26F7DBF2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6372ef-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "73ec794e-58f6-45a4-98ab-3bd0e8175e86" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids06072119c9e4c15ce84a47?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c399f90e-5b6c-44e2-908b-30008a40865e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD26F7DBF2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637324-001e-001f-6be6-64eb66000000", + "Body" : "00002019-09-06T19:05:15.0000000Z2019-09-07T19:05:15.0000000Zr", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "c399f90e-5b6c-44e2-908b-30008a40865e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "485c538a-8d60-4e97-bdaf-1bf1a2011c93" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637349-001e-001f-0fe6-64eb66000000", + "Body" : "jtcsetaccesspolicyminidsjtcsetaccesspolicyminids06072119c9e4c15ce84a47Fri, 06 Sep 2019 19:05:15 GMT\"0x8D732FD26F7DBF2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "485c538a-8d60-4e97-bdaf-1bf1a2011c93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids06072119c9e4c15ce84a47?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" : "ddb8b94e-ec2d-41cd-aa3e-bc789f163cb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637360-001e-001f-25e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:15 GMT", + "x-ms-client-request-id" : "ddb8b94e-ec2d-41cd-aa3e-bc789f163cb6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyminids06072119c9e4c15ce84a47" ] +} \ 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..994bd72e8ec0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json @@ -0,0 +1,153 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata0containerapitestsetmetadata910718212e20eb?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" : "08cb77b4-8af5-4776-ac09-d42dcddd7406" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2466F73C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636814-001e-001f-0ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "08cb77b4-8af5-4776-ac09-d42dcddd7406" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata91044121874a6c?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" : "fe017612-cc64-4b24-b34d-d01a58531d7a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD246C9DE8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec63683c-001e-001f-31e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "fe017612-cc64-4b24-b34d-d01a58531d7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata91044121874a6c?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "90c8a616-995f-4736-a0c2-0b6e92065cf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD249CB878\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec6368e9-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "90c8a616-995f-4736-a0c2-0b6e92065cf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata91044121874a6c?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" : "d8a04802-c138-4aed-9818-234bca2ce1ef" + }, + "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" : "Fri, 06 Sep 2019 19:05:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD249CB878\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec636967-001e-001f-43e6-64eb66000000", + "x-ms-client-request-id" : "d8a04802-c138-4aed-9818-234bca2ce1ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5769ffd8-bfe0-4bfc-8e4d-d36ea966eab0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec63697c-001e-001f-56e6-64eb66000000", + "Body" : "jtcsetmetadatajtcsetmetadata0containerapitestsetmetadata910718212e20ebFri, 06 Sep 2019 19:05:11 GMT\"0x8D732FD2466F73C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetmetadata1containerapitestsetmetadata91044121874a6cFri, 06 Sep 2019 19:05:11 GMT\"0x8D732FD249CB878\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:11 GMT", + "x-ms-client-request-id" : "5769ffd8-bfe0-4bfc-8e4d-d36ea966eab0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata0containerapitestsetmetadata910718212e20eb?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" : "c61e1b3c-1c8c-4285-bb38-4bf30fd114e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636992-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "c61e1b3c-1c8c-4285-bb38-4bf30fd114e5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata91044121874a6c?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" : "88020080-c6c7-458c-a0f8-d2889e000e8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636a13-001e-001f-59e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "88020080-c6c7-458c-a0f8-d2889e000e8d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadata0containerapitestsetmetadata910718212e20eb", "jtcsetmetadata1containerapitestsetmetadata91044121874a6c" ] +} \ 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..d964a9a9df4e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacb2130908dce5?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" : "ef709b3e-3fb9-4a97-b68a-93f125d0e064" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD254CD3F6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636bdb-001e-001f-69e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "ef709b3e-3fb9-4a97-b68a-93f125d0e064" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacb2130908dce5?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0c5e364d-112c-455d-94a3-b4aab07dd87f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25531520\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636bed-001e-001f-7ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "0c5e364d-112c-455d-94a3-b4aab07dd87f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a1c312c3-be20-454a-93a1-6e81eb91b4cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636c0d-001e-001f-14e6-64eb66000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataacb2130908dce5Fri, 06 Sep 2019 19:05:13 GMT\"0x8D732FD25531520\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "a1c312c3-be20-454a-93a1-6e81eb91b4cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacb2130908dce5?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" : "2a71b9ef-351c-4b1b-a562-3aa99a765e5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636c23-001e-001f-2ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "2a71b9ef-351c-4b1b-a562-3aa99a765e5e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataacb2130908dce5" ] +} \ 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..22bc627d3219 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacf3f0163597b6?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" : "166c8425-c728-4a82-a4ca-11b38df6e993" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD2566CAE0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636c48-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "166c8425-c728-4a82-a4ca-11b38df6e993" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacf3f0163597b6?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "caa6eaa5-e2a3-43d2-b86f-e7eddd2915d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD256C487C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636c69-001e-001f-69e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "caa6eaa5-e2a3-43d2-b86f-e7eddd2915d9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "74fc2eb8-f2c4-43dc-ab74-75268671e5e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636c78-001e-001f-77e6-64eb66000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataacf3f0163597b6Fri, 06 Sep 2019 19:05:13 GMT\"0x8D732FD256C487C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "74fc2eb8-f2c4-43dc-ab74-75268671e5e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacf3f0163597b6?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" : "b45acc0c-ec37-4213-8e93-2f08a546b8f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636c8d-001e-001f-0be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "b45acc0c-ec37-4213-8e93-2f08a546b8f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataacf3f0163597b6" ] +} \ 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..0c66379629c6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac01784370003f?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" : "f3852aa8-adfa-436d-945e-879f5a6bd578" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25810FF7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636cb4-001e-001f-2be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "f3852aa8-adfa-436d-945e-879f5a6bd578" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac01784370003f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4946b74f-843a-4901-8ffb-fdefc4c7969b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25810FF7\"", + "x-ms-lease-id" : "8614e241-f4e3-486e-926f-b047430c2575", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636cd1-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "4946b74f-843a-4901-8ffb-fdefc4c7969b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac01784370003f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a2336ce8-85b6-430e-987b-9717dea40a21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD258C0D23\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636ce0-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "a2336ce8-85b6-430e-987b-9717dea40a21" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "46dbd2dd-e0a6-4270-a39b-af38f0751f48" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636cf8-001e-001f-68e6-64eb66000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataac01784370003fFri, 06 Sep 2019 19:05:13 GMT\"0x8D732FD258C0D23\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "46dbd2dd-e0a6-4270-a39b-af38f0751f48", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac01784370003f?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c968fb5-ceb5-40f4-8298-d8232b3c55f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD258C0D23\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636d14-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "7c968fb5-ceb5-40f4-8298-d8232b3c55f4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac01784370003f?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" : "5d806faf-21a9-45ed-bc43-2326b7a69b22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636d26-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "5d806faf-21a9-45ed-bc43-2326b7a69b22" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataac01784370003f" ] +} \ 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..b99bb6e6c207 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfail27933406?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" : "50609123-4f0b-4e84-ae40-12205f1e7bf8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25A51B7B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636d3f-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "50609123-4f0b-4e84-ae40-12205f1e7bf8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfail27933406?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a6ba994e-b8d4-4cc5-a8e2-b8556afab213" + }, + "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" : "ec636d4e-001e-001f-31e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec636d4e-001e-001f-31e6-64eb66000000\nTime:2019-09-06T19:05:13.6267019Z", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "a6ba994e-b8d4-4cc5-a8e2-b8556afab213", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c984c9a2-6d5d-4e12-9502-8abd82f72288" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636d5e-001e-001f-40e6-64eb66000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0containerapitestsetmetadataacfail27933406Fri, 06 Sep 2019 19:05:13 GMT\"0x8D732FD25A51B7B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "c984c9a2-6d5d-4e12-9502-8abd82f72288", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfail27933406?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" : "90a62df4-b683-4852-9ab5-b31aeb5b4056" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636d72-001e-001f-54e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "90a62df4-b683-4852-9ab5-b31aeb5b4056" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0containerapitestsetmetadataacfail27933406" ] +} \ 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..196758cb182c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailcd220734?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" : "6b6fe964-8464-4a32-909f-937c83f115e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25D4C285\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636df7-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "6b6fe964-8464-4a32-909f-937c83f115e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailcd220734?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0b45bcd0-e82e-457a-9b9e-f2b13dc34a4d" + }, + "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" : "ec636e0d-001e-001f-60e6-64eb66000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:ec636e0d-001e-001f-60e6-64eb66000000\nTime:2019-09-06T19:05:13.9359942Z", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "0b45bcd0-e82e-457a-9b9e-f2b13dc34a4d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5e1f261d-c2d8-4e74-bd1b-015bb56d4917" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636e22-001e-001f-74e6-64eb66000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0containerapitestsetmetadataacfailcd220734Fri, 06 Sep 2019 19:05:13 GMT\"0x8D732FD25D4C285\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "5e1f261d-c2d8-4e74-bd1b-015bb56d4917", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailcd220734?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" : "90f77e84-8e07-457a-ab18-5936007abe10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636e33-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "90f77e84-8e07-457a-ab18-5936007abe10" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0containerapitestsetmetadataacfailcd220734" ] +} \ 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..e0d51a145f0c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal034122f6e595412f3f40f68?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" : "ee2c2ae7-f7cd-4028-802c-aebda1db4728" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25EA4B85\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636e4c-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "ee2c2ae7-f7cd-4028-802c-aebda1db4728" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "541d11ed-72c6-460c-92a6-d9f7eb3b5cd8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636e68-001e-001f-32e6-64eb66000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal034122f6e595412f3f40f68Fri, 06 Sep 2019 19:05:14 GMT\"0x8D732FD25EA4B85\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "541d11ed-72c6-460c-92a6-d9f7eb3b5cd8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal034122f6e595412f3f40f68?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" : "abb8de11-4932-440a-aca1-5466a18daf46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636e82-001e-001f-48e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "abb8de11-4932-440a-aca1-5466a18daf46" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal034122f6e595412f3f40f68" ] +} \ 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..3782cf399f3c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal0104591dc7bfd454e04bfc8?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" : "ac6b49af-0a37-4b72-bef3-f403a00988e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25FFAD77\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636eb2-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:13 GMT", + "x-ms-client-request-id" : "ac6b49af-0a37-4b72-bef3-f403a00988e9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5830cd58-3196-4204-9b18-dbf9995a52f4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636ed5-001e-001f-14e6-64eb66000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal0104591dc7bfd454e04bfc8Fri, 06 Sep 2019 19:05:14 GMT\"0x8D732FD25FFAD77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "5830cd58-3196-4204-9b18-dbf9995a52f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal0104591dc7bfd454e04bfc8?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" : "dd5fae26-0470-49fd-80ab-5222f6f73b02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636eea-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "dd5fae26-0470-49fd-80ab-5222f6f73b02" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal0104591dc7bfd454e04bfc8" ] +} \ 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..88f861567f89 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal0873663f84f52b550145c3b?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" : "2b4aaa95-2528-4ad5-bfff-8b70b8dc194d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD261892AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636f0b-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "2b4aaa95-2528-4ad5-bfff-8b70b8dc194d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2d3ad65b-484b-48c8-9571-d0130caf1e09" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636f3e-001e-001f-71e6-64eb66000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal0873663f84f52b550145c3bFri, 06 Sep 2019 19:05:14 GMT\"0x8D732FD261892AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "2d3ad65b-484b-48c8-9571-d0130caf1e09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal0873663f84f52b550145c3b?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" : "e397bc81-74ee-45d3-ad52-0e2e59df0763" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636f55-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "e397bc81-74ee-45d3-ad52-0e2e59df0763" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal0873663f84f52b550145c3b" ] +} \ 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..1a07d367da65 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0containerapitestsetmetadataerror419749928?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" : "f6f11e41-cee9-4650-a52d-6cb214417862" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD262B0DB7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636f6e-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "f6f11e41-cee9-4650-a52d-6cb214417862" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror1containerapitestsetmetadataerror41941124e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1401e2a5-77de-4aca-900f-c736eb0a6002" + }, + "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" : "ec636ffd-001e-001f-18e6-64eb66000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:ec636ffd-001e-001f-18e6-64eb66000000\nTime:2019-09-06T19:05:14.7137301Z", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "1401e2a5-77de-4aca-900f-c736eb0a6002", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0e4111b6-cbb2-449e-a705-1de0634024bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec637013-001e-001f-2be6-64eb66000000", + "Body" : "jtcsetmetadataerrorjtcsetmetadataerror0containerapitestsetmetadataerror419749928Fri, 06 Sep 2019 19:05:14 GMT\"0x8D732FD262B0DB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "0e4111b6-cbb2-449e-a705-1de0634024bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0containerapitestsetmetadataerror419749928?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" : "4da3fcf1-75c9-4691-b6c9-ce7e94115661" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec637028-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:14 GMT", + "x-ms-client-request-id" : "4da3fcf1-75c9-4691-b6c9-ce7e94115661" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataerror0containerapitestsetmetadataerror419749928", "jtcsetmetadataerror1containerapitestsetmetadataerror41941124e" ] +} \ 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..b48e4df22d53 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata09716114fddf4b3d9f4b5b9?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" : "1b0ed4cd-1d50-4984-868d-a8e4bf52a6d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD250B4E47\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636ab6-001e-001f-6ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "1b0ed4cd-1d50-4984-868d-a8e4bf52a6d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata09716114fddf4b3d9f4b5b9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "22a2b6ed-47b3-4e51-8c84-8b132a881803" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD25111A3A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636aca-001e-001f-7fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "22a2b6ed-47b3-4e51-8c84-8b132a881803" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata09716114fddf4b3d9f4b5b9?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" : "ca5e7b9c-65c9-4fb9-b08f-d25a5eaf92fb" + }, + "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" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD25111A3A\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec636ae1-001e-001f-12e6-64eb66000000", + "x-ms-client-request-id" : "ca5e7b9c-65c9-4fb9-b08f-d25a5eaf92fb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "203666dc-7e91-4a63-9552-34183b54064a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636af0-001e-001f-20e6-64eb66000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata09716114fddf4b3d9f4b5b9Fri, 06 Sep 2019 19:05:12 GMT\"0x8D732FD25111A3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "203666dc-7e91-4a63-9552-34183b54064a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata09716114fddf4b3d9f4b5b9?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" : "0e3294ef-24cf-4a69-a9cb-89d4924bd37c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636b04-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "0e3294ef-24cf-4a69-a9cb-89d4924bd37c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata09716114fddf4b3d9f4b5b9" ] +} \ 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..77fc0b31f0b6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata035423555a894f329c4dfa9?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" : "de5fbaa1-4a98-4820-aa3f-6c8648f46b87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD252C24A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636b25-001e-001f-4be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "de5fbaa1-4a98-4820-aa3f-6c8648f46b87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata035423555a894f329c4dfa9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "07a3fd85-ff90-48ff-bf9b-b88a1d880064" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD253217BB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636b60-001e-001f-7ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "07a3fd85-ff90-48ff-bf9b-b88a1d880064" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata035423555a894f329c4dfa9?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" : "67104216-4570-44eb-a55c-7c84b2bde177" + }, + "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" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD253217BB\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec636b7a-001e-001f-15e6-64eb66000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "67104216-4570-44eb-a55c-7c84b2bde177" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a9bc6b1a-09c2-4a93-a986-9dc7b37df00a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636b97-001e-001f-2de6-64eb66000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata035423555a894f329c4dfa9Fri, 06 Sep 2019 19:05:12 GMT\"0x8D732FD253217BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "a9bc6b1a-09c2-4a93-a986-9dc7b37df00a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata035423555a894f329c4dfa9?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" : "4f7ba903-0408-4388-861b-ad4050b869a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636bb1-001e-001f-44e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "4f7ba903-0408-4388-861b-ad4050b869a3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata035423555a894f329c4dfa9" ] +} \ 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..ff34c7d9aa17 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminde212554203?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" : "ce1ce8d0-2b04-4a0c-97b6-869ba81a83cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD24E96635\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec636a32-001e-001f-74e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "ce1ce8d0-2b04-4a0c-97b6-869ba81a83cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminde212554203?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "45340712-3802-4827-8937-ddc8c6740776" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FD24EF0B0E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636a5f-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "45340712-3802-4827-8937-ddc8c6740776" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminde212554203?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" : "c65c15d8-b2fd-4af9-9b96-d8f339372fe9" + }, + "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" : "Fri, 06 Sep 2019 19:05:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D732FD24EF0B0E\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "ec636a70-001e-001f-2de6-64eb66000000", + "x-ms-client-request-id" : "c65c15d8-b2fd-4af9-9b96-d8f339372fe9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c9bf7f73-f618-45ca-8945-050d0d0e363c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec636a81-001e-001f-3de6-64eb66000000", + "Body" : "jtcsetmetadataminjtcsetmetadatamin0containerapitestsetmetadataminde212554203Fri, 06 Sep 2019 19:05:12 GMT\"0x8D732FD24EF0B0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "c9bf7f73-f618-45ca-8945-050d0d0e363c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminde212554203?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" : "b2e0acad-0411-44e4-bea8-d2a2352fbb4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec636a97-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:05:12 GMT", + "x-ms-client-request-id" : "b2e0acad-0411-44e4-bea8-d2a2352fbb4b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatamin0containerapitestsetmetadataminde212554203" ] +} \ 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..08f9a06e37b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcwebcontainer0containerapitestwebcontainerbde49784aeb65?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" : "6088a2b2-085d-42d7-b371-2325e92fd735" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA8DD07B7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65bd44-001e-001f-5ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "6088a2b2-085d-42d7-b371-2325e92fd735" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f4b629d8-1165-4963-bf59-84f741c29946" + }, + "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" : "ec65bd61-001e-001f-77e6-64eb66000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:ec65bd61-001e-001f-77e6-64eb66000000\nTime:2019-09-06T19:08:53.8047560Z", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "f4b629d8-1165-4963-bf59-84f741c29946", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "72c88b44-cefe-4f55-b558-a86316647a80", + "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" : "\"0x8D732FDA8EB66FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bd8d-001e-001f-17e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "72c88b44-cefe-4f55-b558-a86316647a80" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5fb01980-6e92-4e07-875b-0ed4b0ba1e63" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bda4-001e-001f-2be6-64eb66000000", + "Body" : "jtcwebcontainerjtcwebcontainer0containerapitestwebcontainerbde49784aeb65Fri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA8DD07B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "5fb01980-6e92-4e07-875b-0ed4b0ba1e63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcwebcontainer0containerapitestwebcontainerbde49784aeb65?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" : "68ee2086-79ef-4adc-973d-3d5170df09c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65bdbe-001e-001f-41e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "68ee2086-79ef-4adc-973d-3d5170df09c6" + }, + "Exception" : null + } ], + "variables" : [ "jtcwebcontainer0containerapitestwebcontainerbde49784aeb65" ] +} \ 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..d7fcabd03cc1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure5860906193178d56?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" : "50787fc0-6fa8-4fc9-9142-874a9cab1236" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA9BFFD95\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c14c-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "50787fc0-6fa8-4fc9-9142-874a9cab1236" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure5860906193178d56/javablobfailure1downloadresponsetestfailure5861709580e916", + "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" : "dd3cba6c-8702-4d11-82a2-c59c5636c375", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA9C5DF39\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c170-001e-001f-5fe6-64eb66000000", + "x-ms-client-request-id" : "dd3cba6c-8702-4d11-82a2-c59c5636c375" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8731fb4d-0071-48be-a007-bcf044bc3f5c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c1a3-001e-001f-06e6-64eb66000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailure5860906193178d56Fri, 06 Sep 2019 19:08:55 GMT\"0x8D732FDA9BFFD95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "8731fb4d-0071-48be-a007-bcf044bc3f5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure5860906193178d56?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" : "236144f1-1eb6-4185-a794-9740b072e3b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c1b4-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "236144f1-1eb6-4185-a794-9740b072e3b7" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailure5860906193178d56", "javablobfailure1downloadresponsetestfailure5861709580e916" ] +} \ 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..8f8102a49773 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure273818321e3a65b3?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" : "6a7eb1a1-acf2-40c4-b75b-ead596965659" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA9D909EA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c1d8-001e-001f-33e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "6a7eb1a1-acf2-40c4-b75b-ead596965659" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure273818321e3a65b3/javablobfailure1downloadresponsetestfailure27309123a7440f", + "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" : "8a99e7fa-22ad-4f3d-a6bd-c79ff0201226", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA9DEC45E\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c1f3-001e-001f-4ae6-64eb66000000", + "x-ms-client-request-id" : "8a99e7fa-22ad-4f3d-a6bd-c79ff0201226" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5559b018-bf3b-4e85-b693-0ddc5a6853c1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c209-001e-001f-5fe6-64eb66000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailure273818321e3a65b3Fri, 06 Sep 2019 19:08:55 GMT\"0x8D732FDA9D909EA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "5559b018-bf3b-4e85-b693-0ddc5a6853c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure273818321e3a65b3?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" : "80b0a0bc-8886-4df0-bc1f-c548f7ca9805" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c21b-001e-001f-6ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "80b0a0bc-8886-4df0-bc1f-c548f7ca9805" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailure273818321e3a65b3", "javablobfailure1downloadresponsetestfailure27309123a7440f" ] +} \ 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..72f8f3e639ec --- /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://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailureefc58366eedf9435?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" : "7b35b365-9eb5-4e9f-bec2-96ac64192a3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA9EE92EA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c231-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "7b35b365-9eb5-4e9f-bec2-96ac64192a3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailureefc58366eedf9435/javablobfailure1downloadresponsetestfailureefc575118cfd17", + "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" : "073d57ae-5a46-47a5-aa60-1a430ddcfbaa", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAA467878\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c38b-001e-001f-24e6-64eb66000000", + "x-ms-client-request-id" : "073d57ae-5a46-47a5-aa60-1a430ddcfbaa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b908097d-3c7c-4204-b5c0-0547cf6284d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c3a0-001e-001f-35e6-64eb66000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailureefc58366eedf9435Fri, 06 Sep 2019 19:08:55 GMT\"0x8D732FDA9EE92EA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "b908097d-3c7c-4204-b5c0-0547cf6284d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailureefc58366eedf9435?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" : "16f1aec5-0630-4f8e-9c86-1e6852eedb4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c3bb-001e-001f-4be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "16f1aec5-0630-4f8e-9c86-1e6852eedb4a" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailureefc58366eedf9435", "javablobfailure1downloadresponsetestfailureefc575118cfd17" ] +} \ 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..11d888d3bba7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteriab4a957166d44133?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" : "db6cdb00-ac37-4a80-bd1f-32cf305e4875" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAAA2F364\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c50c-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "db6cdb00-ac37-4a80-bd1f-32cf305e4875" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteriab4a957166d44133/javablobgetteria1downloadresponsetestgetteriab4a95893edb09", + "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" : "a7bf5464-2829-4c5c-9df4-87d7b81731ab", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAAB1D714\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c53e-001e-001f-12e6-64eb66000000", + "x-ms-client-request-id" : "a7bf5464-2829-4c5c-9df4-87d7b81731ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cd3a01ae-33c3-47bd-875d-92c198b6aa59" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c557-001e-001f-29e6-64eb66000000", + "Body" : "jtcgetteriajtcgetteria0downloadresponsetestgetteriab4a957166d44133Fri, 06 Sep 2019 19:08:56 GMT\"0x8D732FDAAA2F364\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "cd3a01ae-33c3-47bd-875d-92c198b6aa59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteriab4a957166d44133?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" : "ed6f3f67-aeef-45d9-bffa-4b16ca017241" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c569-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "ed6f3f67-aeef-45d9-bffa-4b16ca017241" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetteria0downloadresponsetestgetteriab4a957166d44133", "javablobgetteria1downloadresponsetestgetteriab4a95893edb09", "04ee4b2f-5faa-4913-aad5-f7f755f60a2a" ] +} \ 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..05afa4af3e33 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfo0downloadresponsetestinfo3af83270d593c53a396?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" : "56aa09c6-4d99-4ea6-8018-94865e8c7917" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAAC3A2AE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c57e-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "56aa09c6-4d99-4ea6-8018-94865e8c7917" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfo0downloadresponsetestinfo3af83270d593c53a396/javablobinfo1downloadresponsetestinfo3af83972912fa6cc1", + "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" : "16a74f75-28ee-4ade-afc6-03f8aaaf394d", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAAC95C44\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c596-001e-001f-60e6-64eb66000000", + "x-ms-client-request-id" : "16a74f75-28ee-4ade-afc6-03f8aaaf394d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "69df7089-0dbd-44f4-8682-06ec2c0336ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c5a7-001e-001f-71e6-64eb66000000", + "Body" : "jtcinfojtcinfo0downloadresponsetestinfo3af83270d593c53a396Fri, 06 Sep 2019 19:08:56 GMT\"0x8D732FDAAC3A2AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "69df7089-0dbd-44f4-8682-06ec2c0336ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfo0downloadresponsetestinfo3af83270d593c53a396?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" : "a3aa7df7-df82-4ba4-a3ea-373ada4d4868" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c5bf-001e-001f-08e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "a3aa7df7-df82-4ba4-a3ea-373ada4d4868" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfo0downloadresponsetestinfo3af83270d593c53a396", "javablobinfo1downloadresponsetestinfo3af83972912fa6cc1" ] +} \ 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..03a9eef278ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountiac7e78708afda?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" : "b049f97c-10a1-43e8-91a1-bd00d77f3080" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAADC87E3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c5f0-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "b049f97c-10a1-43e8-91a1-bd00d77f3080" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountiac7e78708afda/javablobinfocountia1downloadresponsetestinfocountiac7e0497272", + "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" : "2ac58c26-20ca-4ce9-80d9-6ccd1e7db2a4", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAAE2B6A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c604-001e-001f-42e6-64eb66000000", + "x-ms-client-request-id" : "2ac58c26-20ca-4ce9-80d9-6ccd1e7db2a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f39b290e-e30e-4fd0-aee9-9a1ee40b2cdc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c61e-001e-001f-58e6-64eb66000000", + "Body" : "jtcinfocountiajtcinfocountia0downloadresponsetestinfocountiac7e78708afdaFri, 06 Sep 2019 19:08:57 GMT\"0x8D732FDAADC87E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "f39b290e-e30e-4fd0-aee9-9a1ee40b2cdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountiac7e78708afda?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" : "8899cd61-7679-424a-909f-f4a77cab6552" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c639-001e-001f-6de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "8899cd61-7679-424a-909f-f4a77cab6552" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfocountia0downloadresponsetestinfocountiac7e78708afda", "javablobinfocountia1downloadresponsetestinfocountiac7e0497272" ] +} \ 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..83005ff42436 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaf0c541959bc25?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" : "6cadd65f-1763-45a5-82da-afe6400089da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAA59A3AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c3db-001e-001f-63e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "6cadd65f-1763-45a5-82da-afe6400089da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaf0c541959bc25/javablobinfonullia1downloadresponsetestinfonulliaf0c789753bb", + "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" : "d77a3b20-97d9-419c-b1b4-7f1552ea0077", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAA5F5D8B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c3fe-001e-001f-02e6-64eb66000000", + "x-ms-client-request-id" : "d77a3b20-97d9-419c-b1b4-7f1552ea0077" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "055f893f-4f48-4bd8-8732-b62f2cd0fbe0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c418-001e-001f-16e6-64eb66000000", + "Body" : "jtcinfonulliajtcinfonullia0downloadresponsetestinfonulliaf0c541959bc25Fri, 06 Sep 2019 19:08:56 GMT\"0x8D732FDAA59A3AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "055f893f-4f48-4bd8-8732-b62f2cd0fbe0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaf0c541959bc25?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" : "fcc93bb9-6043-4e1b-bab9-a6c8b4d62956" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c429-001e-001f-25e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "fcc93bb9-6043-4e1b-bab9-a6c8b4d62956" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfonullia0downloadresponsetestinfonulliaf0c541959bc25", "javablobinfonullia1downloadresponsetestinfonulliaf0c789753bb", "5ccdfb0a-a90f-439a-b077-1d33b35bbfbd" ] +} \ 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..5939ad29ed83 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonullia1e919024c33e1?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" : "8bbf474c-c983-467c-87e7-509ce419dbe8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAA73C1A4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c447-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "8bbf474c-c983-467c-87e7-509ce419dbe8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonullia1e919024c33e1/javablobinfonullia1downloadresponsetestinfonullia1e993633aa5", + "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" : "81db44a5-ffc5-4bcc-b855-3985ca7bf083", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAA797B80\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c45d-001e-001f-52e6-64eb66000000", + "x-ms-client-request-id" : "81db44a5-ffc5-4bcc-b855-3985ca7bf083" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1a8bcb48-fea0-4e79-bed3-f47fb29955dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c477-001e-001f-6ae6-64eb66000000", + "Body" : "jtcinfonulliajtcinfonullia0downloadresponsetestinfonullia1e919024c33e1Fri, 06 Sep 2019 19:08:56 GMT\"0x8D732FDAA73C1A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:55 GMT", + "x-ms-client-request-id" : "1a8bcb48-fea0-4e79-bed3-f47fb29955dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonullia1e919024c33e1?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" : "1c32df78-d399-4997-aeb5-8473073be954" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c483-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "1c32df78-d399-4997-aeb5-8473073be954" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfonullia0downloadresponsetestinfonullia1e919024c33e1", "javablobinfonullia1downloadresponsetestinfonullia1e993633aa5", "f5da726d-16ad-4978-ae79-f84b41ac35a7" ] +} \ 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..0160761596fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcallf37265446fb3?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" : "b226e900-d45f-4517-846d-a571a1bcf65b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA93D4068\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65bef3-001e-001f-42e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "b226e900-d45f-4517-846d-a571a1bcf65b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcallf37265446fb3/javablobnetworkcall1downloadresponsetestnetworkcallf378277391", + "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" : "d66ab6c5-e7f6-477c-9df0-bd08d38706e5", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA94370DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65bf16-001e-001f-5fe6-64eb66000000", + "x-ms-client-request-id" : "d66ab6c5-e7f6-477c-9df0-bd08d38706e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcallf37265446fb3/javablobnetworkcall1downloadresponsetestnetworkcallf378277391", + "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" : "14513eb3-3e2e-4fa8-8d0c-170c927a4673" + }, + "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" : "Fri, 06 Sep 2019 19:08:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDA94370DF\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:08:54 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ec65bf43-001e-001f-05e6-64eb66000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "14513eb3-3e2e-4fa8-8d0c-170c927a4673", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e7be0e97-4d86-4e26-bdaa-af923fc79054" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65bf62-001e-001f-21e6-64eb66000000", + "Body" : "jtcnetworkcalljtcnetworkcall0downloadresponsetestnetworkcallf37265446fb3Fri, 06 Sep 2019 19:08:54 GMT\"0x8D732FDA93D4068\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:53 GMT", + "x-ms-client-request-id" : "e7be0e97-4d86-4e26-bdaa-af923fc79054", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcallf37265446fb3?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" : "e3c03ac9-86b8-42fe-a8c6-cdcaa801c05b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65bf81-001e-001f-3ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "e3c03ac9-86b8-42fe-a8c6-cdcaa801c05b" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworkcall0downloadresponsetestnetworkcallf37265446fb3", "javablobnetworkcall1downloadresponsetestnetworkcallf378277391" ] +} \ 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..e495ca3cc720 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia43b47168604fbd?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" : "69abe73b-346b-4006-a98b-531f86968d51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAA8971C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c49f-001e-001f-0fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "69abe73b-346b-4006-a98b-531f86968d51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia43b47168604fbd/javabloboptionsia1downloadresponsetestoptionsia43b961683ea9", + "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" : "9ed278f5-02ba-4fb1-8851-43006785ece0", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDAA8F52A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c4bf-001e-001f-27e6-64eb66000000", + "x-ms-client-request-id" : "9ed278f5-02ba-4fb1-8851-43006785ece0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c5790e69-1d29-4185-8b64-e4e3e92b5bb9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c4d9-001e-001f-3de6-64eb66000000", + "Body" : "jtcoptionsiajtcoptionsia0downloadresponsetestoptionsia43b47168604fbdFri, 06 Sep 2019 19:08:56 GMT\"0x8D732FDAA8971C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "c5790e69-1d29-4185-8b64-e4e3e92b5bb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia43b47168604fbd?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" : "6be7a000-09b7-4d86-ba0f-95bee0ee2cd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c4e5-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "6be7a000-09b7-4d86-ba0f-95bee0ee2cd9" + }, + "Exception" : null + } ], + "variables" : [ "jtcoptionsia0downloadresponsetestoptionsia43b47168604fbd", "javabloboptionsia1downloadresponsetestoptionsia43b961683ea9" ] +} \ 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..707c6cc26995 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfula12616511fa59?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" : "e3b09780-5047-4f55-a971-daaad088b420" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA9636F4B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65bfc3-001e-001f-72e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "e3b09780-5047-4f55-a971-daaad088b420" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfula12616511fa59/javablobsuccessful1downloadresponsetestsuccessfula1215471986", + "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" : "25ae5821-ee65-419c-91dc-08a961b061b3", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA9690330\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65bfe9-001e-001f-10e6-64eb66000000", + "x-ms-client-request-id" : "25ae5821-ee65-419c-91dc-08a961b061b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6088698d-91ca-44dc-9087-dccce7b0a4fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c04c-001e-001f-63e6-64eb66000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessfula12616511fa59Fri, 06 Sep 2019 19:08:54 GMT\"0x8D732FDA9636F4B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "6088698d-91ca-44dc-9087-dccce7b0a4fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfula12616511fa59?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" : "bc6a7a68-6821-48e6-9457-ae481cb85f91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c05f-001e-001f-75e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "bc6a7a68-6821-48e6-9457-ae481cb85f91" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessfula12616511fa59", "javablobsuccessful1downloadresponsetestsuccessfula1215471986", "3a56fc2c-2579-4e85-8a86-98a2ff4c5c29" ] +} \ 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..e73cdc761fc9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful53b488373a210?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" : "fcdb8af1-e9f9-4eda-b75f-6aeedab00a69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA989770A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c071-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "fcdb8af1-e9f9-4eda-b75f-6aeedab00a69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful53b488373a210/javablobsuccessful1downloadresponsetestsuccessful53b512525d3", + "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" : "38ffdc7e-3bac-41b0-a4d2-510b50e72a0c", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA98F800B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c088-001e-001f-18e6-64eb66000000", + "x-ms-client-request-id" : "38ffdc7e-3bac-41b0-a4d2-510b50e72a0c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cb43fe5f-95b8-41e8-bd8d-d7ebeadbc974" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c0ad-001e-001f-3be6-64eb66000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessful53b488373a210Fri, 06 Sep 2019 19:08:54 GMT\"0x8D732FDA989770A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "cb43fe5f-95b8-41e8-bd8d-d7ebeadbc974", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful53b488373a210?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" : "ed329eda-8d3e-4df4-b196-4d2587fb0fbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c0c7-001e-001f-4ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "ed329eda-8d3e-4df4-b196-4d2587fb0fbf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessful53b488373a210", "javablobsuccessful1downloadresponsetestsuccessful53b512525d3", "cca5c38d-a6d6-49cb-992d-829e09718dc3" ] +} \ 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..c8b4554be493 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful6076771924555?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" : "2a8e0939-8a43-4b37-b1df-7020be9ebd6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDA9A40A5E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c0e6-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "2a8e0939-8a43-4b37-b1df-7020be9ebd6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful6076771924555/javablobsuccessful1downloadresponsetestsuccessful60744262e15", + "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" : "d0b417e0-e11c-432b-a7b5-4b8de2270ec1", + "Content-Type" : "application/octet-stream" + }, + "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 19:08:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDA9AAFDD2\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65c102-001e-001f-7ee6-64eb66000000", + "x-ms-client-request-id" : "d0b417e0-e11c-432b-a7b5-4b8de2270ec1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8ba0d98b-f6fb-4cbc-a0a6-8503c1030bca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c11c-001e-001f-14e6-64eb66000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessful6076771924555Fri, 06 Sep 2019 19:08:55 GMT\"0x8D732FDA9A40A5E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "8ba0d98b-f6fb-4cbc-a0a6-8503c1030bca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful6076771924555?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" : "8f0fa23b-072e-4a3c-a566-fd3e6eaae38d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c12c-001e-001f-23e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:54 GMT", + "x-ms-client-request-id" : "8f0fa23b-072e-4a3c-a566-fd3e6eaae38d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessful6076771924555", "javablobsuccessful1downloadresponsetestsuccessful60744262e15", "11b95375-ace6-4ef6-89fb-19afa30dbdcf" ] +} \ 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..29b6dbe22dd7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse063171db4024c967594c?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" : "9711e3b5-03db-4307-9769-0751a2d38862" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB39BE16D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e9ca-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "9711e3b5-03db-4307-9769-0751a2d38862" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e3113fd-e283-408f-9788-4e350ff4d12c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e9df-001e-001f-19e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse063171db4024c967594cFri, 06 Sep 2019 19:09:11 GMT\"0x8D732FDB39BE16D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "3e3113fd-e283-408f-9788-4e350ff4d12c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse063171db4024c967594c?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" : "007f584f-ef44-4530-8e9c-e35245c1d10a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e9f0-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "007f584f-ef44-4530-8e9c-e35245c1d10a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse063171db4024c967594c" ] +} \ 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..958f4d60deba --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse014344f926ae47cdd84b?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" : "08fe9b1b-bb5b-4397-a9c1-3f45b64a294c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB3AF953C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ea0b-001e-001f-3de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "08fe9b1b-bb5b-4397-a9c1-3f45b64a294c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c7a3542c-1870-4212-af2e-9c3ccfd63194" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ea23-001e-001f-53e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse014344f926ae47cdd84bFri, 06 Sep 2019 19:09:11 GMT\"0x8D732FDB3AF953C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "c7a3542c-1870-4212-af2e-9c3ccfd63194", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse014344f926ae47cdd84b?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" : "18f3c329-b7dd-4b54-bf1d-50fb9a166d37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ea2d-001e-001f-5de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "18f3c329-b7dd-4b54-bf1d-50fb9a166d37" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse014344f926ae47cdd84b" ] +} \ 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..9976ba0df4c3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse06449318b0d9e70e5546?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" : "3896aa5e-b648-4f70-adec-d1078714911b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB3C5E1B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ea49-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "3896aa5e-b648-4f70-adec-d1078714911b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b91f32d0-240c-47e3-a4c7-9e5420f2a411" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ea75-001e-001f-1ce6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse06449318b0d9e70e5546Fri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB3C5E1B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "b91f32d0-240c-47e3-a4c7-9e5420f2a411", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse06449318b0d9e70e5546?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" : "af022aa0-beda-4d5c-ae11-73bbdee8f93d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ea8d-001e-001f-33e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "af022aa0-beda-4d5c-ae11-73bbdee8f93d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse06449318b0d9e70e5546" ] +} \ 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..97558f939512 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse017168cc5f51a040d244?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" : "a4b573b0-1622-4e71-835f-00d1877090fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB3D6D5BE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65eaa8-001e-001f-4be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "a4b573b0-1622-4e71-835f-00d1877090fc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "728b3085-2063-4de5-ac9a-37912c7a4b82" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65eaeb-001e-001f-01e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse017168cc5f51a040d244Fri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB3D6D5BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "728b3085-2063-4de5-ac9a-37912c7a4b82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse017168cc5f51a040d244?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" : "7faac9c4-81e0-44c2-8c4c-9516f2216993" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65eb03-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "7faac9c4-81e0-44c2-8c4c-9516f2216993" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse017168cc5f51a040d244" ] +} \ 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..3e84ecface99 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse032155cc9fa93fda3249?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" : "568b562a-a46a-4b7e-9ca0-241b9d146612" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB3F2A1C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65eb18-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "568b562a-a46a-4b7e-9ca0-241b9d146612" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2231d78a-19f5-423b-b2af-de7eca75de01" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65eb2d-001e-001f-38e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse032155cc9fa93fda3249Fri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB3F2A1C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "2231d78a-19f5-423b-b2af-de7eca75de01", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse032155cc9fa93fda3249?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" : "1cd83c8d-81c3-4a7b-9c1c-fc558dbdf7bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65eb4f-001e-001f-53e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "1cd83c8d-81c3-4a7b-9c1c-fc558dbdf7bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse032155cc9fa93fda3249" ] +} \ 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..b6388cbf1441 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse051541e6a542efca2e4a?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" : "f784600d-f528-4e49-92f6-bdfaa9dad286" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4078E68\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65eb6c-001e-001f-69e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "f784600d-f528-4e49-92f6-bdfaa9dad286" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fb48feef-55f5-469a-91fd-bc05fc297e12" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65eb91-001e-001f-06e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse051541e6a542efca2e4aFri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB4078E68\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "fb48feef-55f5-469a-91fd-bc05fc297e12", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse051541e6a542efca2e4a?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" : "60178871-f967-49b9-805c-f28708fbcfd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65eb9e-001e-001f-12e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "60178871-f967-49b9-805c-f28708fbcfd3" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse051541e6a542efca2e4a" ] +} \ 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..04174a887934 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse057336748f43b19a204b?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" : "810396ae-42d2-4756-a5fe-9b550843a6c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB41A0963\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ebc3-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "810396ae-42d2-4756-a5fe-9b550843a6c9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0765b70f-bae1-4947-a3f7-c789ce9890de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ebe1-001e-001f-4ae6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse057336748f43b19a204bFri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB41A0963\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "0765b70f-bae1-4947-a3f7-c789ce9890de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse057336748f43b19a204b?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" : "d390b1f3-0410-493e-9b5f-f7900ed76299" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ebef-001e-001f-57e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "d390b1f3-0410-493e-9b5f-f7900ed76299" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse057336748f43b19a204b" ] +} \ 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..8dde65f4500f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0263075b6106b6818448?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" : "10f5521a-0c3b-410b-a78a-d2186e027a03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB42D961B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ec0a-001e-001f-6fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "10f5521a-0c3b-410b-a78a-d2186e027a03" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bde93930-277f-4714-85bf-274acb860a86" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ec73-001e-001f-50e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0263075b6106b6818448Fri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB42D961B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "bde93930-277f-4714-85bf-274acb860a86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0263075b6106b6818448?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" : "f63b7e10-5271-4263-b0c3-7bedf4b8895c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ec81-001e-001f-5be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "f63b7e10-5271-4263-b0c3-7bedf4b8895c" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0263075b6106b6818448" ] +} \ 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..784b0f229ce5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse01006667ce0db64e2640?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" : "6e240eae-cf53-482d-af31-a378e01a9176" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4534F9F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ec94-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "6e240eae-cf53-482d-af31-a378e01a9176" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1b1c569e-a5e9-4fbb-bd2a-b62b2795c0e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65eca2-001e-001f-76e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse01006667ce0db64e2640Fri, 06 Sep 2019 19:09:12 GMT\"0x8D732FDB4534F9F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "1b1c569e-a5e9-4fbb-bd2a-b62b2795c0e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse01006667ce0db64e2640?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" : "18ed372b-3d96-4e48-ba56-6b6cdc676b39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ecaf-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "18ed372b-3d96-4e48-ba56-6b6cdc676b39" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse01006667ce0db64e2640" ] +} \ 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..4498ce29e3d6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0060639c70aa79304946?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" : "a32724a1-f37d-495f-90d1-b78fe6e9e81b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4652E34\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ecce-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "a32724a1-f37d-495f-90d1-b78fe6e9e81b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c0ff65f6-562e-4300-adcc-4f59f63dc3fd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ece8-001e-001f-37e6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0060639c70aa79304946Fri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB4652E34\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "c0ff65f6-562e-4300-adcc-4f59f63dc3fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0060639c70aa79304946?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" : "52a4d3f8-35de-44bd-a4fb-eefa81c0948a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ed00-001e-001f-49e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "52a4d3f8-35de-44bd-a4fb-eefa81c0948a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0060639c70aa79304946" ] +} \ 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..c2bc1de566cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia009161bafd592aed9c4?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" : "69160e19-5127-4fac-99d8-5742848b6413" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB47A41EB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ed1b-001e-001f-60e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "69160e19-5127-4fac-99d8-5742848b6413" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5e41112f-6611-48c7-bd00-b5d5aa623c0a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ed41-001e-001f-7ce6-64eb66000000", + "Body" : "jtcaccountsaspermissionsparseiajtcaccountsaspermissionsparseia009161bafd592aed9c4Fri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB47A41EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "5e41112f-6611-48c7-bd00-b5d5aa623c0a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia009161bafd592aed9c4?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" : "b082170c-d800-458d-9391-a6c33810416e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ed52-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "b082170c-d800-458d-9391-a6c33810416e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparseia009161bafd592aed9c4" ] +} \ 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..674c97c9076b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring048517af9e9344935b?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" : "4d30e0bf-8706-4ea1-a742-96cb56f15b0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB2BA9A0E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e612-001e-001f-4ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "4d30e0bf-8706-4ea1-a742-96cb56f15b0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9b7596d5-dd42-4147-bdf6-b482a247b28c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e687-001e-001f-2fe6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring048517af9e9344935bFri, 06 Sep 2019 19:09:10 GMT\"0x8D732FDB2BA9A0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "9b7596d5-dd42-4147-bdf6-b482a247b28c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring048517af9e9344935b?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" : "f43e16a1-4eda-4fff-aba8-b89279f4c4b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e69e-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "f43e16a1-4eda-4fff-aba8-b89279f4c4b0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring048517af9e9344935b" ] +} \ 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..ff9bf0677cde --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring030307c27f39cee02b?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" : "9aff7c21-7b27-4ca6-a6cf-4986198b06f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB2DCF76D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e6bd-001e-001f-5ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "9aff7c21-7b27-4ca6-a6cf-4986198b06f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "634e26b2-c307-4d7e-8f0a-e36f138d5170" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e6d6-001e-001f-6ee6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring030307c27f39cee02bFri, 06 Sep 2019 19:09:10 GMT\"0x8D732FDB2DCF76D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "634e26b2-c307-4d7e-8f0a-e36f138d5170", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring030307c27f39cee02b?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" : "7b30556c-116c-4d9b-9971-76bd3418cdb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e6f0-001e-001f-04e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "7b30556c-116c-4d9b-9971-76bd3418cdb2" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring030307c27f39cee02b" ] +} \ 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..c97cff774b7c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring035364cd6fb32a10ad?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" : "d8a5983c-81db-48f3-a79b-f919fac6622c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB2FC6DDA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e72d-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "d8a5983c-81db-48f3-a79b-f919fac6622c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7d4c7c65-d8cf-4f2c-b088-4c10768b9dc6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e74a-001e-001f-55e6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring035364cd6fb32a10adFri, 06 Sep 2019 19:09:10 GMT\"0x8D732FDB2FC6DDA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "7d4c7c65-d8cf-4f2c-b088-4c10768b9dc6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring035364cd6fb32a10ad?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" : "4e60753a-8216-4775-afc6-812dbe957e8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e75d-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "4e60753a-8216-4775-afc6-812dbe957e8b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring035364cd6fb32a10ad" ] +} \ 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..df104b83eb7d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring023680dddac4c24ceb?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" : "c98dbf6e-df41-4a8b-8b12-24515993bfe0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB311A89D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e76e-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "c98dbf6e-df41-4a8b-8b12-24515993bfe0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7dcd5dbb-39ec-4b5e-bcb8-cc3152ae21ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e789-001e-001f-0ce6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring023680dddac4c24cebFri, 06 Sep 2019 19:09:10 GMT\"0x8D732FDB311A89D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "7dcd5dbb-39ec-4b5e-bcb8-cc3152ae21ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring023680dddac4c24ceb?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" : "718c4c2a-8961-439f-aa5b-cb5043b40e8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e794-001e-001f-15e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "718c4c2a-8961-439f-aa5b-cb5043b40e8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring023680dddac4c24ceb" ] +} \ 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..b3fade9c243e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0165908f8ef8708003?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" : "e88b9bab-0a28-49c3-a719-59329e8df935" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB322C3BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e7a5-001e-001f-23e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "e88b9bab-0a28-49c3-a719-59329e8df935" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b3b08275-6d8c-48ef-961f-b075624b72d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e7c2-001e-001f-3ae6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0165908f8ef8708003Fri, 06 Sep 2019 19:09:10 GMT\"0x8D732FDB322C3BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "b3b08275-6d8c-48ef-961f-b075624b72d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0165908f8ef8708003?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" : "22013d51-8d51-4707-91b7-143e35599075" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e7dc-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "22013d51-8d51-4707-91b7-143e35599075" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0165908f8ef8708003" ] +} \ 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..6bfdd7c76525 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring092088bc2b36fa982a?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" : "4766fb78-3b68-4c68-913c-b2c730930c59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB3345426\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e806-001e-001f-7ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "4766fb78-3b68-4c68-913c-b2c730930c59" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3652ac22-a032-4985-ba07-443f3abf2ea3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e826-001e-001f-19e6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring092088bc2b36fa982aFri, 06 Sep 2019 19:09:11 GMT\"0x8D732FDB3345426\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "3652ac22-a032-4985-ba07-443f3abf2ea3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring092088bc2b36fa982a?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" : "c2af5998-b3b7-4344-8e15-be4f5693de8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e843-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "c2af5998-b3b7-4344-8e15-be4f5693de8b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring092088bc2b36fa982a" ] +} \ 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..f8e403f01c73 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0951716e4cca32083f?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" : "5257d651-70d4-4044-9377-2492459bd608" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB34B6429\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e865-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "5257d651-70d4-4044-9377-2492459bd608" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "adee6340-a0bf-4319-b81e-4a7694200a9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e887-001e-001f-6de6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0951716e4cca32083fFri, 06 Sep 2019 19:09:11 GMT\"0x8D732FDB34B6429\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "adee6340-a0bf-4319-b81e-4a7694200a9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0951716e4cca32083f?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" : "fa3f8096-c63d-40f4-879d-0bd5f9618076" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e89e-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "fa3f8096-c63d-40f4-879d-0bd5f9618076" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0951716e4cca32083f" ] +} \ 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..5a4f05d5851f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring08944517d78adb7026?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" : "f38556f1-6048-4225-a200-d3b2c8132320" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB35C7F3C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e8c0-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "f38556f1-6048-4225-a200-d3b2c8132320" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0dfc400f-aa3d-4787-a525-e0e456da20dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e8d8-001e-001f-36e6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring08944517d78adb7026Fri, 06 Sep 2019 19:09:11 GMT\"0x8D732FDB35C7F3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "0dfc400f-aa3d-4787-a525-e0e456da20dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring08944517d78adb7026?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" : "d75663d0-b667-4547-bff9-8bc303c315a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e8f0-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:10 GMT", + "x-ms-client-request-id" : "d75663d0-b667-4547-bff9-8bc303c315a9" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring08944517d78adb7026" ] +} \ 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..53256ea1a72c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring061643489ea596c296?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" : "18fdfdde-b819-4a1f-8dab-7376d4f83cad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB36DE891\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e90b-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "18fdfdde-b819-4a1f-8dab-7376d4f83cad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "36a4a372-cfc4-465c-accb-2afee899e803" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e989-001e-001f-53e6-64eb66000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring061643489ea596c296Fri, 06 Sep 2019 19:09:11 GMT\"0x8D732FDB36DE891\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "36a4a372-cfc4-465c-accb-2afee899e803", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring061643489ea596c296?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" : "703064c5-a274-4849-8c6e-2d1db642f8fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e999-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:11 GMT", + "x-ms-client-request-id" : "703064c5-a274-4849-8c6e-2d1db642f8fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring061643489ea596c296" ] +} \ 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..cef84f271d95 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia0591189af227da48fe416?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" : "090cf5dd-8268-4d0a-8662-d69cd1ff555a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5523834\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f045-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "090cf5dd-8268-4d0a-8662-d69cd1ff555a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5094c43a-bad0-4aba-b525-6c0296632f32" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f066-001e-001f-42e6-64eb66000000", + "Body" : "jtcaccountsasresourcetypeiajtcaccountsasresourcetypeia0591189af227da48fe416Fri, 06 Sep 2019 19:09:14 GMT\"0x8D732FDB5523834\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "5094c43a-bad0-4aba-b525-6c0296632f32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia0591189af227da48fe416?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" : "ddf89409-af5e-4847-a47e-a0b49688fcb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f072-001e-001f-4be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "ddf89409-af5e-4847-a47e-a0b49688fcb3" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeia0591189af227da48fe416" ] +} \ 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..bb07a9d56e3f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse008960d394b8e4d7944?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" : "bc1227c8-2e9d-46bb-a471-a04f9ba8db04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4ED91D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65eec6-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "bc1227c8-2e9d-46bb-a471-a04f9ba8db04" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96b0e0b0-be85-497a-bb03-676dd8fdd650" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65eeec-001e-001f-74e6-64eb66000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse008960d394b8e4d7944Fri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB4ED91D3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "96b0e0b0-be85-497a-bb03-676dd8fdd650", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse008960d394b8e4d7944?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" : "b59c5fa2-92a7-4ba9-b27c-3cf8a1e98444" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65eeff-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "b59c5fa2-92a7-4ba9-b27c-3cf8a1e98444" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse008960d394b8e4d7944" ] +} \ 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..4bb8f446c4b7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse010995e31972da4b224?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" : "eed178a2-acf6-426a-b87e-7d1507596caf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5011E8B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ef1e-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "eed178a2-acf6-426a-b87e-7d1507596caf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a283cc92-299a-46ea-be9c-4a21458aa27b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ef35-001e-001f-35e6-64eb66000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse010995e31972da4b224Fri, 06 Sep 2019 19:09:14 GMT\"0x8D732FDB5011E8B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "a283cc92-299a-46ea-be9c-4a21458aa27b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse010995e31972da4b224?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" : "b75cd64f-150e-4861-b67d-7165af95a334" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ef4c-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "b75cd64f-150e-4861-b67d-7165af95a334" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse010995e31972da4b224" ] +} \ 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..fcbfcc243324 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse04852100436adf48ff4?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" : "39748e65-b184-4f6a-bf21-0c5fa998e13d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB52AF7B2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65efa5-001e-001f-20e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "39748e65-b184-4f6a-bf21-0c5fa998e13d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8757e9e6-e44c-4fea-bf97-3b86c6c6e48d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65efdd-001e-001f-51e6-64eb66000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse04852100436adf48ff4Fri, 06 Sep 2019 19:09:14 GMT\"0x8D732FDB52AF7B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "8757e9e6-e44c-4fea-bf97-3b86c6c6e48d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse04852100436adf48ff4?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" : "708879d3-81a5-4ea9-b52d-1c2da8c45a04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65effa-001e-001f-6ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "708879d3-81a5-4ea9-b52d-1c2da8c45a04" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse04852100436adf48ff4" ] +} \ 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..ba96170515fd --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0250442138b60428724?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" : "4d9d20c4-7899-4b12-a627-1fbfbaa21291" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB53D2483\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f01a-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "4d9d20c4-7899-4b12-a627-1fbfbaa21291" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c6de80b7-778b-443a-9577-7e3814e741cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f029-001e-001f-10e6-64eb66000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0250442138b60428724Fri, 06 Sep 2019 19:09:14 GMT\"0x8D732FDB53D2483\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "c6de80b7-778b-443a-9577-7e3814e741cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0250442138b60428724?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" : "4cc0f3d3-1148-4e83-837d-c2b1fdac0924" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f039-001e-001f-1be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "4cc0f3d3-1148-4e83-837d-c2b1fdac0924" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0250442138b60428724" ] +} \ 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..9950a06970c0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring05997651508af6744e?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" : "f3fdc721-9beb-40e4-a2f1-dbfc11f36c78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4928AAF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ed76-001e-001f-2be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "f3fdc721-9beb-40e4-a2f1-dbfc11f36c78" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "abc00b9b-72c7-4f28-bfd9-fbc984545e2d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ed9e-001e-001f-4ce6-64eb66000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring05997651508af6744eFri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB4928AAF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "abc00b9b-72c7-4f28-bfd9-fbc984545e2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring05997651508af6744e?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" : "69a654e3-2886-4a16-ba3c-8906650ba9e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65edc5-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:12 GMT", + "x-ms-client-request-id" : "69a654e3-2886-4a16-ba3c-8906650ba9e9" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring05997651508af6744e" ] +} \ 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..5ceacdb6771e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring016883f06476625bcf?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" : "2a2f63f1-5ab9-45a0-abfd-6e72410136b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4ACA8A9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ede6-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "2a2f63f1-5ab9-45a0-abfd-6e72410136b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "131397ff-4968-4f12-9e75-4b0302ade711" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65edf7-001e-001f-18e6-64eb66000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring016883f06476625bcfFri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB4ACA8A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "131397ff-4968-4f12-9e75-4b0302ade711", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring016883f06476625bcf?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" : "14488bef-dcc9-4237-9fc4-6ed97f13f2c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ee0a-001e-001f-28e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "14488bef-dcc9-4237-9fc4-6ed97f13f2c6" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring016883f06476625bcf" ] +} \ 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..39b59fe33c88 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring057437a935356bef0f?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" : "7b7005ec-143d-40d3-86be-2f39ac337ca3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4C65155\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ee23-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "7b7005ec-143d-40d3-86be-2f39ac337ca3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a2aea8f5-65b8-4a05-a205-c52479032616" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ee49-001e-001f-5ee6-64eb66000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring057437a935356bef0fFri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB4C65155\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "a2aea8f5-65b8-4a05-a205-c52479032616", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring057437a935356bef0f?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" : "edfecbf2-018c-418a-9503-fcdd2c89b3d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ee55-001e-001f-6ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "edfecbf2-018c-418a-9503-fcdd2c89b3d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring057437a935356bef0f" ] +} \ 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..9b944dd68ba7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0331108548d278583d?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" : "503945e2-0d48-4987-8085-43b48e2c8849" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB4D82FEE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ee78-001e-001f-0ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "503945e2-0d48-4987-8085-43b48e2c8849" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "77a3292b-90a5-4f79-ab1c-de8395ecd7a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ee89-001e-001f-1be6-64eb66000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0331108548d278583dFri, 06 Sep 2019 19:09:13 GMT\"0x8D732FDB4D82FEE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "77a3292b-90a5-4f79-ab1c-de8395ecd7a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0331108548d278583d?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" : "05230761-6195-45ff-b677-627adcd7f04a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ee9a-001e-001f-2ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:13 GMT", + "x-ms-client-request-id" : "05230761-6195-45ff-b677-627adcd7f04a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0331108548d278583d" ] +} \ 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..1e9f8b358eab --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign0739889c8a3de7440?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" : "512db9b2-b0e0-43b2-8122-5d822205336f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB201A4E7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e30f-001e-001f-56e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "512db9b2-b0e0-43b2-8122-5d822205336f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bf1d58a4-969c-40bf-996f-1af61d512b52" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e35d-001e-001f-12e6-64eb66000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign0739889c8a3de7440Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB201A4E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "bf1d58a4-969c-40bf-996f-1af61d512b52", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign0739889c8a3de7440?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" : "5b3f45be-4873-4a12-a88d-ded175824773" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e36d-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "5b3f45be-4873-4a12-a88d-ded175824773" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign0739889c8a3de7440" ] +} \ 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..1c1582b5bdbc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign031523eab2cd45d15?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" : "faba2276-fad5-4d28-9989-c93c87c4b86f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB217A33F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e383-001e-001f-32e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "faba2276-fad5-4d28-9989-c93c87c4b86f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c4be95bd-33b6-4913-89a9-5503598b909b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e3a2-001e-001f-4be6-64eb66000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign031523eab2cd45d15Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB217A33F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "c4be95bd-33b6-4913-89a9-5503598b909b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign031523eab2cd45d15?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" : "70619da3-ab40-429f-b72b-f4f525f1d3fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e3bd-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "70619da3-ab40-429f-b72b-f4f525f1d3fa" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign031523eab2cd45d15" ] +} \ 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..853431395c79 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign027246ae2f4f44dbb?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" : "59575b16-695d-425f-b561-32d12b9264d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB22981CF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e3e5-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "59575b16-695d-425f-b561-32d12b9264d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8d76b5e1-f552-4d38-85ca-5b4b086c79a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e403-001e-001f-1de6-64eb66000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign027246ae2f4f44dbbFri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB22981CF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "8d76b5e1-f552-4d38-85ca-5b4b086c79a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign027246ae2f4f44dbb?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" : "437f3526-7e53-4ae3-909b-b22cfcfd4fdc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e423-001e-001f-37e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "437f3526-7e53-4ae3-909b-b22cfcfd4fdc" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign027246ae2f4f44dbb" ] +} \ 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..010a4b9f2183 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia095559eb8dc67eb89d4?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" : "4a1f3590-1c27-441a-bf1a-107df91c0877" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB23A9CEC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e44f-001e-001f-5ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "4a1f3590-1c27-441a-bf1a-107df91c0877" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d95555c6-5be2-4922-bff3-5c9ba1eec504" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e45f-001e-001f-6de6-64eb66000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia095559eb8dc67eb89d4Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB23A9CEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "d95555c6-5be2-4922-bff3-5c9ba1eec504", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia095559eb8dc67eb89d4?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" : "2c592528-83ae-40ed-996f-514322a2d132" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e473-001e-001f-7fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "2c592528-83ae-40ed-996f-514322a2d132" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia095559eb8dc67eb89d4" ] +} \ 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..4eecfb42f6c9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia050677ff704e683b6f4?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" : "4d278da2-9980-4424-950a-8a172fcfc454" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB24C546A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e490-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "4d278da2-9980-4424-950a-8a172fcfc454" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "653fd5e4-937a-4282-ade8-fd25602ee2d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e4a3-001e-001f-24e6-64eb66000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia050677ff704e683b6f4Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB24C546A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "653fd5e4-937a-4282-ade8-fd25602ee2d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia050677ff704e683b6f4?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" : "686b3877-4784-4b4a-9281-1424fe4020db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e4b9-001e-001f-37e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "686b3877-4784-4b4a-9281-1424fe4020db" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia050677ff704e683b6f4" ] +} \ 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..85c5f840fdf1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia004478ac15b5821f0f4?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" : "91dfb717-87fb-4069-857d-7a63bbf216e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB2602F55\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e4dc-001e-001f-53e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "91dfb717-87fb-4069-857d-7a63bbf216e8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "85682026-f1b7-46b3-937e-5d5313390a4c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e4eb-001e-001f-5ce6-64eb66000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia004478ac15b5821f0f4Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB2602F55\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "85682026-f1b7-46b3-937e-5d5313390a4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia004478ac15b5821f0f4?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" : "7bc28880-2ce9-461d-98e6-0e53743d2d16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e4f5-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "7bc28880-2ce9-461d-98e6-0e53743d2d16" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia004478ac15b5821f0f4" ] +} \ 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..ee924dbcc5bd --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia07269349fc8da6bc2a4?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" : "79ad4bb7-18fa-40e6-9c06-e5253d5eda1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB274A6A1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e503-001e-001f-72e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "79ad4bb7-18fa-40e6-9c06-e5253d5eda1d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0aebf897-7a74-43fa-8034-e746748a0814" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e51d-001e-001f-08e6-64eb66000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia07269349fc8da6bc2a4Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB274A6A1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "0aebf897-7a74-43fa-8034-e746748a0814", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia07269349fc8da6bc2a4?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" : "108eb1f0-2dc6-41c2-a47c-8c1e8cb91b95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e533-001e-001f-18e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "108eb1f0-2dc6-41c2-a47c-8c1e8cb91b95" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia07269349fc8da6bc2a4" ] +} \ 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..1b4998344831 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0264833fa930ee657e4?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" : "20f8d36d-a47d-4504-9d99-604a4b90ef9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB2883359\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e54a-001e-001f-2ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "20f8d36d-a47d-4504-9d99-604a4b90ef9b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "70cde89a-2891-4a88-959e-8de7f8a1dfc4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e570-001e-001f-49e6-64eb66000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0264833fa930ee657e4Fri, 06 Sep 2019 19:09:09 GMT\"0x8D732FDB2883359\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "70cde89a-2891-4a88-959e-8de7f8a1dfc4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0264833fa930ee657e4?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" : "3d21eeb8-876a-47c5-a341-206fe4005ca1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e590-001e-001f-60e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "3d21eeb8-876a-47c5-a341-206fe4005ca1" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0264833fa930ee657e4" ] +} \ 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..b2246d8789d6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia07352306a414013e1a4?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" : "7ced4d4f-4ae1-4843-bf19-908b76bc57a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB29D6E1D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e5c6-001e-001f-0de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "7ced4d4f-4ae1-4843-bf19-908b76bc57a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "97aba0e1-0ccc-4c4d-8585-c4e5d59f8721" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e5eb-001e-001f-2be6-64eb66000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia07352306a414013e1a4Fri, 06 Sep 2019 19:09:10 GMT\"0x8D732FDB29D6E1D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "97aba0e1-0ccc-4c4d-8585-c4e5d59f8721", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia07352306a414013e1a4?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" : "acc5af6c-e09f-4a96-944e-d0820d17db13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e5fb-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:09 GMT", + "x-ms-client-request-id" : "acc5af6c-e09f-4a96-944e-d0820d17db13" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia07352306a414013e1a4" ] +} \ 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..58169d4c0947 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange69970288bfe2f07ab0c?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" : "a4f79b52-83e0-4bb8-bfab-e78c73caad0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAB19C6CA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c6dc-001e-001f-7ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "a4f79b52-83e0-4bb8-bfab-e78c73caad0d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "34f1fe8e-c83e-4ee4-a13d-22e10f5f132d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c7b2-001e-001f-34e6-64eb66000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange69970288bfe2f07ab0cFri, 06 Sep 2019 19:08:57 GMT\"0x8D732FDAB19C6CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "34f1fe8e-c83e-4ee4-a13d-22e10f5f132d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange69970288bfe2f07ab0c?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" : "d25ea353-4f3e-4e0d-8db6-60268bdfb1a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c7cc-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "d25ea353-4f3e-4e0d-8db6-60268bdfb1a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange69970288bfe2f07ab0c" ] +} \ 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..0cf8cd64329d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange26d7647853ff6e74aa3?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" : "2263f35b-f7e8-41cd-adeb-cf58d5fdefb4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAB627A24\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c7f9-001e-001f-6ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "2263f35b-f7e8-41cd-adeb-cf58d5fdefb4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d891b22d-d32a-4e60-8d1f-1c717ddd6a4d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c814-001e-001f-04e6-64eb66000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange26d7647853ff6e74aa3Fri, 06 Sep 2019 19:08:57 GMT\"0x8D732FDAB627A24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "d891b22d-d32a-4e60-8d1f-1c717ddd6a4d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange26d7647853ff6e74aa3?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" : "c4439830-5f5c-439c-bb07-98953e1dd314" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c824-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "c4439830-5f5c-439c-bb07-98953e1dd314" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange26d7647853ff6e74aa3" ] +} \ 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..28f221a197ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange76a99161a42ae4f3ccb?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" : "e2a4111f-63fd-4812-9b74-3d1d59f09363" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAB734715\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c846-001e-001f-2de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "e2a4111f-63fd-4812-9b74-3d1d59f09363" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ba13f753-c393-4fb9-9798-d4f1b6b137fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c867-001e-001f-4ae6-64eb66000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange76a99161a42ae4f3ccbFri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDAB734715\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "ba13f753-c393-4fb9-9798-d4f1b6b137fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange76a99161a42ae4f3ccb?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" : "4f8e42ab-7359-4a17-8fb7-c01fef4cca9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c87e-001e-001f-5ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "4f8e42ab-7359-4a17-8fb7-c01fef4cca9d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange76a99161a42ae4f3ccb" ] +} \ 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..607a1ddd31cb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia15d7507079edc5a0c?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" : "7dfa9437-af23-4159-8e6f-b333af937291" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAB8377AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c898-001e-001f-77e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "7dfa9437-af23-4159-8e6f-b333af937291" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f0e89cc1-1afd-4a61-bfaf-85b5b1bec3b1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c8ba-001e-001f-13e6-64eb66000000", + "Body" : "jtcblobrangeiajtcblobrangeia0helpertestblobrangeia15d7507079edc5a0cFri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDAB8377AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "f0e89cc1-1afd-4a61-bfaf-85b5b1bec3b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia15d7507079edc5a0c?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" : "5a4b0f09-f71f-4652-80bb-d7e88dda5823" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c8d3-001e-001f-28e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "5a4b0f09-f71f-4652-80bb-d7e88dda5823" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0helpertestblobrangeia15d7507079edc5a0c" ] +} \ 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..1e60a9abe1f6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia6224682079707c4de?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" : "59b9c6bb-35f1-4f1c-9bb5-5d170e4fb481" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAB94E0F4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c8f2-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "59b9c6bb-35f1-4f1c-9bb5-5d170e4fb481" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "65379dca-ca79-4b6a-bc5e-e0fb5c8b89e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c95c-001e-001f-20e6-64eb66000000", + "Body" : "jtcblobrangeiajtcblobrangeia0helpertestblobrangeia6224682079707c4deFri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDAB94E0F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:57 GMT", + "x-ms-client-request-id" : "65379dca-ca79-4b6a-bc5e-e0fb5c8b89e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia6224682079707c4de?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" : "095d9dcf-fb51-4ad3-ac79-ec3ae3642d7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c973-001e-001f-36e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "095d9dcf-fb51-4ad3-ac79-ec3ae3642d7c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0helpertestblobrangeia6224682079707c4de" ] +} \ 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..472ddeaf6395 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse041149b67758c760794d3?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" : "f86e4868-075a-4da1-be47-894f996be639" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAEFEA806\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d631-001e-001f-51e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "f86e4868-075a-4da1-be47-894f996be639" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "94369920-0c95-4b78-8446-b579e2dc3418" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d652-001e-001f-6ee6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse041149b67758c760794d3Fri, 06 Sep 2019 19:09:04 GMT\"0x8D732FDAEFEA806\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "94369920-0c95-4b78-8446-b579e2dc3418", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse041149b67758c760794d3?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" : "a17c4275-3994-46c5-907a-e9a4a56218e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d670-001e-001f-0be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "a17c4275-3994-46c5-907a-e9a4a56218e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse041149b67758c760794d3" ] +} \ 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..e95ec1f9825b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse06303140763089f3df4dc?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" : "bb350481-c29a-4962-b5de-cad9bd86d8a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAF12D11B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d696-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "bb350481-c29a-4962-b5de-cad9bd86d8a1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eb8cc5ae-daeb-40ed-a426-4eee15763882" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d6ae-001e-001f-45e6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse06303140763089f3df4dcFri, 06 Sep 2019 19:09:04 GMT\"0x8D732FDAF12D11B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "eb8cc5ae-daeb-40ed-a426-4eee15763882", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse06303140763089f3df4dc?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" : "1c49addd-fad5-44d8-9715-f1aaefe44f76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d6be-001e-001f-55e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "1c49addd-fad5-44d8-9715-f1aaefe44f76" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse06303140763089f3df4dc" ] +} \ 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..ecb07ce6ed7e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse031316e911e617581a4ea?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" : "564e298f-e305-4d8d-9522-3af6cf67f369" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAF283304\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d6ea-001e-001f-7de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "564e298f-e305-4d8d-9522-3af6cf67f369" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bf814079-4181-44a4-ab92-ad29699f3cf7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d6fc-001e-001f-0de6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse031316e911e617581a4eaFri, 06 Sep 2019 19:09:04 GMT\"0x8D732FDAF283304\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "bf814079-4181-44a4-ab92-ad29699f3cf7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse031316e911e617581a4ea?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" : "637fb4e9-91e4-4b1c-b5e7-586cc13b5168" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d710-001e-001f-1fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "637fb4e9-91e4-4b1c-b5e7-586cc13b5168" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse031316e911e617581a4ea" ] +} \ 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..19c17503a7a3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0545475a917187a682410?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" : "c25e0bed-91b9-4e77-9c4f-98a0e6b5b1d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAF3AFC31\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d735-001e-001f-41e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "c25e0bed-91b9-4e77-9c4f-98a0e6b5b1d7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "affa7d32-a4e3-4048-afab-3965f85b2000" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d749-001e-001f-51e6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0545475a917187a682410Fri, 06 Sep 2019 19:09:04 GMT\"0x8D732FDAF3AFC31\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "affa7d32-a4e3-4048-afab-3965f85b2000", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0545475a917187a682410?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" : "adeb85fd-708b-430a-a0fc-ecebfdbe0e24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d755-001e-001f-5de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "adeb85fd-708b-430a-a0fc-ecebfdbe0e24" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0545475a917187a682410" ] +} \ 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..d6bbd2ad7fa3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse049647fca287528944451?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" : "e14e03bd-1df5-40a8-a74a-7496827943f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAF4D9E51\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d76d-001e-001f-71e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "e14e03bd-1df5-40a8-a74a-7496827943f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "794633e5-ce07-4aaa-8d7a-634b0b404192" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d787-001e-001f-08e6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse049647fca287528944451Fri, 06 Sep 2019 19:09:04 GMT\"0x8D732FDAF4D9E51\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "794633e5-ce07-4aaa-8d7a-634b0b404192", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse049647fca287528944451?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" : "4d97ebbc-782f-4c31-85a4-df49bca3cc6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d79a-001e-001f-18e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "4d97ebbc-782f-4c31-85a4-df49bca3cc6a" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse049647fca287528944451" ] +} \ 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..2aa1fd46512a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse045209545b86bb5c0b408?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" : "99703358-7e71-4eaf-890b-b85934bd07f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAF60DCD1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d7b4-001e-001f-2ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "99703358-7e71-4eaf-890b-b85934bd07f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2f586c3b-e22a-49b9-847b-15c4d17b98cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d82a-001e-001f-18e6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse045209545b86bb5c0b408Fri, 06 Sep 2019 19:09:04 GMT\"0x8D732FDAF60DCD1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "2f586c3b-e22a-49b9-847b-15c4d17b98cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse045209545b86bb5c0b408?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" : "96160125-3895-4c80-923a-009e510e0af6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d83f-001e-001f-2de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "96160125-3895-4c80-923a-009e510e0af6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse045209545b86bb5c0b408" ] +} \ 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..72976af00327 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0049984d0a0aa36fda466?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" : "4fc14cef-e2a4-4510-81f8-585411e93ba5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAFA68211\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d8be-001e-001f-1fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "4fc14cef-e2a4-4510-81f8-585411e93ba5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4b79c692-5a36-4b21-8815-2cfa4d8602d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d8dc-001e-001f-37e6-64eb66000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0049984d0a0aa36fda466Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDAFA68211\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "4b79c692-5a36-4b21-8815-2cfa4d8602d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0049984d0a0aa36fda466?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" : "b4a6b003-80a4-4f30-8827-a440c710788f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d8f2-001e-001f-46e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "b4a6b003-80a4-4f30-8827-a440c710788f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0049984d0a0aa36fda466" ] +} \ 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..9461e80ecf71 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia051396c033dc96964e45?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" : "e33a05c3-f72a-4b3d-9747-bfeeca000a8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAFBC3228\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d922-001e-001f-6de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "e33a05c3-f72a-4b3d-9747-bfeeca000a8c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e8663345-f131-4c1a-9295-bc11b97fc7ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d943-001e-001f-09e6-64eb66000000", + "Body" : "jtcblobsaspermissionsparseiajtcblobsaspermissionsparseia051396c033dc96964e45Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDAFBC3228\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "e8663345-f131-4c1a-9295-bc11b97fc7ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia051396c033dc96964e45?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" : "09be233f-db39-42f7-b671-2c760a7e74d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d959-001e-001f-1ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "09be233f-db39-42f7-b671-2c760a7e74d6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparseia051396c033dc96964e45" ] +} \ 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..111f60c9e6a6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0171190eaaa96456914e?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" : "b23e457f-1eaf-48e7-9ae0-cbb34e61ee21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE7FBC8F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d435-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "b23e457f-1eaf-48e7-9ae0-cbb34e61ee21" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1387dd59-7f13-495e-b322-c511de890da2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d453-001e-001f-36e6-64eb66000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0171190eaaa96456914eFri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAE7FBC8F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "1387dd59-7f13-495e-b322-c511de890da2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0171190eaaa96456914e?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" : "9fbf0e9b-f42b-45ce-8031-44dbfd2f2c9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d471-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "9fbf0e9b-f42b-45ce-8031-44dbfd2f2c9c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0171190eaaa96456914e" ] +} \ 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..46550872ff24 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring030081b57fe381254147?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" : "cd615287-6d68-46ae-b51f-bbe16206ede0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE991708\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d48c-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "cd615287-6d68-46ae-b51f-bbe16206ede0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "20a94aab-26f8-4483-8c84-1d28a51f9c39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d4cd-001e-001f-25e6-64eb66000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring030081b57fe381254147Fri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAE991708\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "20a94aab-26f8-4483-8c84-1d28a51f9c39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring030081b57fe381254147?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" : "03180800-6f43-487d-8e01-ec719180c9fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d4e1-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "03180800-6f43-487d-8e01-ec719180c9fd" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring030081b57fe381254147" ] +} \ 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..1b582925ffba --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0230470d2c778aa71a48?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" : "771557d8-12d2-47b4-a12f-448e8fdefa05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAEAF8A9B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d4fd-001e-001f-4fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "771557d8-12d2-47b4-a12f-448e8fdefa05" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c6448c9-9690-4e89-9e0d-153366f3f90f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d51c-001e-001f-67e6-64eb66000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0230470d2c778aa71a48Fri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAEAF8A9B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "7c6448c9-9690-4e89-9e0d-153366f3f90f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0230470d2c778aa71a48?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" : "bd7a8a9c-82b2-48f3-844a-0f8aa191f245" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d52d-001e-001f-76e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "bd7a8a9c-82b2-48f3-844a-0f8aa191f245" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0230470d2c778aa71a48" ] +} \ 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..ce64cd1fabad --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0095190059fb416aba4d?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" : "e1cf66cf-3716-4a59-b326-257b201bfc7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAEC53ABC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d559-001e-001f-1ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "e1cf66cf-3716-4a59-b326-257b201bfc7b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "669561c6-9e9d-41b3-a898-77a227d5c014" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d578-001e-001f-32e6-64eb66000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0095190059fb416aba4dFri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAEC53ABC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "669561c6-9e9d-41b3-a898-77a227d5c014", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0095190059fb416aba4d?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" : "9bf98337-f29d-491f-8301-45637add179f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d58c-001e-001f-44e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "9bf98337-f29d-491f-8301-45637add179f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0095190059fb416aba4d" ] +} \ 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..b3792984fd2a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring036265885cbeaf9fa24a?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" : "f122e723-f2a9-4549-a7f4-c862a7521845" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAEDD0E36\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d5b2-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "f122e723-f2a9-4549-a7f4-c862a7521845" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3911fd7b-12ee-4419-a423-f8b23e6f2051" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d5d6-001e-001f-02e6-64eb66000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring036265885cbeaf9fa24aFri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAEDD0E36\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "3911fd7b-12ee-4419-a423-f8b23e6f2051", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring036265885cbeaf9fa24a?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" : "e56ef209-8448-41aa-a36b-591a47e19ae8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d5e1-001e-001f-0ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "e56ef209-8448-41aa-a36b-591a47e19ae8" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring036265885cbeaf9fa24a" ] +} \ 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..45f0cd68833f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring09165580aa34ad9d304e?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" : "dc34c405-b86f-40e9-9d1a-54f89c1d008d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAEEE0233\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d5f3-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "dc34c405-b86f-40e9-9d1a-54f89c1d008d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1064c051-70f8-420c-a533-92f096fd2264" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d60e-001e-001f-32e6-64eb66000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring09165580aa34ad9d304eFri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAEEE0233\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "1064c051-70f8-420c-a533-92f096fd2264", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring09165580aa34ad9d304e?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" : "de78c35e-8a02-4d63-a616-781427178c25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d620-001e-001f-41e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:03 GMT", + "x-ms-client-request-id" : "de78c35e-8a02-4d63-a616-781427178c25" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring09165580aa34ad9d304e" ] +} \ 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..cbe07bfdb5fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0helpertestbloburlparts08499025cae4693e?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" : "dba8627d-ca81-4727-a60b-c5b4e4efff5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5666152\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f08d-001e-001f-62e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "dba8627d-ca81-4727-a60b-c5b4e4efff5c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fa263cbb-3622-458c-895a-dca6be786b9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f0ba-001e-001f-08e6-64eb66000000", + "Body" : "jtcbloburlpartsjtcbloburlparts0helpertestbloburlparts08499025cae4693eFri, 06 Sep 2019 19:09:14 GMT\"0x8D732FDB5666152\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "fa263cbb-3622-458c-895a-dca6be786b9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0helpertestbloburlparts08499025cae4693e?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" : "c4dcdc4d-872e-448c-8d3d-fec862a1de12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f0ca-001e-001f-17e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "c4dcdc4d-872e-448c-8d3d-fec862a1de12" + }, + "Exception" : null + } ], + "variables" : [ "jtcbloburlparts0helpertestbloburlparts08499025cae4693e" ] +} \ 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..d054b6850358 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0107433164fd9514c54?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" : "45cd52c8-cea5-4660-9c48-babca02bd442" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0582275\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65dbb3-001e-001f-2ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "45cd52c8-cea5-4660-9c48-babca02bd442" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "50cc2cd7-9209-4583-af85-91ae88b42332" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65dc24-001e-001f-0fe6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0107433164fd9514c54Fri, 06 Sep 2019 19:09:06 GMT\"0x8D732FDB0582275\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "50cc2cd7-9209-4583-af85-91ae88b42332", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0107433164fd9514c54?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" : "a1aac55e-2d54-472d-9699-9786dec229a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65dc3a-001e-001f-24e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "a1aac55e-2d54-472d-9699-9786dec229a3" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0107433164fd9514c54" ] +} \ 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..144f95212aa5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0018651a406a04bf3f4?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" : "aac711ca-2a05-48bd-aed8-a18190186fff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB07C06D2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65dc52-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "aac711ca-2a05-48bd-aed8-a18190186fff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c94e7d8-8c07-4bcf-8f12-d28cbb30ec5d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65dc65-001e-001f-4de6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0018651a406a04bf3f4Fri, 06 Sep 2019 19:09:06 GMT\"0x8D732FDB07C06D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "1c94e7d8-8c07-4bcf-8f12-d28cbb30ec5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0018651a406a04bf3f4?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" : "8f72c902-858c-484a-8120-8b23d5f8576d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65dc79-001e-001f-61e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "8f72c902-858c-484a-8120-8b23d5f8576d" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0018651a406a04bf3f4" ] +} \ 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..89b1c3b6c33d --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0932702d08390cf5bd4?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" : "26949aac-fb13-41dc-a90b-30a6f50ff74b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0953A26\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65dcbf-001e-001f-1fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "26949aac-fb13-41dc-a90b-30a6f50ff74b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "12ecc5c4-8cca-480d-90bd-2bb353acf938" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65dcd9-001e-001f-37e6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0932702d08390cf5bd4Fri, 06 Sep 2019 19:09:06 GMT\"0x8D732FDB0953A26\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "12ecc5c4-8cca-480d-90bd-2bb353acf938", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0932702d08390cf5bd4?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" : "3b3eb30d-8f37-4d08-a516-3a72532fcf28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65dcf3-001e-001f-4be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "3b3eb30d-8f37-4d08-a516-3a72532fcf28" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0932702d08390cf5bd4" ] +} \ 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..ac6c9fca2d67 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse08496651047c2811404?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" : "50d8b2c9-43fe-49f3-b2f6-7397801e761f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0ADAA01\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65dd19-001e-001f-6fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "50d8b2c9-43fe-49f3-b2f6-7397801e761f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f042b39-ad39-4b55-a765-7b3bff0266b0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65dd9c-001e-001f-63e6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse08496651047c2811404Fri, 06 Sep 2019 19:09:06 GMT\"0x8D732FDB0ADAA01\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "8f042b39-ad39-4b55-a765-7b3bff0266b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse08496651047c2811404?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" : "9bd36f1a-f0a9-4c24-aa90-3af01ba2b1d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ddb3-001e-001f-79e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "9bd36f1a-f0a9-4c24-aa90-3af01ba2b1d7" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse08496651047c2811404" ] +} \ 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..5609b4ea26f6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0669314a3f151ad41e4?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" : "148e5440-11df-4160-bfa5-1b526c4a9860" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0D8E322\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ddd9-001e-001f-19e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "148e5440-11df-4160-bfa5-1b526c4a9860" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "63620111-f39a-45b4-8b0a-2b5c1c602ccc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ddf8-001e-001f-36e6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0669314a3f151ad41e4Fri, 06 Sep 2019 19:09:07 GMT\"0x8D732FDB0D8E322\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "63620111-f39a-45b4-8b0a-2b5c1c602ccc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0669314a3f151ad41e4?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" : "dfe70867-043a-4d27-8f08-3761685663a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65de0d-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "dfe70867-043a-4d27-8f08-3761685663a8" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0669314a3f151ad41e4" ] +} \ 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..35040bf1c3b6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse040454c36d0b0879194?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" : "964bae30-c2cf-4163-b00a-5aa4e2a76891" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0E8EC94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65de2f-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "964bae30-c2cf-4163-b00a-5aa4e2a76891" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3069405d-015d-4b69-8cec-ac8a59ca013b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65de44-001e-001f-7be6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse040454c36d0b0879194Fri, 06 Sep 2019 19:09:07 GMT\"0x8D732FDB0E8EC94\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "3069405d-015d-4b69-8cec-ac8a59ca013b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse040454c36d0b0879194?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" : "a3b4a6c7-e503-409c-b63f-928ceb32ba71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65de55-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "a3b4a6c7-e503-409c-b63f-928ceb32ba71" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse040454c36d0b0879194" ] +} \ 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..b9d329aa4298 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse02905019ce5c336cf84?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" : "422cce6a-948a-4648-9434-25556e6f2c61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0FA2EBA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65de74-001e-001f-29e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "422cce6a-948a-4648-9434-25556e6f2c61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4aa5fdb6-05bf-4b10-90f2-bacd6bee0bb9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65de8f-001e-001f-42e6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse02905019ce5c336cf84Fri, 06 Sep 2019 19:09:07 GMT\"0x8D732FDB0FA2EBA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "4aa5fdb6-05bf-4b10-90f2-bacd6bee0bb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse02905019ce5c336cf84?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" : "c176ce8e-1ae0-4e7a-acf2-ed777c107105" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65dea5-001e-001f-57e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "c176ce8e-1ae0-4e7a-acf2-ed777c107105" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse02905019ce5c336cf84" ] +} \ 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..fd64d1481a68 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse097058d2cc07bb6d2b4?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" : "887a66a9-85d2-47ba-bf47-a2c30b294804" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB10B980A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65decd-001e-001f-7ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:06 GMT", + "x-ms-client-request-id" : "887a66a9-85d2-47ba-bf47-a2c30b294804" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "81d94a12-acc1-4388-ae64-d6af8989a46f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65deec-001e-001f-14e6-64eb66000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse097058d2cc07bb6d2b4Fri, 06 Sep 2019 19:09:07 GMT\"0x8D732FDB10B980A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "81d94a12-acc1-4388-ae64-d6af8989a46f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse097058d2cc07bb6d2b4?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" : "40aababc-b451-4d72-9214-8b3a68bd6b49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65defb-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "40aababc-b451-4d72-9214-8b3a68bd6b49" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse097058d2cc07bb6d2b4" ] +} \ 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..3970aa0f3428 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia0841019bfd4bae74ef?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" : "1d156512-27a0-4ec4-a35a-666075c6d957" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB12E439C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65df6e-001e-001f-75e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "1d156512-27a0-4ec4-a35a-666075c6d957" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d1585bb5-339c-419d-96e2-3e62976082ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65df87-001e-001f-07e6-64eb66000000", + "Body" : "jtccontainersaspermissionsparseiajtccontainersaspermissionsparseia0841019bfd4bae74efFri, 06 Sep 2019 19:09:07 GMT\"0x8D732FDB12E439C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "d1585bb5-339c-419d-96e2-3e62976082ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia0841019bfd4bae74ef?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" : "0b0ce61c-6b11-4cfa-8a6f-3dd66787380e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65df9b-001e-001f-16e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "0b0ce61c-6b11-4cfa-8a6f-3dd66787380e" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparseia0841019bfd4bae74ef" ] +} \ 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..02863db3d464 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring001274bfd75b67bf8?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" : "2c55c0db-f5a9-4bd0-bf06-0ba9abfb4b5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAFCCD7FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d981-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "2c55c0db-f5a9-4bd0-bf06-0ba9abfb4b5e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0b806389-e081-4ffa-a027-58dbf130281e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d9a0-001e-001f-5be6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring001274bfd75b67bf8Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDAFCCD7FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "0b806389-e081-4ffa-a027-58dbf130281e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring001274bfd75b67bf8?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" : "038ee13e-92d9-46aa-a0cd-3e2006004be6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d9b1-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:04 GMT", + "x-ms-client-request-id" : "038ee13e-92d9-46aa-a0cd-3e2006004be6" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring001274bfd75b67bf8" ] +} \ 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..7e1b8699f866 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring022070b040fbda477?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" : "23e09c74-5602-4585-890b-6a3109208ea5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAFE547E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d9c8-001e-001f-01e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "23e09c74-5602-4585-890b-6a3109208ea5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "76e9b9fe-9e11-4f48-a74e-6a673b831e19" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d9f5-001e-001f-25e6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring022070b040fbda477Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDAFE547E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "76e9b9fe-9e11-4f48-a74e-6a673b831e19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring022070b040fbda477?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" : "afb927b7-6dda-4ed1-8014-2af71de9a19f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65da0b-001e-001f-39e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "afb927b7-6dda-4ed1-8014-2af71de9a19f" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring022070b040fbda477" ] +} \ 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..ed0e8d1aaab8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0859033aef760c165?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" : "cc6626d8-8e0a-4114-b810-a188ff73518a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAFFBE28F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65da2b-001e-001f-58e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "cc6626d8-8e0a-4114-b810-a188ff73518a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6075eb6d-77d8-44a6-a367-8aadb75dfde3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65da4e-001e-001f-78e6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0859033aef760c165Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDAFFBE28F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "6075eb6d-77d8-44a6-a367-8aadb75dfde3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0859033aef760c165?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" : "d71c44ba-7e63-41ac-bd24-acfe0986b727" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65da62-001e-001f-0be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "d71c44ba-7e63-41ac-bd24-acfe0986b727" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0859033aef760c165" ] +} \ 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..bed32021c840 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0529827fad78db9c0?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" : "c2457a79-f4df-48b1-b1de-5e15aef239fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB00EF9F0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65da7c-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "c2457a79-f4df-48b1-b1de-5e15aef239fe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1ad113cc-6e69-48e7-bfbb-c72879c20b1c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65da92-001e-001f-32e6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0529827fad78db9c0Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDB00EF9F0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "1ad113cc-6e69-48e7-bfbb-c72879c20b1c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0529827fad78db9c0?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" : "905c8cfa-082a-40ec-a7bb-e082205f4e29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65daa4-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "905c8cfa-082a-40ec-a7bb-e082205f4e29" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0529827fad78db9c0" ] +} \ 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..46d97db61278 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring048717a4c97da4e71?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" : "a71279ce-5b4f-45cd-b570-2d780ce7b800" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0223875\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65dac7-001e-001f-5fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "a71279ce-5b4f-45cd-b570-2d780ce7b800" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1334f4cb-9183-4f87-b755-e5e3f5da6cf7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65dad8-001e-001f-6be6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring048717a4c97da4e71Fri, 06 Sep 2019 19:09:05 GMT\"0x8D732FDB0223875\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "1334f4cb-9183-4f87-b755-e5e3f5da6cf7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring048717a4c97da4e71?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" : "56d3946b-64cb-4806-a5b9-85725189f8ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65dae5-001e-001f-78e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "56d3946b-64cb-4806-a5b9-85725189f8ee" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring048717a4c97da4e71" ] +} \ 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..e07a28a5ddc7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring01962577f1f1106e7?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" : "8af85b9e-211d-46bb-ab2b-0523cc19a568" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0332C72\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65daff-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "8af85b9e-211d-46bb-ab2b-0523cc19a568" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "869e8bbb-82b3-4ce6-ae8d-eb7bb85abcff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65db35-001e-001f-3ae6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring01962577f1f1106e7Fri, 06 Sep 2019 19:09:06 GMT\"0x8D732FDB0332C72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "869e8bbb-82b3-4ce6-ae8d-eb7bb85abcff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring01962577f1f1106e7?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" : "9c66833d-d1b3-4e45-b063-b4cc57b33c4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65db41-001e-001f-46e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "9c66833d-d1b3-4e45-b063-b4cc57b33c4e" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring01962577f1f1106e7" ] +} \ 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..e4de4198a977 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0134757644a12a16f?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" : "d8079d7a-d18a-45b2-8dae-7d55e7f097b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB0435CFB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65db63-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "d8079d7a-d18a-45b2-8dae-7d55e7f097b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ea443d44-139b-458a-a048-14714fa3dcf6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65db85-001e-001f-80e6-64eb66000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0134757644a12a16fFri, 06 Sep 2019 19:09:06 GMT\"0x8D732FDB0435CFB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "ea443d44-139b-458a-a048-14714fa3dcf6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0134757644a12a16f?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" : "4f50cc50-5c1c-4b78-a6a0-ba0c2fe8949c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65db96-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:05 GMT", + "x-ms-client-request-id" : "4f50cc50-5c1c-4b78-a6a0-ba0c2fe8949c" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0134757644a12a16f" ] +} \ 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..58ef31432445 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparsec9a2339375777cba?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" : "37db51e7-55d5-4eab-8281-2c512f51e098" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB1977EF7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e172-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "37db51e7-55d5-4eab-8281-2c512f51e098" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5c0e52dc-8012-4d14-a112-0739832c2f22" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e1a0-001e-001f-25e6-64eb66000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparsec9a2339375777cbaFri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB1977EF7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "5c0e52dc-8012-4d14-a112-0739832c2f22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparsec9a2339375777cba?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" : "639fe94b-34e2-4c83-9686-4bf35b9d157b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e1b7-001e-001f-38e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "639fe94b-34e2-4c83-9686-4bf35b9d157b" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparsec9a2339375777cba" ] +} \ 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..c85deb5a3f95 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparseabd355299ff14ff0?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" : "7b300eb4-71a8-49e3-bd02-cd39b3b780c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB1AB0BA6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e1d5-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "7b300eb4-71a8-49e3-bd02-cd39b3b780c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9f0a144f-7b28-4b73-8920-047ed2e52eb1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e1f3-001e-001f-69e6-64eb66000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparseabd355299ff14ff0Fri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB1AB0BA6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "9f0a144f-7b28-4b73-8920-047ed2e52eb1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparseabd355299ff14ff0?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" : "ea3e3515-9539-46e8-be65-7936082371db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e207-001e-001f-7ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "ea3e3515-9539-46e8-be65-7936082371db" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparseabd355299ff14ff0" ] +} \ 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..e8a4010fb585 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse880551126f0f7370?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" : "7a8fe60a-3df2-4852-b6a8-06e3504d58dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB1BC4DDA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e226-001e-001f-16e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "7a8fe60a-3df2-4852-b6a8-06e3504d58dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3342f2a9-6bbc-4772-974c-0b8e72746efb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e239-001e-001f-27e6-64eb66000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparse880551126f0f7370Fri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB1BC4DDA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "3342f2a9-6bbc-4772-974c-0b8e72746efb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse880551126f0f7370?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" : "93b5a169-89d2-48be-b8aa-10768036b570" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e24a-001e-001f-36e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "93b5a169-89d2-48be-b8aa-10768036b570" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparse880551126f0f7370" ] +} \ 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..146623878315 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringd5e074799ecf8?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" : "640adf19-2dd5-4a84-a0e4-6c957c11091b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB15C6385\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e029-001e-001f-0ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "640adf19-2dd5-4a84-a0e4-6c957c11091b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cd0bb872-64c9-4a4a-b978-a5529c297ae2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e04f-001e-001f-27e6-64eb66000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostringd5e074799ecf8Fri, 06 Sep 2019 19:09:07 GMT\"0x8D732FDB15C6385\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "cd0bb872-64c9-4a4a-b978-a5529c297ae2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringd5e074799ecf8?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" : "b2e53dc6-f9a1-42a0-ae07-bc64706c6bea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e074-001e-001f-44e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "b2e53dc6-f9a1-42a0-ae07-bc64706c6bea" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostringd5e074799ecf8" ] +} \ 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..2c78ba1b18d7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringa05177854861e?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" : "198d61de-53d2-49ef-b572-eb56b38018d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB1723ABD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e0ad-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "198d61de-53d2-49ef-b572-eb56b38018d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9ee81dca-9f2b-4055-ab98-ff4ee5b3a423" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e0d5-001e-001f-0fe6-64eb66000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostringa05177854861eFri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB1723ABD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "9ee81dca-9f2b-4055-ab98-ff4ee5b3a423", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringa05177854861e?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" : "f0848dff-2e0d-490d-85e5-2f31f2cb7ab7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e0ea-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "f0848dff-2e0d-490d-85e5-2f31f2cb7ab7" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostringa05177854861e" ] +} \ 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..a7aa24789321 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringd0a31585f4b1b?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" : "be631fdd-acd8-483b-a9d2-9e4c64f7be85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB18503EF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e110-001e-001f-3ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "be631fdd-acd8-483b-a9d2-9e4c64f7be85" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cfa16668-576e-4bbf-b611-f3b738db5285" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e12e-001e-001f-52e6-64eb66000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostringd0a31585f4b1bFri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB18503EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "cfa16668-576e-4bbf-b611-f3b738db5285", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringd0a31585f4b1b?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" : "6cb4636a-a3bc-42a3-a751-f22ded594761" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e14a-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:07 GMT", + "x-ms-client-request-id" : "6cb4636a-a3bc-42a3-a751-f22ded594761" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostringd0a31585f4b1b" ] +} \ 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..fe666f4128c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrequestproperty0helpertestrequestpropertybc8142340a5dd?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" : "b9b08c51-ec58-43dc-868f-abcbbda78efe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAAF71B37\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c65c-001e-001f-08e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "b9b08c51-ec58-43dc-868f-abcbbda78efe" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrequestproperty0helpertestrequestpropertybc8142340a5dd?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" : "9ddaa0a3-4bfd-453d-b6b0-340a3de67973" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c67e-001e-001f-26e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "9ddaa0a3-4bfd-453d-b6b0-340a3de67973" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "35adf768-e91e-463d-aff1-b52d70c7c05e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c6c4-001e-001f-64e6-64eb66000000", + "Body" : "jtcrequestproperty", + "Date" : "Fri, 06 Sep 2019 19:08:56 GMT", + "x-ms-client-request-id" : "35adf768-e91e-463d-aff1-b52d70c7c05e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcrequestproperty0helpertestrequestpropertybc8142340a5dd" ] +} \ 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..bca13e7769ef --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparse2e991641a1f3?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" : "a14ff5df-dbe8-412a-874e-ab6a19cd89a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB1D5A853\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e264-001e-001f-4be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "a14ff5df-dbe8-412a-874e-ab6a19cd89a9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7d2cace0-50c9-4cea-a021-981b710c1234" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e296-001e-001f-75e6-64eb66000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0helpertestsasprotocolparse2e991641a1f3Fri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB1D5A853\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "7d2cace0-50c9-4cea-a021-981b710c1234", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparse2e991641a1f3?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" : "c40b5b4e-e2e7-4aff-a4d9-701169b6c3aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e2a3-001e-001f-7fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "c40b5b4e-e2e7-4aff-a4d9-701169b6c3aa" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0helpertestsasprotocolparse2e991641a1f3" ] +} \ 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..b9be5c75fa08 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparsee9e75236c82f?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" : "0f287580-496a-4ae8-94f7-4945c5b7efb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB1E64E26\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65e2b9-001e-001f-12e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "0f287580-496a-4ae8-94f7-4945c5b7efb9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b69b7390-d914-4f38-b66d-fa87ef1fa238" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65e2d2-001e-001f-26e6-64eb66000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0helpertestsasprotocolparsee9e75236c82fFri, 06 Sep 2019 19:09:08 GMT\"0x8D732FDB1E64E26\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "b69b7390-d914-4f38-b66d-fa87ef1fa238", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparsee9e75236c82f?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" : "0260a7ec-7694-4802-81c4-3459211b6a8e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65e2e7-001e-001f-36e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:08 GMT", + "x-ms-client-request-id" : "0260a7ec-7694-4802-81c4-3459211b6a8e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0helpertestsasprotocolparsee9e75236c82f" ] +} \ 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..0c1bb65b6da3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign036720e450be148d0?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" : "959852e7-d11d-42c1-9663-d2e915e5074c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDABBD0C24\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c9ab-001e-001f-6ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "959852e7-d11d-42c1-9663-d2e915e5074c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ffd19707-cc4b-48d7-935b-a767eff31c80" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65c9c6-001e-001f-01e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign036720e450be148d0Fri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDABBD0C24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "ffd19707-cc4b-48d7-935b-a767eff31c80", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign036720e450be148d0?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" : "66bd90d4-ac9c-4f0d-a803-cfcdfc8fb5ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65c9d7-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "66bd90d4-ac9c-4f0d-a803-cfcdfc8fb5ec" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign036720e450be148d0" ] +} \ 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..fda3b74953dc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign010265ae78520dc4f?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" : "bec595e0-88bf-44d0-bf31-66302a0389f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC9689BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ccd1-001e-001f-35e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "bec595e0-88bf-44d0-bf31-66302a0389f4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5abc3091-851f-4476-8059-cfe4b561d790" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cce5-001e-001f-48e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign010265ae78520dc4fFri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC9689BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "5abc3091-851f-4476-8059-cfe4b561d790", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign010265ae78520dc4f?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" : "371291d9-066d-4bb2-91a6-b270d89558b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ccf8-001e-001f-58e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "371291d9-066d-4bb2-91a6-b270d89558b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign010265ae78520dc4f" ] +} \ 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..e87133e55226 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign005691c2b09096349?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" : "6ffba9c7-9009-4bc0-b543-d97788c5f692" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDACAF6EE9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cd31-001e-001f-07e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "6ffba9c7-9009-4bc0-b543-d97788c5f692" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aeaadb20-553a-4251-b1ad-259a9b7347e2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cd61-001e-001f-31e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign005691c2b09096349Fri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDACAF6EE9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "aeaadb20-553a-4251-b1ad-259a9b7347e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign005691c2b09096349?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" : "b77ddd69-9110-4eb3-95b2-31bb05f818d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cd7e-001e-001f-49e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "b77ddd69-9110-4eb3-95b2-31bb05f818d3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign005691c2b09096349" ] +} \ 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..0609f62805fb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign087408e3269c907df?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" : "110e71f9-6773-49fe-9708-becb4047c1b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDABD5F155\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65c9f2-001e-001f-29e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "110e71f9-6773-49fe-9708-becb4047c1b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cdcad645-0a6c-4168-947f-e60e87cc9ff2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ca17-001e-001f-45e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign087408e3269c907dfFri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDABD5F155\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "cdcad645-0a6c-4168-947f-e60e87cc9ff2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign087408e3269c907df?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" : "2d62de3f-b938-4b42-ad12-7a23541a0e0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ca2f-001e-001f-5ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "2d62de3f-b938-4b42-ad12-7a23541a0e0c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign087408e3269c907df" ] +} \ 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..9b253751aa24 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign040904e99a8392dff?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" : "9ecbc75e-4a5d-4dd4-a7f3-dc0798ba5d6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDABE9CC43\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ca59-001e-001f-80e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "9ecbc75e-4a5d-4dd4-a7f3-dc0798ba5d6c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fa961b7e-803e-4158-8a0b-6505e9140499" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ca6d-001e-001f-0fe6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign040904e99a8392dffFri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDABE9CC43\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "fa961b7e-803e-4158-8a0b-6505e9140499", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign040904e99a8392dff?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" : "ccf3ab36-81c1-4d56-a5d1-9165f0bf7328" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ca7b-001e-001f-1de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "ccf3ab36-81c1-4d56-a5d1-9165f0bf7328" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign040904e99a8392dff" ] +} \ 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..6c33dbd30ecc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign03178502942d261d5?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" : "743f8f2d-2dc8-42b0-96dc-3b9c81a5a84d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDABFA23EF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ca90-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "743f8f2d-2dc8-42b0-96dc-3b9c81a5a84d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e600a54c-116c-44aa-b9fd-196dc2c4425e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65caa5-001e-001f-44e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign03178502942d261d5Fri, 06 Sep 2019 19:08:58 GMT\"0x8D732FDABFA23EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "e600a54c-116c-44aa-b9fd-196dc2c4425e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign03178502942d261d5?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" : "4f6fd27a-dc6d-42ce-b002-37d4e3dcd306" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cab6-001e-001f-55e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "4f6fd27a-dc6d-42ce-b002-37d4e3dcd306" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign03178502942d261d5" ] +} \ 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..803264cad195 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign020211f6168112013?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" : "5ef28036-bf08-4187-a02a-b7a131853fce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC0B3F18\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cada-001e-001f-75e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "5ef28036-bf08-4187-a02a-b7a131853fce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0efc4444-0bd2-4531-95ff-05ee7c7f267d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65caf2-001e-001f-09e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign020211f6168112013Fri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC0B3F18\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "0efc4444-0bd2-4531-95ff-05ee7c7f267d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign020211f6168112013?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" : "3440f65f-9b28-4f7e-aaa4-f3c2b90c0827" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cb02-001e-001f-17e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "3440f65f-9b28-4f7e-aaa4-f3c2b90c0827" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign020211f6168112013" ] +} \ 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..eae86f8df55c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign062510cda8e383f23?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" : "668a5335-3105-4960-ac0d-6b4c5e01d86f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC1FDD7B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cb1f-001e-001f-31e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "668a5335-3105-4960-ac0d-6b4c5e01d86f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d1d8399-1511-47b9-b12d-8ade12561636" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cb4c-001e-001f-58e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign062510cda8e383f23Fri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC1FDD7B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "9d1d8399-1511-47b9-b12d-8ade12561636", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign062510cda8e383f23?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" : "f4795286-ae16-4c80-9e92-1b95a6b0a440" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cb5d-001e-001f-66e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "f4795286-ae16-4c80-9e92-1b95a6b0a440" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign062510cda8e383f23" ] +} \ 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..e3f8263acd65 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign03759209d67e62ed3?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" : "fbdee13c-e980-4c7b-8d63-a0d2c3a9a430" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC320A54\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cb7b-001e-001f-01e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "fbdee13c-e980-4c7b-8d63-a0d2c3a9a430" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d39d88f6-7fcb-4948-b0d4-469d33491cdf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cb9c-001e-001f-1de6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign03759209d67e62ed3Fri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC320A54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "d39d88f6-7fcb-4948-b0d4-469d33491cdf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign03759209d67e62ed3?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" : "f0654703-b422-46e3-800e-967f181c94c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cbae-001e-001f-2ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:58 GMT", + "x-ms-client-request-id" : "f0654703-b422-46e3-800e-967f181c94c6" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign03759209d67e62ed3" ] +} \ 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..07db035baf7f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign014711e15af9031fa?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" : "e0de9eda-b7fa-4220-ac63-b438b022f68c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC4C2859\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cbc1-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "e0de9eda-b7fa-4220-ac63-b438b022f68c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2f5daaae-37cc-4849-a846-f3b3ffbbccd6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cbe6-001e-001f-60e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign014711e15af9031faFri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC4C2859\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "2f5daaae-37cc-4849-a846-f3b3ffbbccd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign014711e15af9031fa?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" : "2c64956a-8abe-40e4-9a32-c9ec0bb3e90f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cbf2-001e-001f-69e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "2c64956a-8abe-40e4-9a32-c9ec0bb3e90f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign014711e15af9031fa" ] +} \ 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..d64a4c4dda56 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0698738cb153c7b5b?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" : "6e1172a0-59e7-4db4-8135-4ff4f9274daa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC6534B3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cc0d-001e-001f-04e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "6e1172a0-59e7-4db4-8135-4ff4f9274daa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a30c627b-826b-4643-88b9-5c02ba5df49f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cc2d-001e-001f-21e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0698738cb153c7b5bFri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC6534B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "a30c627b-826b-4643-88b9-5c02ba5df49f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0698738cb153c7b5b?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" : "97160ee0-a6e5-4d41-a974-c166036cd456" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cc37-001e-001f-2be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "97160ee0-a6e5-4d41-a974-c166036cd456" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0698738cb153c7b5b" ] +} \ 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..48a2a08779a2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign096387cd717d82a7e?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" : "884f4ac1-291b-4866-a67a-7350437f8f02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAC819D24\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cc53-001e-001f-43e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "884f4ac1-291b-4866-a67a-7350437f8f02" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7c25b7da-f015-4472-bee5-dd2dce2c8bd5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cc97-001e-001f-04e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign096387cd717d82a7eFri, 06 Sep 2019 19:08:59 GMT\"0x8D732FDAC819D24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "7c25b7da-f015-4472-bee5-dd2dce2c8bd5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign096387cd717d82a7e?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" : "36addef9-54d7-46b5-845e-6e1be6722a0b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cca9-001e-001f-12e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "36addef9-54d7-46b5-845e-6e1be6722a0b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign096387cd717d82a7e" ] +} \ 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..6d3908f74591 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey091586ca?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" : "54222ea0-a577-43ee-ac15-61c20b471c21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDACC657CB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cd95-001e-001f-5fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "54222ea0-a577-43ee-ac15-61c20b471c21" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "db2f1518-ab8d-4a66-8ec1-11bb251f74d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cdcb-001e-001f-0be6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey091586caFri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDACC657CB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "db2f1518-ab8d-4a66-8ec1-11bb251f74d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey091586ca?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" : "41740d45-c523-47b8-9f73-f4e1d936b160" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cde0-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "41740d45-c523-47b8-9f73-f4e1d936b160" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey091586ca" ] +} \ 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..5f191f4d0cb2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0450244b?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" : "da1dfc35-b979-4813-9bc2-a85897eb0b68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD8C214D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d0d7-001e-001f-28e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "da1dfc35-b979-4813-9bc2-a85897eb0b68" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "891cd708-ef81-460b-bc75-310e0d11862b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d0e6-001e-001f-35e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0450244bFri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDAD8C214D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "891cd708-ef81-460b-bc75-310e0d11862b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0450244b?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" : "77b2a0e2-c0d5-496c-9db3-095fff65e156" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d0f0-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "77b2a0e2-c0d5-496c-9db3-095fff65e156" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0450244b" ] +} \ 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..f5609ecfab1d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04318531?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" : "3ba8609b-4074-46a3-b035-85649957ea74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD9CC71B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d0fd-001e-001f-4ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "3ba8609b-4074-46a3-b035-85649957ea74" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d90f7051-62bb-4b77-8463-491aacbb8942" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d10a-001e-001f-55e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey04318531Fri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDAD9CC71B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "d90f7051-62bb-4b77-8463-491aacbb8942", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04318531?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" : "17340062-1fc2-4a08-a4f1-08237e868337" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d111-001e-001f-5ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "17340062-1fc2-4a08-a4f1-08237e868337" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey04318531" ] +} \ 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..74c21d2cf446 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey094986d1?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" : "80637a7b-2de9-4f52-866d-03f8d6140e2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDADB0059C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d128-001e-001f-6fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "80637a7b-2de9-4f52-866d-03f8d6140e2c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e143f6ac-ad1a-47a5-ac1a-8afe3321ce74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d146-001e-001f-05e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey094986d1Fri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDADB0059C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "e143f6ac-ad1a-47a5-ac1a-8afe3321ce74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey094986d1?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" : "5fa2d987-fa6a-467a-888b-e95778775753" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d154-001e-001f-11e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "5fa2d987-fa6a-467a-888b-e95778775753" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey094986d1" ] +} \ 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..9491025d0dce --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0083067d?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" : "7ca626e9-e7fa-463f-99fc-db6ec202f2a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDADC20B56\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d16b-001e-001f-24e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "7ca626e9-e7fa-463f-99fc-db6ec202f2a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0a07de01-8bfa-4bc5-9030-cd014f64792f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d17f-001e-001f-34e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0083067dFri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDADC20B56\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "0a07de01-8bfa-4bc5-9030-cd014f64792f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0083067d?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" : "c3becfc4-339e-4c3c-89a8-3b71f160ae08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d18c-001e-001f-40e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "c3becfc4-339e-4c3c-89a8-3b71f160ae08" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0083067d" ] +} \ 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..65740a9bf02c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0835811b?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" : "a243d53e-5dd5-48c8-8dc1-599296937d18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDADD2FF4E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d1a2-001e-001f-56e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "a243d53e-5dd5-48c8-8dc1-599296937d18" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8b044476-e026-4f44-9999-a6d2abdf0700" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d1c7-001e-001f-76e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0835811bFri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDADD2FF4E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "8b044476-e026-4f44-9999-a6d2abdf0700", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0835811b?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" : "837a5b68-0aeb-4f75-bfd9-424deb3bcb78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d1e0-001e-001f-08e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "837a5b68-0aeb-4f75-bfd9-424deb3bcb78" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0835811b" ] +} \ 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..33a081a5e5d8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0295504e?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" : "8a5278cd-b8f2-4a9b-9a50-809d088ca727" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDADE81304\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d20c-001e-001f-31e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "8a5278cd-b8f2-4a9b-9a50-809d088ca727" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0c47b680-d787-404a-8022-f9c3f7df10ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d220-001e-001f-44e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0295504eFri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDADE81304\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "0c47b680-d787-404a-8022-f9c3f7df10ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0295504e?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" : "c4d8c0d4-bcb1-49e5-8d95-65da9edb1f36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d234-001e-001f-57e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "c4d8c0d4-bcb1-49e5-8d95-65da9edb1f36" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0295504e" ] +} \ 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..af116018907b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey035681b6?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" : "c633162c-9d25-4e97-ad49-cfa764c70e14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDADF86AA0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d248-001e-001f-6be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "c633162c-9d25-4e97-ad49-cfa764c70e14" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "603ce002-de9c-4020-a734-f4b17fe4a1aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d26a-001e-001f-07e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey035681b6Fri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDADF86AA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "603ce002-de9c-4020-a734-f4b17fe4a1aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey035681b6?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" : "2cfb6dc8-d4f8-4c21-9aab-1ffef63fb13a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d279-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "2cfb6dc8-d4f8-4c21-9aab-1ffef63fb13a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey035681b6" ] +} \ 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..eecf86d336bc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey003295f1?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" : "a7dcd105-1de9-400c-b77c-7e5c4a8a82fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDACDBB9B4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cdf7-001e-001f-31e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "a7dcd105-1de9-400c-b77c-7e5c4a8a82fc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4a47245b-de25-4ad3-962d-10425a53ce61" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ce21-001e-001f-54e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey003295f1Fri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDACDBB9B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:08:59 GMT", + "x-ms-client-request-id" : "4a47245b-de25-4ad3-962d-10425a53ce61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey003295f1?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" : "85aa7196-19e1-48be-8b0c-b5fff7d34c36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ce37-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "85aa7196-19e1-48be-8b0c-b5fff7d34c36" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey003295f1" ] +} \ 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..57a7d29c49d9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0987420d?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" : "717c2d6c-1750-4fa2-aecb-0fe8c723e0f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDACED7132\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ce58-001e-001f-05e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "717c2d6c-1750-4fa2-aecb-0fe8c723e0f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4b728efa-8600-450c-9127-d51b59194502" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65ce7a-001e-001f-21e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0987420dFri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDACED7132\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "4b728efa-8600-450c-9127-d51b59194502", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0987420d?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" : "a80ab481-0ad3-4133-af5f-67a06f66ec8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65ce91-001e-001f-35e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "a80ab481-0ad3-4133-af5f-67a06f66ec8a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0987420d" ] +} \ 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..d3fa4252a8ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0416221f?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" : "290ec94d-e5a9-4d4c-86d4-4d69f7493d05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD04F67A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65ceb1-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "290ec94d-e5a9-4d4c-86d4-4d69f7493d05" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d1d7705e-07a4-4901-ae68-1541c6d786ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cecf-001e-001f-6be6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0416221fFri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDAD04F67A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "d1d7705e-07a4-4901-ae68-1541c6d786ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0416221f?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" : "8f7302f3-c0fa-473f-8bd2-61b00049dcad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cee3-001e-001f-7ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "8f7302f3-c0fa-473f-8bd2-61b00049dcad" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0416221f" ] +} \ 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..412bc1757ea7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey061880ad?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" : "04a02969-4ea9-408a-a1a8-1a4d9349959e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD154E16\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cef6-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "04a02969-4ea9-408a-a1a8-1a4d9349959e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5062bf46-ce1c-4238-8589-876e14d6b3c6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cf10-001e-001f-26e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey061880adFri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDAD154E16\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "5062bf46-ce1c-4238-8589-876e14d6b3c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey061880ad?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" : "ab94cf55-6136-42d5-b7bb-9581fafbf390" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cf24-001e-001f-36e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "ab94cf55-6136-42d5-b7bb-9581fafbf390" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey061880ad" ] +} \ 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..129452541e08 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02897750?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" : "bda39459-3f1c-4cb0-bfd0-321221137ed6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD2FE159\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cf3d-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "bda39459-3f1c-4cb0-bfd0-321221137ed6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7f8c7f73-3e01-4bfd-8e31-b245a0dec806" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cf73-001e-001f-7ce6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey02897750Fri, 06 Sep 2019 19:09:00 GMT\"0x8D732FDAD2FE159\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "7f8c7f73-3e01-4bfd-8e31-b245a0dec806", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02897750?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" : "e0e3a297-631a-479d-860e-d7fc2874eb03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cf94-001e-001f-19e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "e0e3a297-631a-479d-860e-d7fc2874eb03" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey02897750" ] +} \ 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..77176dd39611 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08749963?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" : "77bf3883-4c33-4e5d-be08-5d114f5d3d0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD4606BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65cfc1-001e-001f-3ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "77bf3883-4c33-4e5d-be08-5d114f5d3d0d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9012ddcd-d0af-4382-af82-9b2c62cb941c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65cfdd-001e-001f-55e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey08749963Fri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDAD4606BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "9012ddcd-d0af-4382-af82-9b2c62cb941c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08749963?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" : "476ab297-a14b-44c1-b5db-7c7947487d3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65cfee-001e-001f-65e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "476ab297-a14b-44c1-b5db-7c7947487d3a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey08749963" ] +} \ 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..2e2d716b86dd --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0523502a?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" : "0c421bb9-db58-4225-b7c8-834e9f2fa6ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD56D3A9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d011-001e-001f-02e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "0c421bb9-db58-4225-b7c8-834e9f2fa6ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d52d8220-4207-4a22-a8c6-5c8387cd7c89" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d021-001e-001f-10e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0523502aFri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDAD56D3A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "d52d8220-4207-4a22-a8c6-5c8387cd7c89", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0523502a?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" : "015710bf-2c11-4078-a1ef-12972b1dc120" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d037-001e-001f-24e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "015710bf-2c11-4078-a1ef-12972b1dc120" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0523502a" ] +} \ 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..69661fb64dee --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey012886c2?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" : "5c179b78-c1bb-41b9-ade3-45f4a2118e93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD692792\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d052-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "5c179b78-c1bb-41b9-ade3-45f4a2118e93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6211b7cc-8522-474c-86cb-b95be96265c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d075-001e-001f-56e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey012886c2Fri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDAD692792\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "6211b7cc-8522-474c-86cb-b95be96265c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey012886c2?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" : "9bc04cec-7dc2-477f-b205-ed21fed968af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d07d-001e-001f-5de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:00 GMT", + "x-ms-client-request-id" : "9bc04cec-7dc2-477f-b205-ed21fed968af" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey012886c2" ] +} \ 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..77ce02d2f56b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0992875c?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" : "05b29355-3657-4ca2-acf8-511507b71469" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAD7B7B75\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d098-001e-001f-71e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "05b29355-3657-4ca2-acf8-511507b71469" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dd79a873-3db5-4938-b823-1dacb107994b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d0b3-001e-001f-08e6-64eb66000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0992875cFri, 06 Sep 2019 19:09:01 GMT\"0x8D732FDAD7B7B75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "dd79a873-3db5-4938-b823-1dacb107994b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0992875c?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" : "f69f7d17-f3ff-45ee-b486-a1145992a3e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d0c1-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "f69f7d17-f3ff-45ee-b486-a1145992a3e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0992875c" ] +} \ 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..9a802ceadfb9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource0203846cc1?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" : "7f9f9ae0-6b78-4960-9774-e39374e4bf1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE0825E4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d294-001e-001f-2be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "7f9f9ae0-6b78-4960-9774-e39374e4bf1a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "43fdccb3-dcef-46fe-8d0a-5aab4fb445b3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d2a8-001e-001f-3de6-64eb66000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource0203846cc1Fri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDAE0825E4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "43fdccb3-dcef-46fe-8d0a-5aab4fb445b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource0203846cc1?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" : "69310efa-e363-4127-88b3-b2765b82d92f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d2ba-001e-001f-4de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:01 GMT", + "x-ms-client-request-id" : "69310efa-e363-4127-88b3-b2765b82d92f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource0203846cc1" ] +} \ 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..fdf22a2b260c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource00019573cd?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" : "3957ae16-3c9f-460a-b108-5da5da2f649d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE1FF95A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d2cd-001e-001f-5ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "3957ae16-3c9f-460a-b108-5da5da2f649d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c2315811-2ac2-406f-8687-075b45756675" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d2ec-001e-001f-79e6-64eb66000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource00019573cdFri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDAE1FF95A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "c2315811-2ac2-406f-8687-075b45756675", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource00019573cd?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" : "805f68b8-6c88-43b8-ab22-6b0aa9859eb4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d2f6-001e-001f-01e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "805f68b8-6c88-43b8-ab22-6b0aa9859eb4" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource00019573cd" ] +} \ 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..fcd54ea4a237 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource027179deaf?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" : "fc72ef89-42a2-4575-a670-37d9c3d1549f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE369405\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d30a-001e-001f-12e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "fc72ef89-42a2-4575-a670-37d9c3d1549f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "161ee883-29cc-4e59-9abe-79f0641948e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d337-001e-001f-37e6-64eb66000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource027179deafFri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDAE369405\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "161ee883-29cc-4e59-9abe-79f0641948e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource027179deaf?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" : "5f503db8-d2df-4715-a7af-eaa44c6d7cf2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d354-001e-001f-50e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "5f503db8-d2df-4715-a7af-eaa44c6d7cf2" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource027179deaf" ] +} \ 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..87346d5af623 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia06760187ef266532b24?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" : "44107591-251c-4356-98f1-f9aaebcb9757" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE490F0E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d36d-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "44107591-251c-4356-98f1-f9aaebcb9757" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "061d5bbc-648f-4e0d-9546-10a477bcba4a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d38b-001e-001f-02e6-64eb66000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia06760187ef266532b24Fri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDAE490F0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "061d5bbc-648f-4e0d-9546-10a477bcba4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia06760187ef266532b24?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" : "d28b0bee-b0ce-46a1-a5ca-f8da584f60c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d39d-001e-001f-14e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "d28b0bee-b0ce-46a1-a5ca-f8da584f60c5" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia06760187ef266532b24" ] +} \ 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..ddebc187dddc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia0139830fe3e21992334?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" : "d8a757e6-dde3-4750-88e0-99c6e9eab694" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE5CC2D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d3ac-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "d8a757e6-dde3-4750-88e0-99c6e9eab694" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18dff870-f6da-4db4-9cba-36cc181ca4d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d3c1-001e-001f-35e6-64eb66000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia0139830fe3e21992334Fri, 06 Sep 2019 19:09:02 GMT\"0x8D732FDAE5CC2D3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "18dff870-f6da-4db4-9cba-36cc181ca4d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia0139830fe3e21992334?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" : "5ccdf254-74fe-4157-9413-956b82db6381" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d3ce-001e-001f-42e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "5ccdf254-74fe-4157-9413-956b82db6381" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia0139830fe3e21992334" ] +} \ 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..6b8504a80c96 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia048820ea314c2ed8534?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" : "9bbdbeac-1095-488f-b740-f934005e3050" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDAE6D418F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65d3ea-001e-001f-5ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "9bbdbeac-1095-488f-b740-f934005e3050" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f6628e97-354c-416f-8512-6c692b858059" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65d40c-001e-001f-77e6-64eb66000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia048820ea314c2ed8534Fri, 06 Sep 2019 19:09:03 GMT\"0x8D732FDAE6D418F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "f6628e97-354c-416f-8512-6c692b858059", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia048820ea314c2ed8534?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" : "62c41c10-046e-4f0b-b0ba-68eacb07a6a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65d419-001e-001f-04e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:02 GMT", + "x-ms-client-request-id" : "62c41c10-046e-4f0b-b0ba-68eacb07a6a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia048820ea314c2ed8534" ] +} \ 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..83c0bd6aff47 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0helpertesturlparser4f0028926baff7ffa91?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" : "11d876cc-c993-456e-87f9-ba0c0beb73ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB57CFC01\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f0e1-001e-001f-2ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "11d876cc-c993-456e-87f9-ba0c0beb73ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eed2bb59-c080-4267-9c7f-fce2d84d2ed7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f110-001e-001f-55e6-64eb66000000", + "Body" : "jtcurlparserjtcurlparser0helpertesturlparser4f0028926baff7ffa91Fri, 06 Sep 2019 19:09:14 GMT\"0x8D732FDB57CFC01\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "eed2bb59-c080-4267-9c7f-fce2d84d2ed7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0helpertesturlparser4f0028926baff7ffa91?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" : "c7ae6a94-4fd5-4ace-a629-24e66c0f289c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f124-001e-001f-67e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "c7ae6a94-4fd5-4ace-a629-24e66c0f289c" + }, + "Exception" : null + } ], + "variables" : [ "jtcurlparser0helpertesturlparser4f0028926baff7ffa91" ] +} \ 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..ea6484575871 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpaged02659412614e2e3b?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" : "b2755e1a-52bd-4941-a5f0-d242ca8cd8a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC41231D5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76073c-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "b2755e1a-52bd-4941-a5f0-d242ca8cd8a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpaged02659412614e2e3b/javablobclearpage1pageblobapitestclearpaged0208146b63d35", + "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" : "b01cd925-32b8-4aa9-b7f3-2056e431245f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC419FC4E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760758-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "b01cd925-32b8-4aa9-b7f3-2056e431245f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpaged02659412614e2e3b/javablobclearpage1pageblobapitestclearpaged0208146b63d35?comp=page", + "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" : "9f0014a6-8069-496d-b974-f9828937285e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "hyPw9oYJsxk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "ETag" : "\"0x8D732FDC41F7BE1\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76076c-401e-003a-33e6-6473d5000000", + "x-ms-client-request-id" : "9f0014a6-8069-496d-b974-f9828937285e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpaged02659412614e2e3b/javablobclearpage1pageblobapitestclearpaged0208146b63d35?comp=page", + "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" : "d762d84f-dc1e-445f-a59c-4306dbcc6cd8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC427941F\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76077d-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "d762d84f-dc1e-445f-a59c-4306dbcc6cd8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpaged02659412614e2e3b/javablobclearpage1pageblobapitestclearpaged0208146b63d35?comp=pagelist", + "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" : "f57ec650-db40-4efb-8d62-af8bf57b2ce6" + }, + "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" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "ETag" : "\"0x8D732FDC427941F\"", + "x-ms-request-id" : "8f760793-401e-003a-52e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "f57ec650-db40-4efb-8d62-af8bf57b2ce6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "538ef632-3819-46d0-8c9b-546d9133504b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7607af-401e-003a-69e6-6473d5000000", + "Body" : "jtcclearpagejtcclearpage0pageblobapitestclearpaged02659412614e2e3bFri, 06 Sep 2019 19:09:39 GMT\"0x8D732FDC41231D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "538ef632-3819-46d0-8c9b-546d9133504b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpaged02659412614e2e3b?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" : "d364c952-1113-43c9-843e-c7d985bfd83c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7607bf-401e-003a-78e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "d364c952-1113-43c9-843e-c7d985bfd83c" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpage0pageblobapitestclearpaged02659412614e2e3b", "javablobclearpage1pageblobapitestclearpaged0208146b63d35", "c9a8d80e-c00b-4015-8510-c7c2d6f13a90" ] +} \ 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..1536645bbfa3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrora9f31762aaee?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" : "41f0a3d0-1234-4d15-8a42-133505c96576" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7796285\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76116e-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "41f0a3d0-1234-4d15-8a42-133505c96576" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrora9f31762aaee/javablobclearpageerror1pageblobapitestclearpageerrora9f425492", + "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" : "05fcf744-7f92-4b40-9424-b4a492be19a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC782399E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7611ab-401e-003a-45e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "05fcf744-7f92-4b40-9424-b4a492be19a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrora9f31762aaee/javablobclearpageerror2pageblobapitestclearpageerrora9f349022?comp=page", + "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" : "8c3d8ac4-0b4c-407c-a8fc-9925ae5755a7" + }, + "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" : "8f7611c0-401e-003a-59e6-6473d5000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:8f7611c0-401e-003a-59e6-6473d5000000\nTime:2019-09-06T19:09:45.1901193Z", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "8c3d8ac4-0b4c-407c-a8fc-9925ae5755a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f9e255f8-9f8d-4188-bcde-9cbcdfdfe5fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7611cf-401e-003a-66e6-6473d5000000", + "Body" : "jtcclearpageerrorjtcclearpageerror0pageblobapitestclearpageerrora9f31762aaeeFri, 06 Sep 2019 19:09:45 GMT\"0x8D732FDC7796285\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "f9e255f8-9f8d-4188-bcde-9cbcdfdfe5fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrora9f31762aaee?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" : "9f70a2ce-c388-4387-a7ca-6e286285066b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7611e0-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "9f70a2ce-c388-4387-a7ca-6e286285066b" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpageerror0pageblobapitestclearpageerrora9f31762aaee", "javablobclearpageerror1pageblobapitestclearpageerrora9f425492", "javablobclearpageerror2pageblobapitestclearpageerrora9f349022" ] +} \ 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..5d232cfcb038 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemincd277568b1a86c?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" : "569d93c2-7f6b-477a-ac0f-e46308d75bd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC45AE553\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7607f1-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "569d93c2-7f6b-477a-ac0f-e46308d75bd7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemincd277568b1a86c/javablobclearpagemin1pageblobapitestclearpagemincd208230cac", + "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" : "0380295f-6bd7-408e-8e17-084682ece6d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4659630\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76080d-401e-003a-37e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "0380295f-6bd7-408e-8e17-084682ece6d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemincd277568b1a86c/javablobclearpagemin1pageblobapitestclearpagemincd208230cac?comp=page", + "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" : "ab1cd854-1514-48bd-ac43-b23d7e8accbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC46B63FA\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760815-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "ab1cd854-1514-48bd-ac43-b23d7e8accbe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "00701a2f-003b-4f94-94d5-dbc74ba6165c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760820-401e-003a-49e6-6473d5000000", + "Body" : "jtcclearpageminjtcclearpagemin0pageblobapitestclearpagemincd277568b1a86cFri, 06 Sep 2019 19:09:39 GMT\"0x8D732FDC45AE553\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "00701a2f-003b-4f94-94d5-dbc74ba6165c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemincd277568b1a86c?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" : "55d755bf-9876-44e8-b1fe-bc7803e21ae8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760829-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "55d755bf-9876-44e8-b1fe-bc7803e21ae8" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagemin0pageblobapitestclearpagemincd277568b1a86c", "javablobclearpagemin1pageblobapitestclearpagemincd208230cac" ] +} \ 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..ff0106e1bf05 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1?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" : "76e69095-2401-48e1-97b8-58b53a33a985" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC47EA2A8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760844-401e-003a-66e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "76e69095-2401-48e1-97b8-58b53a33a985" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1/javablobclearpagesac1pageblobapitestclearpagesac9a953629168", + "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" : "13df9b60-8d5b-4d61-8fc0-524330ea606e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC484BE5B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760857-401e-003a-77e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "13df9b60-8d5b-4d61-8fc0-524330ea606e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1/javablobclearpagesac1pageblobapitestclearpagesac9a953629168?comp=page", + "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" : "020389ba-19bc-4814-a4d5-1229018c80db", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "HJH7lGQCjqQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "ETag" : "\"0x8D732FDC48B2881\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760864-401e-003a-02e6-6473d5000000", + "x-ms-client-request-id" : "020389ba-19bc-4814-a4d5-1229018c80db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1/javablobclearpagesac1pageblobapitestclearpagesac9a953629168?comp=page", + "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" : "78a9e4be-440f-409b-b480-e06000c192ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC491E0D0\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76087a-401e-003a-10e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "78a9e4be-440f-409b-b480-e06000c192ae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6e46463a-8e23-474d-92a3-de6ec0d0e895" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76088d-401e-003a-1be6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1Fri, 06 Sep 2019 19:09:40 GMT\"0x8D732FDC47EA2A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "6e46463a-8e23-474d-92a3-de6ec0d0e895", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1?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" : "8395d1e5-ba64-4763-83fe-2c7bb9b23437" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76089d-401e-003a-28e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "8395d1e5-ba64-4763-83fe-2c7bb9b23437" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac9a9964700994d1", "javablobclearpagesac1pageblobapitestclearpagesac9a953629168", "1cec922d-a8b4-4f98-9686-a36ffb1ec54b" ] +} \ 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..9b5c4406ea03 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac68841131980d6e?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" : "2aa43bd1-8e31-4c61-8c2c-6353a2243aec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4A98DA9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7608ac-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "2aa43bd1-8e31-4c61-8c2c-6353a2243aec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac68841131980d6e/javablobclearpagesac1pageblobapitestclearpagesac688437202e8", + "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" : "9d6b9222-b538-4637-a3b0-ac108f79414e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4B37A94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7608c7-401e-003a-4be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "9d6b9222-b538-4637-a3b0-ac108f79414e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac68841131980d6e/javablobclearpagesac1pageblobapitestclearpagesac688437202e8?comp=page", + "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" : "9e6d216e-e5b2-4992-ab47-62b8cb0935a3", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "99gzHRCfMlk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "ETag" : "\"0x8D732FDC4B92135\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7608d0-401e-003a-53e6-6473d5000000", + "x-ms-client-request-id" : "9e6d216e-e5b2-4992-ab47-62b8cb0935a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac68841131980d6e/javablobclearpagesac1pageblobapitestclearpagesac688437202e8?comp=page", + "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" : "a43004fb-e35e-46f8-8b5b-cb81ca3cd8b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4BE5291\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7608e1-401e-003a-5fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "a43004fb-e35e-46f8-8b5b-cb81ca3cd8b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e2156ca-45c2-4795-80b8-677d7ca686ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7608f5-401e-003a-6ee6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac68841131980d6eFri, 06 Sep 2019 19:09:40 GMT\"0x8D732FDC4A98DA9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "3e2156ca-45c2-4795-80b8-677d7ca686ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac68841131980d6e?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" : "402b93b6-887f-4d65-88e1-0197caf21005" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760907-401e-003a-7de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "402b93b6-887f-4d65-88e1-0197caf21005" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac68841131980d6e", "javablobclearpagesac1pageblobapitestclearpagesac688437202e8", "73bc2440-57e7-4766-841d-83b5c8de4c26" ] +} \ 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..191f8bb1dfbe --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf63873957c0018?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" : "7aedc1d8-0cf2-4e0e-a176-f1051a394160" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4D64DD9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760914-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "7aedc1d8-0cf2-4e0e-a176-f1051a394160" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf63873957c0018/javablobclearpagesac1pageblobapitestclearpagesacf63259217cb", + "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" : "d333a406-5de9-47f1-a71d-3667421ceaf7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4E396AF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76093a-401e-003a-2ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "d333a406-5de9-47f1-a71d-3667421ceaf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf63873957c0018/javablobclearpagesac1pageblobapitestclearpagesacf63259217cb?comp=page", + "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" : "ca2f8a24-d783-45a4-b14e-ab70bb5a6d7c", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "GzdeIlP747o=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "ETag" : "\"0x8D732FDC4E9D9BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760950-401e-003a-3fe6-6473d5000000", + "x-ms-client-request-id" : "ca2f8a24-d783-45a4-b14e-ab70bb5a6d7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf63873957c0018/javablobclearpagesac1pageblobapitestclearpagesacf63259217cb?comp=page", + "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" : "197af1e2-982e-487f-ae12-3aa5b4fdee0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC4EE95C7\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76095b-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "197af1e2-982e-487f-ae12-3aa5b4fdee0f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f935f486-b8b8-4838-b8b7-9c1daaa46580" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760967-401e-003a-54e6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacf63873957c0018Fri, 06 Sep 2019 19:09:40 GMT\"0x8D732FDC4D64DD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "f935f486-b8b8-4838-b8b7-9c1daaa46580", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf63873957c0018?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" : "4cd85fac-3677-4345-9640-64dffa202621" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760976-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:39 GMT", + "x-ms-client-request-id" : "4cd85fac-3677-4345-9640-64dffa202621" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacf63873957c0018", "javablobclearpagesac1pageblobapitestclearpagesacf63259217cb", "480d3a07-8bed-4895-8ac4-39a46f779b9b" ] +} \ 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..9cbb88ac8e46 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec?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" : "ec9f6e63-0b16-49e4-92a4-98fceb479ef2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5092A0E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760985-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "ec9f6e63-0b16-49e4-92a4-98fceb479ef2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec/javablobclearpagesac1pageblobapitestclearpagesac39970913916", + "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" : "c78225c8-623e-44d6-bee8-c485a0295ad8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5116855\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7609a9-401e-003a-0ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "c78225c8-623e-44d6-bee8-c485a0295ad8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec/javablobclearpagesac1pageblobapitestclearpagesac39970913916?comp=page", + "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" : "19633032-2ebb-4d35-8ad6-96e51fe62233", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "KRLIRqYaxvA=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "ETag" : "\"0x8D732FDC517AB6D\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7609d5-401e-003a-2ae6-6473d5000000", + "x-ms-client-request-id" : "19633032-2ebb-4d35-8ad6-96e51fe62233" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec/javablobclearpagesac1pageblobapitestclearpagesac39970913916", + "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" : "93a19810-3c9f-4de0-8392-0088e2b2d9a3" + }, + "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" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:40 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" : "\"0x8D732FDC517AB6D\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:41 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7609ea-401e-003a-3ce6-6473d5000000", + "x-ms-client-request-id" : "93a19810-3c9f-4de0-8392-0088e2b2d9a3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec/javablobclearpagesac1pageblobapitestclearpagesac39970913916?comp=page", + "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" : "52f7eaa1-28ef-4d1a-998b-e53476170582" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC522D18E\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7609f9-401e-003a-49e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "52f7eaa1-28ef-4d1a-998b-e53476170582" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1a584db0-6a0f-4f8f-850f-94f0014091fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760a0a-401e-003a-59e6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac399233791f5cecFri, 06 Sep 2019 19:09:41 GMT\"0x8D732FDC5092A0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "1a584db0-6a0f-4f8f-850f-94f0014091fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec?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" : "906b76d9-77b1-4156-a3ed-661ded224d10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760a1a-401e-003a-66e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "906b76d9-77b1-4156-a3ed-661ded224d10" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac399233791f5cec", "javablobclearpagesac1pageblobapitestclearpagesac39970913916", "70cc16b9-f3b5-4100-9545-aecbe17943c4" ] +} \ 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..294200558563 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc3c28925425643?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" : "8f36bf84-f4d1-4b62-aa01-fa306ed8dc8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5343C30\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760a2e-401e-003a-77e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "8f36bf84-f4d1-4b62-aa01-fa306ed8dc8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc3c28925425643/javablobclearpagesac1pageblobapitestclearpagesacc3c380207a0", + "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" : "1d22ec18-90af-4d4b-8cf4-b000350f8780" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC53ACC17\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760a3d-401e-003a-04e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "1d22ec18-90af-4d4b-8cf4-b000350f8780" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc3c28925425643/javablobclearpagesac1pageblobapitestclearpagesacc3c380207a0?comp=page", + "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" : "ddf68e83-419f-4dff-b20e-7146e1b53284", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "gBw7F646Jiw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "ETag" : "\"0x8D732FDC540E806\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760a4f-401e-003a-10e6-6473d5000000", + "x-ms-client-request-id" : "ddf68e83-419f-4dff-b20e-7146e1b53284" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc3c28925425643/javablobclearpagesac1pageblobapitestclearpagesacc3c380207a0?comp=page", + "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" : "45ea83eb-d1d8-4aa3-a10d-ea713e3c8e9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC546B5CB\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760a62-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "45ea83eb-d1d8-4aa3-a10d-ea713e3c8e9b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "969cc8ad-5296-40c7-9a62-949c62870995" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760a74-401e-003a-2ee6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacc3c28925425643Fri, 06 Sep 2019 19:09:41 GMT\"0x8D732FDC5343C30\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "969cc8ad-5296-40c7-9a62-949c62870995", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc3c28925425643?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" : "8d8e6ccb-e0ee-4dc6-9f0a-8823204bf3b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760a85-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "8d8e6ccb-e0ee-4dc6-9f0a-8823204bf3b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacc3c28925425643", "javablobclearpagesac1pageblobapitestclearpagesacc3c380207a0", "90a40c1d-67aa-46d4-a766-8c3f22769d00" ] +} \ 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..86c072f1dd29 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac732476815fee87?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" : "03ca9310-78fb-48bb-ab0c-463d40d5245f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC562F8AE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760ac6-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "03ca9310-78fb-48bb-ab0c-463d40d5245f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac732476815fee87/javablobclearpagesac1pageblobapitestclearpagesac73262853a33", + "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" : "3338bb02-351d-4392-a413-43b6d62c1190" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC56A24B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760ad4-401e-003a-7de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "3338bb02-351d-4392-a413-43b6d62c1190" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac732476815fee87/javablobclearpagesac1pageblobapitestclearpagesac73262853a33?comp=page", + "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" : "7828e91e-1268-4c85-8125-acd2e1957d5d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "buJcCz9zM6g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "ETag" : "\"0x8D732FDC5710425\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760add-401e-003a-06e6-6473d5000000", + "x-ms-client-request-id" : "7828e91e-1268-4c85-8125-acd2e1957d5d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac732476815fee87/javablobclearpagesac1pageblobapitestclearpagesac73262853a33?comp=lease", + "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" : "8a75f1ad-ba2f-4a33-ae80-9afa4bd2504e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5710425\"", + "x-ms-lease-id" : "a9847545-eec9-45d9-b241-aae5aff5a814", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760af0-401e-003a-15e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "8a75f1ad-ba2f-4a33-ae80-9afa4bd2504e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac732476815fee87/javablobclearpagesac1pageblobapitestclearpagesac73262853a33?comp=page", + "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" : "8cb5aad4-8e9d-4f3e-8a45-6bd38d37d0a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC57C5170\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760b00-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "8cb5aad4-8e9d-4f3e-8a45-6bd38d37d0a2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7fd0a234-6bac-4d47-9171-ec2b0a5ceb68" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760b0a-401e-003a-2ae6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac732476815fee87Fri, 06 Sep 2019 19:09:41 GMT\"0x8D732FDC562F8AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "7fd0a234-6bac-4d47-9171-ec2b0a5ceb68", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac732476815fee87?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" : "4d63e110-a90c-4236-85cb-d09154921d40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760b1d-401e-003a-39e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:40 GMT", + "x-ms-client-request-id" : "4d63e110-a90c-4236-85cb-d09154921d40" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac732476815fee87", "javablobclearpagesac1pageblobapitestclearpagesac73262853a33", "f09b9e23-f85a-42e4-aa56-0fee3516de66" ] +} \ 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..e9700648ea1e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc73507371033d3?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" : "934860c7-1676-47fc-a173-ebd179b6a5f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5929FC9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760b3f-401e-003a-58e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "934860c7-1676-47fc-a173-ebd179b6a5f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc73507371033d3/javablobclearpagesac1pageblobapitestclearpagesacc73298112ac", + "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" : "906ecd9d-55d4-4ee4-aa06-a09358e96cfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5ADA659\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760bb5-401e-003a-3ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "906ecd9d-55d4-4ee4-aa06-a09358e96cfa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc73507371033d3/javablobclearpagesac1pageblobapitestclearpagesacc73298112ac?comp=page", + "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" : "8719b305-46ec-4209-88e3-e0c295a957a1", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LMR/itlR8f4=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "ETag" : "\"0x8D732FDC5B4107F\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760bd1-401e-003a-53e6-6473d5000000", + "x-ms-client-request-id" : "8719b305-46ec-4209-88e3-e0c295a957a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc73507371033d3/javablobclearpagesac1pageblobapitestclearpagesacc73298112ac?comp=page", + "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" : "c8b8ac66-43b9-44ce-ae7b-f013cb5a84e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5BAC8D8\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760be9-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "c8b8ac66-43b9-44ce-ae7b-f013cb5a84e8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a2ed5f51-72e6-4bc0-83d9-b582fd6e7ce0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760bfd-401e-003a-76e6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacc73507371033d3Fri, 06 Sep 2019 19:09:41 GMT\"0x8D732FDC5929FC9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "a2ed5f51-72e6-4bc0-83d9-b582fd6e7ce0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacc73507371033d3?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" : "0dd96dbb-6b4d-48a5-b782-7639634d6952" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760c07-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "0dd96dbb-6b4d-48a5-b782-7639634d6952" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacc73507371033d3", "javablobclearpagesac1pageblobapitestclearpagesacc73298112ac", "613f48cc-c3f5-4b83-8f19-ac52677fed15" ] +} \ 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..94fc60ee5ac0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac92684242de9ced?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" : "a6b24da8-0dab-4216-a699-b0a84c77c540" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5CD6D2E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760c23-401e-003a-18e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "a6b24da8-0dab-4216-a699-b0a84c77c540" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac92684242de9ced/javablobclearpagesac1pageblobapitestclearpagesac926861618ce", + "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" : "4d944d08-bfb3-4bbb-b19b-ce999422c575" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5D3D50B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760c31-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "4d944d08-bfb3-4bbb-b19b-ce999422c575" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac92684242de9ced/javablobclearpagesac1pageblobapitestclearpagesac926861618ce?comp=page", + "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" : "aa2502b4-6c5d-4bdd-830d-187899342e5f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "lUfrW0G10Hk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "ETag" : "\"0x8D732FDC5DA8D63\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760c3a-401e-003a-2de6-6473d5000000", + "x-ms-client-request-id" : "aa2502b4-6c5d-4bdd-830d-187899342e5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac92684242de9ced/javablobclearpagesac1pageblobapitestclearpagesac926861618ce?comp=page", + "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" : "96ff2e7d-944b-476e-aa6f-1777d827eb01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5DFBEBF\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760c4a-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "96ff2e7d-944b-476e-aa6f-1777d827eb01" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "319482aa-59e2-4ee1-829e-d3de37a54ea2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760c5e-401e-003a-4be6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac92684242de9cedFri, 06 Sep 2019 19:09:42 GMT\"0x8D732FDC5CD6D2E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "319482aa-59e2-4ee1-829e-d3de37a54ea2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac92684242de9ced?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" : "3a8ef127-3f65-4290-943b-f17748459648" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760c6c-401e-003a-56e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "3a8ef127-3f65-4290-943b-f17748459648" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac92684242de9ced", "javablobclearpagesac1pageblobapitestclearpagesac926861618ce", "546d2613-7231-4668-9320-16ac403fa6fb" ] +} \ 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..3a90cf8a3b3b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a29545211d353?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" : "441c09ec-1933-4a08-a0e9-5c0216982984" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5F1EDFB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760c80-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "441c09ec-1933-4a08-a0e9-5c0216982984" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a29545211d353/javablobclearpagesac1pageblobapitestclearpagesac0a255991514", + "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" : "80a9a361-e877-4358-9592-d62281ccb942" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC5F855A4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760c91-401e-003a-75e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "80a9a361-e877-4358-9592-d62281ccb942" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a29545211d353/javablobclearpagesac1pageblobapitestclearpagesac0a255991514?comp=page", + "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" : "5159fb4b-ece4-4871-a480-a441c295bc15", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "E2SgtM+WPL0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "ETag" : "\"0x8D732FDC5FF0E0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760ca7-401e-003a-05e6-6473d5000000", + "x-ms-client-request-id" : "5159fb4b-ece4-4871-a480-a441c295bc15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a29545211d353/javablobclearpagesac1pageblobapitestclearpagesac0a255991514?comp=page", + "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" : "0f6ca72a-f7bc-4ba9-896c-d2d22ae92982" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC605C659\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760cae-401e-003a-0ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "0f6ca72a-f7bc-4ba9-896c-d2d22ae92982" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "438b5e8c-121d-4ec1-9bc2-be64ed71b51d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760cc3-401e-003a-1fe6-6473d5000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac0a29545211d353Fri, 06 Sep 2019 19:09:42 GMT\"0x8D732FDC5F1EDFB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "438b5e8c-121d-4ec1-9bc2-be64ed71b51d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a29545211d353?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" : "c364dd1f-6cbf-4d53-9c68-f619623982bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760cd0-401e-003a-2ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "c364dd1f-6cbf-4d53-9c68-f619623982bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac0a29545211d353", "javablobclearpagesac1pageblobapitestclearpagesac0a255991514", "f48f560a-1aff-44c8-a4ff-431e7da259d0" ] +} \ 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..4a8cca9698b5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5?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" : "e53f8c8b-cbe0-4e13-ad7a-ca768e136594" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC61B791E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760ce4-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "e53f8c8b-cbe0-4e13-ad7a-ca768e136594" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5/javablobclearpagesacfail132128874e27c4a21e4583", + "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" : "da420199-5d80-4e4a-81c0-1ccbd27bb582" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC621924F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760cfc-401e-003a-4ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "x-ms-client-request-id" : "da420199-5d80-4e4a-81c0-1ccbd27bb582" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5/javablobclearpagesacfail132128874e27c4a21e4583?comp=page", + "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" : "e93cd2ef-0d9d-410e-9764-8edeb4f593d7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Hr3y8aR5tEg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:41 GMT", + "ETag" : "\"0x8D732FDC62738F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760d0b-401e-003a-5be6-6473d5000000", + "x-ms-client-request-id" : "e93cd2ef-0d9d-410e-9764-8edeb4f593d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5/javablobclearpagesacfail132128874e27c4a21e4583?comp=page", + "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" : "d3f304de-1424-47c5-9ca7-3682fd73640d" + }, + "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" : "8f760d14-401e-003a-61e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f760d14-401e-003a-61e6-6473d5000000\nTime:2019-09-06T19:09:42.9099490Z", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "d3f304de-1424-47c5-9ca7-3682fd73640d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "689380ff-6ea4-4522-95cb-47ea436e11b6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760d20-401e-003a-6ce6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5Fri, 06 Sep 2019 19:09:42 GMT\"0x8D732FDC61B791E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "689380ff-6ea4-4522-95cb-47ea436e11b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5?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" : "a29250ff-ae23-4c62-be25-8eac545b4193" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760d33-401e-003a-7fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "a29250ff-ae23-4c62-be25-8eac545b4193" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail57559035a5", "javablobclearpagesacfail132128874e27c4a21e4583", "c097a197-b5f7-44d4-9071-759bd583c271" ] +} \ 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..abc91b56acf8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804c?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" : "1084e3aa-7390-452b-b3d6-9b66e20a8688" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC63D130D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760d4b-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "1084e3aa-7390-452b-b3d6-9b66e20a8688" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804c/javablobclearpagesacfail164746e834d3441c1943e0", + "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" : "379856d2-ab01-4de3-8fc4-00715aedf4f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6428FA9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760d5e-401e-003a-23e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "379856d2-ab01-4de3-8fc4-00715aedf4f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804c/javablobclearpagesacfail164746e834d3441c1943e0?comp=page", + "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" : "a45056d6-78d7-4e1d-ba23-1442ffb36e90", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "I/kkl7opWNw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "ETag" : "\"0x8D732FDC649E467\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760d8f-401e-003a-4ae6-6473d5000000", + "x-ms-client-request-id" : "a45056d6-78d7-4e1d-ba23-1442ffb36e90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804c/javablobclearpagesacfail164746e834d3441c1943e0?comp=page", + "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" : "1a8c4825-bcee-4499-ac86-940165693f72" + }, + "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" : "8f760d9f-401e-003a-59e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f760d9f-401e-003a-59e6-6473d5000000\nTime:2019-09-06T19:09:43.1431707Z", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "1a8c4825-bcee-4499-ac86-940165693f72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d57fcade-dc37-4a6f-b7d4-8a76952f1d0b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760db7-401e-003a-6de6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804cFri, 06 Sep 2019 19:09:43 GMT\"0x8D732FDC63D130D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "d57fcade-dc37-4a6f-b7d4-8a76952f1d0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804c?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" : "1295a4ba-8c49-40fd-b887-885f5e244c15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760dd6-401e-003a-07e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "1295a4ba-8c49-40fd-b887-885f5e244c15" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfailc11251804c", "javablobclearpagesacfail164746e834d3441c1943e0", "36eb8c33-bfca-4a0b-97c5-f015695ad1ea" ] +} \ 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..ee29621ca50b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552f?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" : "5737a8a6-33ce-4e1a-b23e-743e341bbdfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC660A945\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760de3-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "5737a8a6-33ce-4e1a-b23e-743e341bbdfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552f/javablobclearpagesacfail193193dd0ef58e751d4412", + "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" : "c55a7a7a-81df-44a1-8798-070ee688af5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6675E70\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760e01-401e-003a-2ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "c55a7a7a-81df-44a1-8798-070ee688af5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552f/javablobclearpagesacfail193193dd0ef58e751d4412?comp=page", + "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" : "cba99145-b78a-4a71-80ff-7e04a6a1b4be", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "OXgyRszZWa0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "ETag" : "\"0x8D732FDC678C7B7\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760e46-401e-003a-64e6-6473d5000000", + "x-ms-client-request-id" : "cba99145-b78a-4a71-80ff-7e04a6a1b4be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552f/javablobclearpagesacfail193193dd0ef58e751d4412?comp=page", + "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" : "8f7e131d-a75e-41ad-8b3a-7789a5d408e3" + }, + "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" : "8f760e54-401e-003a-71e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f760e54-401e-003a-71e6-6473d5000000\nTime:2019-09-06T19:09:43.4454587Z", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "8f7e131d-a75e-41ad-8b3a-7789a5d408e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d2810ba-3a28-4f75-a027-9d51d1a5c47e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760e60-401e-003a-7ce6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552fFri, 06 Sep 2019 19:09:43 GMT\"0x8D732FDC660A945\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "9d2810ba-3a28-4f75-a027-9d51d1a5c47e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552f?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" : "782af940-a51b-4608-8ab2-86acd199021d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760e70-401e-003a-0ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "782af940-a51b-4608-8ab2-86acd199021d" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail9e3223552f", "javablobclearpagesacfail193193dd0ef58e751d4412", "8a06dc9f-38fc-448e-b313-fd23565026f0" ] +} \ 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..1c783566d969 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7?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" : "e1fe8031-4c5e-4a02-ad21-672400bd729c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6955AAD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760e86-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "e1fe8031-4c5e-4a02-ad21-672400bd729c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7/javablobclearpagesacfail102695c8bf6fa255954bf0", + "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" : "847f5606-bc24-4602-92b8-ba04c471674c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6A7D228\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760ed2-401e-003a-62e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "847f5606-bc24-4602-92b8-ba04c471674c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7/javablobclearpagesacfail102695c8bf6fa255954bf0?comp=page", + "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" : "0e84e61c-cafb-418c-901a-2c278568d3aa", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "lSnFdUHCPqs=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "ETag" : "\"0x8D732FDC6ADC6FF\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760edd-401e-003a-6ce6-6473d5000000", + "x-ms-client-request-id" : "0e84e61c-cafb-418c-901a-2c278568d3aa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7/javablobclearpagesacfail102695c8bf6fa255954bf0", + "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" : "b807158f-9e92-4167-84b2-9deac59408e4" + }, + "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" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19: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" : "\"0x8D732FDC6ADC6FF\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:43 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f760ee8-401e-003a-75e6-6473d5000000", + "x-ms-client-request-id" : "b807158f-9e92-4167-84b2-9deac59408e4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7/javablobclearpagesacfail102695c8bf6fa255954bf0?comp=page", + "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" : "4313917f-f22c-4a20-bd3a-c7282e980e9f" + }, + "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" : "8f760ef9-401e-003a-05e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f760ef9-401e-003a-05e6-6473d5000000\nTime:2019-09-06T19:09:43.8258201Z", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "4313917f-f22c-4a20-bd3a-c7282e980e9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "104164cb-9485-48ad-9ddc-e9768a42e853" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760f0d-401e-003a-15e6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7Fri, 06 Sep 2019 19:09:43 GMT\"0x8D732FDC6955AAD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "104164cb-9485-48ad-9ddc-e9768a42e853", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7?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" : "ec9a3d89-ec2f-48b9-bda7-96b56e8118c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760f16-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:42 GMT", + "x-ms-client-request-id" : "ec9a3d89-ec2f-48b9-bda7-96b56e8118c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail78097201b7", "javablobclearpagesacfail102695c8bf6fa255954bf0", "96c1ee2b-2330-41e7-8df2-7985a71c3199" ] +} \ 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..728a78b57ad2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1?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" : "8a2add8c-450f-45b9-af9d-bc83cd48b7a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6C85DF5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760f25-401e-003a-2ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "8a2add8c-450f-45b9-af9d-bc83cd48b7a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1/javablobclearpagesacfail109550e63eeabe70f7411d", + "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" : "4c51c591-79a1-45ca-b3b7-f646c3ea4036" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6CE9D39\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760f30-401e-003a-33e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "4c51c591-79a1-45ca-b3b7-f646c3ea4036" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1/javablobclearpagesacfail109550e63eeabe70f7411d?comp=page", + "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" : "c6a5d744-3815-4fd6-af2d-2f5ddfb5577d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "yhtREX5Ugpo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "ETag" : "\"0x8D732FDC6D46AFC\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760f57-401e-003a-4ee6-6473d5000000", + "x-ms-client-request-id" : "c6a5d744-3815-4fd6-af2d-2f5ddfb5577d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1/javablobclearpagesacfail109550e63eeabe70f7411d?comp=lease", + "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" : "930e7c13-64cd-40a7-9972-b3b0e56866a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6D46AFC\"", + "x-ms-lease-id" : "8369d39c-6c24-47a6-bb5a-985b971b1593", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760f6c-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "930e7c13-64cd-40a7-9972-b3b0e56866a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1/javablobclearpagesacfail109550e63eeabe70f7411d?comp=page", + "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" : "25fb4906-f774-44e3-aecd-4a1159ae7134" + }, + "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" : "8f760f88-401e-003a-77e6-6473d5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:8f760f88-401e-003a-77e6-6473d5000000\nTime:2019-09-06T19:09:44.0970780Z", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "25fb4906-f774-44e3-aecd-4a1159ae7134", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "65debf8c-ec39-464b-b429-62dacf40809c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760f9c-401e-003a-06e6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1Fri, 06 Sep 2019 19:09:43 GMT\"0x8D732FDC6C85DF5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "65debf8c-ec39-464b-b429-62dacf40809c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1?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" : "0bdfde68-3cc9-4022-9f98-0f28fd2a8c02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760fae-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "0bdfde68-3cc9-4022-9f98-0f28fd2a8c02" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail4cb83307c1", "javablobclearpagesacfail109550e63eeabe70f7411d", "3f320db1-e088-458c-a1fa-88bcbcd46dbd" ] +} \ 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..f9487b075c3f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220f?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" : "e87a6802-b09c-46e9-8177-9c70abd88e2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC6F51E2E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760fc2-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "e87a6802-b09c-46e9-8177-9c70abd88e2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220f/javablobclearpagesacfail178468fdbab16e530747dd", + "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" : "edceb33c-1f6c-4785-a1bf-1c58d730affe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7091C27\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761017-401e-003a-6be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "edceb33c-1f6c-4785-a1bf-1c58d730affe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220f/javablobclearpagesacfail178468fdbab16e530747dd?comp=page", + "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" : "02f27f04-b995-488b-8126-01def36be66c", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "odcA6X4Sy7k=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "ETag" : "\"0x8D732FDC70F5F39\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76102d-401e-003a-7ee6-6473d5000000", + "x-ms-client-request-id" : "02f27f04-b995-488b-8126-01def36be66c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220f/javablobclearpagesacfail178468fdbab16e530747dd?comp=page", + "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" : "55735bbd-2927-4795-9789-677ddbf08817" + }, + "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" : "8f761045-401e-003a-12e6-6473d5000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:8f761045-401e-003a-12e6-6473d5000000\nTime:2019-09-06T19:09:44.4364011Z", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "55735bbd-2927-4795-9789-677ddbf08817", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0bd2f514-97c9-4d8b-ba84-f4df60e1d811" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761051-401e-003a-1ce6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220fFri, 06 Sep 2019 19:09:44 GMT\"0x8D732FDC6F51E2E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "0bd2f514-97c9-4d8b-ba84-f4df60e1d811", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220f?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" : "c88069b8-0c1c-423d-ad63-cddc48bec807" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76105f-401e-003a-28e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "c88069b8-0c1c-423d-ad63-cddc48bec807" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail6d0553220f", "javablobclearpagesacfail178468fdbab16e530747dd", "b81fc344-77e5-4440-a9bb-7c5c64736527" ] +} \ 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..390d83e38913 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bd?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" : "af75a51b-a819-450e-9579-ae65a67599b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7270FCF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761079-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "af75a51b-a819-450e-9579-ae65a67599b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bd/javablobclearpagesacfail162772ea03985e12254d60", + "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" : "26b3d94f-ba1c-406b-96fc-afeea7dc0eb8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC72CD94D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76108f-401e-003a-52e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "26b3d94f-ba1c-406b-96fc-afeea7dc0eb8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bd/javablobclearpagesacfail162772ea03985e12254d60?comp=page", + "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" : "99c8bb92-75cb-4814-97f9-da80a50ee951", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LN4HkV3a3qA=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "ETag" : "\"0x8D732FDC73258EC\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7610a8-401e-003a-64e6-6473d5000000", + "x-ms-client-request-id" : "99c8bb92-75cb-4814-97f9-da80a50ee951" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bd/javablobclearpagesacfail162772ea03985e12254d60?comp=page", + "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" : "2af15a4c-0358-466b-b48f-ee848b9e907e" + }, + "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" : "8f7610bf-401e-003a-79e6-6473d5000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:8f7610bf-401e-003a-79e6-6473d5000000\nTime:2019-09-06T19:09:44.6626172Z", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "2af15a4c-0358-466b-b48f-ee848b9e907e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5c11655b-0c0d-4ab0-b3e3-2dcbcdada6d6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7610cd-401e-003a-05e6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bdFri, 06 Sep 2019 19:09:44 GMT\"0x8D732FDC7270FCF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "5c11655b-0c0d-4ab0-b3e3-2dcbcdada6d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bd?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" : "4d85f3d2-6bc6-4a25-90da-67be718daa5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7610dc-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "4d85f3d2-6bc6-4a25-90da-67be718daa5d" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail1c219485bd", "javablobclearpagesacfail162772ea03985e12254d60", "c69616ba-aac0-4bec-aabd-1516a9b10f50" ] +} \ 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..101ad96a8b41 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133?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" : "94d956f6-e9d0-441a-b836-a47a11f41da8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC746FBA7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7610e7-401e-003a-1de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "94d956f6-e9d0-441a-b836-a47a11f41da8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133/javablobclearpagesacfail192427abdea89108874dba", + "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" : "2fe4037b-843c-46b7-bd92-a15943d7e651" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC74D1334\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7610f7-401e-003a-2ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "2fe4037b-843c-46b7-bd92-a15943d7e651" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133/javablobclearpagesacfail192427abdea89108874dba?comp=page", + "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" : "f3d6ff4e-d2cb-42c7-a17e-986e88c9cd35", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "82dgG4QhnAc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "ETag" : "\"0x8D732FDC753F2A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f761115-401e-003a-40e6-6473d5000000", + "x-ms-client-request-id" : "f3d6ff4e-d2cb-42c7-a17e-986e88c9cd35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133/javablobclearpagesacfail192427abdea89108874dba?comp=page", + "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" : "16d73084-1e2c-4336-ab91-927951752b28" + }, + "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" : "8f76112c-401e-003a-56e6-6473d5000000", + "Body" : "SequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:8f76112c-401e-003a-56e6-6473d5000000\nTime:2019-09-06T19:09:44.8898327Z", + "Date" : "Fri, 06 Sep 2019 19:09:43 GMT", + "x-ms-client-request-id" : "16d73084-1e2c-4336-ab91-927951752b28", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e380ffad-abf0-4acf-beef-7d2bea778ce1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761141-401e-003a-65e6-6473d5000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133Fri, 06 Sep 2019 19:09:44 GMT\"0x8D732FDC746FBA7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "e380ffad-abf0-4acf-beef-7d2bea778ce1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133?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" : "52448536-e2f4-422b-8b40-6baa98de1104" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761158-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "52448536-e2f4-422b-8b40-6baa98de1104" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail3939033133", "javablobclearpagesacfail192427abdea89108874dba", "9c050d20-6877-4fde-acd0-f2c5e269e4c1" ] +} \ 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..f9e1fa83fe66 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac7957979985767b90df?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" : "b58caac6-1781-4ee9-ae23-a4a92b922706" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6897C7C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f579-001e-001f-21e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "b58caac6-1781-4ee9-ae23-a4a92b922706" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac7957979985767b90df/javablobcreateac1pageblobapitestcreateac795193149c0c53c", + "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" : "71b1b2e2-e0e0-4e74-b8b1-0029de6c163b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB68FA21D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f596-001e-001f-3be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "71b1b2e2-e0e0-4e74-b8b1-0029de6c163b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac7957979985767b90df/javablobcreateac1pageblobapitestcreateac795193149c0c53c", + "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" : "da2bbda0-fca9-44b8-bdec-9b37bd1882f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB694FA8F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f5ab-001e-001f-4ee6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "da2bbda0-fca9-44b8-bdec-9b37bd1882f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2336924a-bd34-4381-abaa-6b39912045c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f5c9-001e-001f-6ae6-64eb66000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac7957979985767b90dfFri, 06 Sep 2019 19:09:16 GMT\"0x8D732FDB6897C7C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "2336924a-bd34-4381-abaa-6b39912045c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac7957979985767b90df?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" : "9677e065-9507-47fa-b89a-819cc42ee7fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f5d6-001e-001f-77e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "9677e065-9507-47fa-b89a-819cc42ee7fb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac7957979985767b90df", "javablobcreateac1pageblobapitestcreateac795193149c0c53c" ] +} \ 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..4791c3885ea8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac32e290290121831d67?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" : "e09da878-f4c1-4bc4-8b10-4ec2fd00e2fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6A792FC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f603-001e-001f-1be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "e09da878-f4c1-4bc4-8b10-4ec2fd00e2fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac32e290290121831d67/javablobcreateac1pageblobapitestcreateac32e674306933579", + "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" : "bbd9478b-96d0-4792-8575-b1a666b06cbd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6AE2DD9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f618-001e-001f-2de6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "bbd9478b-96d0-4792-8575-b1a666b06cbd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac32e290290121831d67/javablobcreateac1pageblobapitestcreateac32e674306933579", + "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" : "59bcbec6-2ae0-4f72-888b-2091306a8f1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6B33827\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f631-001e-001f-46e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "59bcbec6-2ae0-4f72-888b-2091306a8f1e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "de3ca9b2-5da0-4e44-8f14-bf0c22aa015e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f648-001e-001f-59e6-64eb66000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac32e290290121831d67Fri, 06 Sep 2019 19:09:16 GMT\"0x8D732FDB6A792FC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "de3ca9b2-5da0-4e44-8f14-bf0c22aa015e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac32e290290121831d67?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" : "0f61bfe9-8d44-45e0-8a0a-cee651c90ee4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f65b-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "0f61bfe9-8d44-45e0-8a0a-cee651c90ee4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac32e290290121831d67", "javablobcreateac1pageblobapitestcreateac32e674306933579" ] +} \ 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..47e4a9611743 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac223302015dcd392f00?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" : "fa4ed10a-b9b2-4651-ba6c-68ba5dc92899" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6CBECA3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f674-001e-001f-03e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "fa4ed10a-b9b2-4651-ba6c-68ba5dc92899" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac223302015dcd392f00/javablobcreateac1pageblobapitestcreateac2230022157f84c5", + "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" : "6df2424b-df9e-4511-83ac-ca5d7dafd4a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6D2392D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f6cd-001e-001f-53e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "6df2424b-df9e-4511-83ac-ca5d7dafd4a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac223302015dcd392f00/javablobcreateac1pageblobapitestcreateac2230022157f84c5", + "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" : "7230a6b0-3f2e-4d38-bca5-441c7145b53d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6D7B8B2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f6eb-001e-001f-6be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "7230a6b0-3f2e-4d38-bca5-441c7145b53d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c5c1e9f-b006-43a5-a0e5-81bd010376d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f6fe-001e-001f-7de6-64eb66000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac223302015dcd392f00Fri, 06 Sep 2019 19:09:17 GMT\"0x8D732FDB6CBECA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "1c5c1e9f-b006-43a5-a0e5-81bd010376d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac223302015dcd392f00?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" : "91ec8444-07ad-42be-97b8-c0f78df244cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f717-001e-001f-11e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "91ec8444-07ad-42be-97b8-c0f78df244cc" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac223302015dcd392f00", "javablobcreateac1pageblobapitestcreateac2230022157f84c5" ] +} \ 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..e285eb39527b --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3a89926aa069f6c48?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" : "49845b88-4a20-47c2-918d-f26b32cb9ce2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6EBD854\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f74b-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "49845b88-4a20-47c2-918d-f26b32cb9ce2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3a89926aa069f6c48/javablobcreateac1pageblobapitestcreateacd3a26576ea05849", + "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" : "aeb972df-df9b-45c6-9c40-1138cd5100a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6F1AF81\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f776-001e-001f-5ee6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "aeb972df-df9b-45c6-9c40-1138cd5100a3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3a89926aa069f6c48/javablobcreateac1pageblobapitestcreateacd3a26576ea05849", + "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" : "02a5944d-7842-4aae-8a60-70c020816a5f" + }, + "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" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19: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" : "\"0x8D732FDB6F1AF81\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:17 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65f78b-001e-001f-70e6-64eb66000000", + "x-ms-client-request-id" : "02a5944d-7842-4aae-8a60-70c020816a5f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3a89926aa069f6c48/javablobcreateac1pageblobapitestcreateacd3a26576ea05849", + "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" : "fdb0f1f5-a801-4462-8672-cdbc2c977eb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6FD23E7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f797-001e-001f-7ce6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "fdb0f1f5-a801-4462-8672-cdbc2c977eb3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3ecbbc8e-e7a5-4f75-ac0c-bba7cc5b13a4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f7ab-001e-001f-0ee6-64eb66000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateacd3a89926aa069f6c48Fri, 06 Sep 2019 19:09:17 GMT\"0x8D732FDB6EBD854\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "3ecbbc8e-e7a5-4f75-ac0c-bba7cc5b13a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3a89926aa069f6c48?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" : "52b1c25f-bbc4-4b0e-84e2-7d9dc57a329c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f7c0-001e-001f-1ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "52b1c25f-bbc4-4b0e-84e2-7d9dc57a329c" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateacd3a89926aa069f6c48", "javablobcreateac1pageblobapitestcreateacd3a26576ea05849" ] +} \ 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..0e842342a95e --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac1b980012cafc0c8a5e?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" : "4bce6ba4-037c-4fcf-8ae0-df02adfc6e83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB711E00C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f7df-001e-001f-3ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "4bce6ba4-037c-4fcf-8ae0-df02adfc6e83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac1b980012cafc0c8a5e/javablobcreateac1pageblobapitestcreateac1b96504307f1591", + "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" : "4bcb3ef1-90b9-487e-b927-32ef792cd1ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB71A9DFA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f809-001e-001f-5ee6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "4bcb3ef1-90b9-487e-b927-32ef792cd1ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac1b980012cafc0c8a5e/javablobcreateac1pageblobapitestcreateac1b96504307f1591", + "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" : "299b8be3-fc21-4291-947b-58b2efd86079" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB7206BBB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f81f-001e-001f-72e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "299b8be3-fc21-4291-947b-58b2efd86079" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ae998f6c-7ed7-43e9-9bb8-b1f93084f5de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f83f-001e-001f-0ee6-64eb66000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac1b980012cafc0c8a5eFri, 06 Sep 2019 19:09:17 GMT\"0x8D732FDB711E00C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "ae998f6c-7ed7-43e9-9bb8-b1f93084f5de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac1b980012cafc0c8a5e?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" : "e3307b31-2ac9-4e3d-b349-e299aeda43c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f85d-001e-001f-27e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "e3307b31-2ac9-4e3d-b349-e299aeda43c4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac1b980012cafc0c8a5e", "javablobcreateac1pageblobapitestcreateac1b96504307f1591" ] +} \ 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..57c2038b57ce --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd7c881863990a1c70a?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" : "73938a74-5ba1-4453-99e8-c065817a601e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB736D60F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f883-001e-001f-49e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "73938a74-5ba1-4453-99e8-c065817a601e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd7c881863990a1c70a/javablobcreateac1pageblobapitestcreateacd7c875421ab92bb", + "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" : "2ce73fb2-2aff-4d9c-ad44-34a3e143e5d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB740A599\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f89e-001e-001f-5fe6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "2ce73fb2-2aff-4d9c-ad44-34a3e143e5d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd7c881863990a1c70a/javablobcreateac1pageblobapitestcreateacd7c875421ab92bb?comp=lease", + "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" : "0f4be52e-a994-4351-a1d8-f29b3676c6f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB740A599\"", + "x-ms-lease-id" : "a26a3e2e-38ad-4fd5-a219-110981289df7", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f8b4-001e-001f-73e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "0f4be52e-a994-4351-a1d8-f29b3676c6f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd7c881863990a1c70a/javablobcreateac1pageblobapitestcreateacd7c875421ab92bb", + "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" : "d0de7b96-6e1c-423a-bda0-fea63b750d3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB74BA4BA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f8c4-001e-001f-01e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "d0de7b96-6e1c-423a-bda0-fea63b750d3c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "49c78260-c3e2-4d8d-934f-6b162cdadd4b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f8d9-001e-001f-15e6-64eb66000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateacd7c881863990a1c70aFri, 06 Sep 2019 19:09:17 GMT\"0x8D732FDB736D60F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "49c78260-c3e2-4d8d-934f-6b162cdadd4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd7c881863990a1c70a?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" : "bd1e97d6-1517-4235-ab9f-2394f1b8cd97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f8e9-001e-001f-23e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "bd1e97d6-1517-4235-ab9f-2394f1b8cd97" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateacd7c881863990a1c70a", "javablobcreateac1pageblobapitestcreateacd7c875421ab92bb" ] +} \ 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..d6940a1cf859 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail057059790e50a0?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" : "46f584d2-4060-4033-8a76-cbd41d1890b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB75D04D9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f911-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "46f584d2-4060-4033-8a76-cbd41d1890b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail057059790e50a0/javablobcreateacfail1pageblobapitestcreateacfail057244067f2", + "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" : "63b315b1-8595-4a38-bbac-1bed0ab9c6d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB76462B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f933-001e-001f-66e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "63b315b1-8595-4a38-bbac-1bed0ab9c6d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail057059790e50a0/javablobcreateacfail1pageblobapitestcreateacfail057244067f2", + "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" : "81e4c649-2583-4e3f-b9ef-7e4b10181a07" + }, + "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" : "ec65f954-001e-001f-01e6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65f954-001e-001f-01e6-64eb66000000\nTime:2019-09-06T19:09:18.1526658Z", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "81e4c649-2583-4e3f-b9ef-7e4b10181a07", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bcbf8226-e3b4-47f7-a863-8a3ea76980db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f96f-001e-001f-1be6-64eb66000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail057059790e50a0Fri, 06 Sep 2019 19:09:18 GMT\"0x8D732FDB75D04D9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "bcbf8226-e3b4-47f7-a863-8a3ea76980db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail057059790e50a0?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" : "a5538fd0-c584-449a-b26e-ab3156069b27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f984-001e-001f-2fe6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "a5538fd0-c584-449a-b26e-ab3156069b27" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail057059790e50a0", "javablobcreateacfail1pageblobapitestcreateacfail057244067f2" ] +} \ 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..36313de37e5b --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaile1c580316f744b?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" : "0bceb37f-321b-4c63-a6b0-7ca4b64965f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB77A09B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f9ab-001e-001f-52e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "0bceb37f-321b-4c63-a6b0-7ca4b64965f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaile1c580316f744b/javablobcreateacfail1pageblobapitestcreateacfaile1c677610a4", + "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" : "e8f52165-783a-4262-82e5-41accc599fcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB77FE07D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f9c7-001e-001f-68e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "e8f52165-783a-4262-82e5-41accc599fcb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaile1c580316f744b/javablobcreateacfail1pageblobapitestcreateacfaile1c677610a4", + "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" : "dca36e50-edda-4a95-bc9d-dd5c97a348c0" + }, + "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" : "ec65f9df-001e-001f-7de6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65f9df-001e-001f-7de6-64eb66000000\nTime:2019-09-06T19:09:18.3298315Z", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "dca36e50-edda-4a95-bc9d-dd5c97a348c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5b666533-5d97-41fb-8d02-1d492f01cb95" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fa00-001e-001f-1ce6-64eb66000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfaile1c580316f744bFri, 06 Sep 2019 19:09:18 GMT\"0x8D732FDB77A09B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "5b666533-5d97-41fb-8d02-1d492f01cb95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaile1c580316f744b?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" : "55af73f9-e0e8-4976-9cd0-1429faf5dff6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fa1c-001e-001f-34e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "55af73f9-e0e8-4976-9cd0-1429faf5dff6" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfaile1c580316f744b", "javablobcreateacfail1pageblobapitestcreateacfaile1c677610a4" ] +} \ 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..875d69ce4f38 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaild8b05159d4144e?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" : "5274b647-f6bd-4961-9504-9020f1522952" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB797D218\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fa33-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:17 GMT", + "x-ms-client-request-id" : "5274b647-f6bd-4961-9504-9020f1522952" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaild8b05159d4144e/javablobcreateacfail1pageblobapitestcreateacfaild8b916604f0", + "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" : "089cd1fe-d71d-4c68-b146-681c62c5759c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB79E6C35\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fa48-001e-001f-59e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "089cd1fe-d71d-4c68-b146-681c62c5759c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaild8b05159d4144e/javablobcreateacfail1pageblobapitestcreateacfaild8b916604f0", + "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" : "137849dd-ed49-4d20-bc45-747e32d0d0ed" + }, + "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" : "ec65fa5d-001e-001f-6ce6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65fa5d-001e-001f-6ce6-64eb66000000\nTime:2019-09-06T19:09:18.5380271Z", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "137849dd-ed49-4d20-bc45-747e32d0d0ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9c86e9d0-8290-44f2-a3d2-1fc7416be681" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fa6f-001e-001f-7be6-64eb66000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfaild8b05159d4144eFri, 06 Sep 2019 19:09:18 GMT\"0x8D732FDB797D218\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "9c86e9d0-8290-44f2-a3d2-1fc7416be681", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfaild8b05159d4144e?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" : "bf26d43a-6df0-48d9-9b5d-8b8741b4c24f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fa7e-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "bf26d43a-6df0-48d9-9b5d-8b8741b4c24f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfaild8b05159d4144e", "javablobcreateacfail1pageblobapitestcreateacfaild8b916604f0" ] +} \ 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..d2b858c0eda6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb72541007be280?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" : "03451e3b-9024-4644-9ec7-5fa1f6e5650c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB7BB4114\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fa99-001e-001f-22e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "03451e3b-9024-4644-9ec7-5fa1f6e5650c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb72541007be280/javablobcreateacfail1pageblobapitestcreateacfailb7296856396", + "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" : "ab7b5a86-9e9b-4b90-b259-e29eb39d3779" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB7C22956\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fad9-001e-001f-58e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "ab7b5a86-9e9b-4b90-b259-e29eb39d3779" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb72541007be280/javablobcreateacfail1pageblobapitestcreateacfailb7296856396", + "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" : "9926a235-e5da-413e-9c24-2f140d31770e" + }, + "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" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:18 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" : "\"0x8D732FDB7C22956\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:18 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65faf5-001e-001f-71e6-64eb66000000", + "x-ms-client-request-id" : "9926a235-e5da-413e-9c24-2f140d31770e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb72541007be280/javablobcreateacfail1pageblobapitestcreateacfailb7296856396", + "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" : "a7983ad6-85d5-46dc-8b0f-4126a47f5857" + }, + "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" : "ec65fb14-001e-001f-0ee6-64eb66000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ec65fb14-001e-001f-0ee6-64eb66000000\nTime:2019-09-06T19:09:18.8072802Z", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "a7983ad6-85d5-46dc-8b0f-4126a47f5857", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7a4b7100-0460-495c-a351-fb86aff8956c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fb2f-001e-001f-29e6-64eb66000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfailb72541007be280Fri, 06 Sep 2019 19:09:18 GMT\"0x8D732FDB7BB4114\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "7a4b7100-0460-495c-a351-fb86aff8956c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb72541007be280?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" : "cf2a5f07-7d9e-4439-87c2-cc4b20f82f7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fb3e-001e-001f-35e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "cf2a5f07-7d9e-4439-87c2-cc4b20f82f7b" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfailb72541007be280", "javablobcreateacfail1pageblobapitestcreateacfailb7296856396" ] +} \ 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..9f349570c369 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail75029131d9b50c?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" : "f4024352-c098-42fc-9748-4f137fc2e91d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB7E01001\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fb52-001e-001f-46e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "f4024352-c098-42fc-9748-4f137fc2e91d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail75029131d9b50c/javablobcreateacfail1pageblobapitestcreateacfail75067363783", + "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" : "8a72ebc7-8595-42fb-ba84-b7ac3f1e359f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB7E5BF5C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fb6d-001e-001f-5ce6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "8a72ebc7-8595-42fb-ba84-b7ac3f1e359f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail75029131d9b50c/javablobcreateacfail1pageblobapitestcreateacfail75067363783?comp=lease", + "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" : "1194a253-bf98-4939-b170-2195fe4e8779" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB7E5BF5C\"", + "x-ms-lease-id" : "2955368f-d36b-4d12-aa50-ddd69d0f00bb", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fb7a-001e-001f-68e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "1194a253-bf98-4939-b170-2195fe4e8779" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail75029131d9b50c/javablobcreateacfail1pageblobapitestcreateacfail75067363783", + "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" : "6bb3306e-4cf3-43bf-b5c3-54cfca07c76b" + }, + "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" : "ec65fb8e-001e-001f-78e6-64eb66000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:ec65fb8e-001e-001f-78e6-64eb66000000\nTime:2019-09-06T19:09:19.0304897Z", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "6bb3306e-4cf3-43bf-b5c3-54cfca07c76b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9f30cc58-54d2-410e-a829-0b31ff0f1b3f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fb9f-001e-001f-07e6-64eb66000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail75029131d9b50cFri, 06 Sep 2019 19:09:18 GMT\"0x8D732FDB7E01001\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "9f30cc58-54d2-410e-a829-0b31ff0f1b3f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail75029131d9b50c?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" : "604c15e8-e3db-40ea-ab49-93496023665b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fbb3-001e-001f-1ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "604c15e8-e3db-40ea-ab49-93496023665b" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail75029131d9b50c", "javablobcreateacfail1pageblobapitestcreateacfail75067363783" ] +} \ 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..638dde1f5066 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull73a28333f7a28?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" : "ee89faa3-e5a5-47fb-a905-3e8443f99570" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5903A87\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f144-001e-001f-04e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "ee89faa3-e5a5-47fb-a905-3e8443f99570" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull73a28333f7a28/javablobcreateallnull1pageblobapitestcreateallnull73a3842965", + "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" : "a3352add-1e1e-4583-80e3-58fa6edb1e7a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5977265\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f16a-001e-001f-24e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "a3352add-1e1e-4583-80e3-58fa6edb1e7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull73a28333f7a28/javablobcreateallnull2pageblobapitestcreateallnull73a33836ed", + "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" : "2326638d-4fe3-4d21-94e1-fa814c100d09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB59D1912\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f18a-001e-001f-3fe6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "2326638d-4fe3-4d21-94e1-fa814c100d09" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9d6ccd3b-f093-4e50-a28a-ee3ddbb5cde9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f1b5-001e-001f-63e6-64eb66000000", + "Body" : "jtccreateallnulljtccreateallnull0pageblobapitestcreateallnull73a28333f7a28Fri, 06 Sep 2019 19:09:15 GMT\"0x8D732FDB5903A87\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "9d6ccd3b-f093-4e50-a28a-ee3ddbb5cde9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull73a28333f7a28?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" : "a9a1e5d7-0207-4bd6-82be-46222c2919e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f1cd-001e-001f-78e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "a9a1e5d7-0207-4bd6-82be-46222c2919e7" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateallnull0pageblobapitestcreateallnull73a28333f7a28", "javablobcreateallnull1pageblobapitestcreateallnull73a3842965", "javablobcreateallnull2pageblobapitestcreateallnull73a33836ed" ] +} \ 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..5cfad39ab9c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror5af51607da6ba42?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" : "79ef828e-c013-4a8a-831f-b96db79192eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8010D74\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fbd5-001e-001f-3be6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "79ef828e-c013-4a8a-831f-b96db79192eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror5af51607da6ba42/javablobcreateerror1pageblobapitestcreateerror5af06598f368", + "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" : "b4b07a83-7817-4496-80fb-4337e55c7225" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8070AE4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fbfd-001e-001f-5ce6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "b4b07a83-7817-4496-80fb-4337e55c7225" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror5af51607da6ba42/javablobcreateerror1pageblobapitestcreateerror5af06598f368", + "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" : "24ba29ff-ce62-41cc-b161-fc06745dd2f0" + }, + "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" : "ec65fc19-001e-001f-74e6-64eb66000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ec65fc19-001e-001f-74e6-64eb66000000\nTime:2019-09-06T19:09:19.2106594Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "24ba29ff-ce62-41cc-b161-fc06745dd2f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4d85cda3-5ff1-4779-b505-8c86b9d2ceec" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fc28-001e-001f-02e6-64eb66000000", + "Body" : "jtccreateerrorjtccreateerror0pageblobapitestcreateerror5af51607da6ba42Fri, 06 Sep 2019 19:09:19 GMT\"0x8D732FDB8010D74\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "4d85cda3-5ff1-4779-b505-8c86b9d2ceec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror5af51607da6ba42?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" : "a7a22b19-57c5-4205-92b4-279e91b834aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fc36-001e-001f-0de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "a7a22b19-57c5-4205-92b4-279e91b834aa" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0pageblobapitestcreateerror5af51607da6ba42", "javablobcreateerror1pageblobapitestcreateerror5af06598f368" ] +} \ 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..77c3ea608a67 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1?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" : "2aa39718-2de6-44b3-9eaa-34be7fa3d027" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5EFD6A4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f314-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "2aa39718-2de6-44b3-9eaa-34be7fa3d027" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1/javablobcreateheaders1pageblobapitestcreateheadersf1e10546db", + "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" : "dae1565e-b1f3-4611-aeb1-b78bcada762f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5F5FCB1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f32f-001e-001f-1ae6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "dae1565e-b1f3-4611-aeb1-b78bcada762f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1/javablobcreateheaders1pageblobapitestcreateheadersf1e10546db", + "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" : "ee695363-4db1-4841-a11e-ce5641e1da7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5FD9FA4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f351-001e-001f-38e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "ee695363-4db1-4841-a11e-ce5641e1da7c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1/javablobcreateheaders1pageblobapitestcreateheadersf1e10546db", + "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" : "831070be-82a7-41c4-b341-e176315ac453" + }, + "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" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:15 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" : "\"0x8D732FDB5FD9FA4\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:15 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65f368-001e-001f-4ce6-64eb66000000", + "x-ms-client-request-id" : "831070be-82a7-41c4-b341-e176315ac453", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c04f27ac-f2b9-4487-8641-2b442d95d8f9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f37d-001e-001f-5fe6-64eb66000000", + "Body" : "jtccreateheadersjtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1Fri, 06 Sep 2019 19:09:15 GMT\"0x8D732FDB5EFD6A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "c04f27ac-f2b9-4487-8641-2b442d95d8f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1?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" : "624a8fc3-7132-41de-89cd-7cb7b50eba71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f38d-001e-001f-6ee6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "624a8fc3-7132-41de-89cd-7cb7b50eba71" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0pageblobapitestcreateheadersf1e97590fb6c1", "javablobcreateheaders1pageblobapitestcreateheadersf1e10546db" ] +} \ 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..3a93f0bba87b --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders17689723559b9?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" : "18e7c942-db56-4b4c-becf-0af65dc3e9e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB619FE03\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f3aa-001e-001f-06e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "18e7c942-db56-4b4c-becf-0af65dc3e9e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders17689723559b9/javablobcreateheaders1pageblobapitestcreateheaders1761645073", + "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" : "593ae38b-eaac-4eff-a406-9fef0c066213" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB622204D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f3db-001e-001f-31e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "593ae38b-eaac-4eff-a406-9fef0c066213" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders17689723559b9/javablobcreateheaders1pageblobapitestcreateheaders1761645073", + "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" : "f0946618-127a-45c1-979f-13ad54c57d9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6283C3C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f3f0-001e-001f-44e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "f0946618-127a-45c1-979f-13ad54c57d9f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders17689723559b9/javablobcreateheaders1pageblobapitestcreateheaders1761645073", + "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" : "c1614126-bc4f-44e8-8146-a58dd07ec5c5" + }, + "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" : "Fri, 06 Sep 2019 19:09:16 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" : "Fri, 06 Sep 2019 19:09:16 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65f40e-001e-001f-62e6-64eb66000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-blob-sequence-number" : "0", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D732FDB6283C3C\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "c1614126-bc4f-44e8-8146-a58dd07ec5c5", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2d1fe082-bc78-4b43-891d-253d6296a948" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f423-001e-001f-75e6-64eb66000000", + "Body" : "jtccreateheadersjtccreateheaders0pageblobapitestcreateheaders17689723559b9Fri, 06 Sep 2019 19:09:15 GMT\"0x8D732FDB619FE03\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "2d1fe082-bc78-4b43-891d-253d6296a948", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders17689723559b9?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" : "f764e6e5-64e9-4a4f-8036-0f347b587ae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f439-001e-001f-09e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "f764e6e5-64e9-4a4f-8036-0f347b587ae2" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0pageblobapitestcreateheaders17689723559b9", "javablobcreateheaders1pageblobapitestcreateheaders1761645073" ] +} \ 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..c1d6b6fe22d6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatae9012229f0fe?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" : "cc7256d1-5688-46ea-9d70-4d10cc8530eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB642291E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f45a-001e-001f-24e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "cc7256d1-5688-46ea-9d70-4d10cc8530eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatae9012229f0fe/javablobcreatemetadata1pageblobapitestcreatemetadatae90070540", + "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" : "c6b01e88-53a7-4158-91b5-3fb00338d923" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB64827DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f46c-001e-001f-35e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "c6b01e88-53a7-4158-91b5-3fb00338d923" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatae9012229f0fe/javablobcreatemetadata1pageblobapitestcreatemetadatae90070540", + "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" : "f9f6553c-751c-4ca4-8b4e-fa82757826be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB64D0B1A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f486-001e-001f-4be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "f9f6553c-751c-4ca4-8b4e-fa82757826be" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatae9012229f0fe/javablobcreatemetadata1pageblobapitestcreatemetadatae90070540", + "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" : "2c6817b2-8127-4cf2-aa9b-288244cae105" + }, + "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" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:15 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" : "\"0x8D732FDB64D0B1A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:16 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65f496-001e-001f-58e6-64eb66000000", + "x-ms-client-request-id" : "2c6817b2-8127-4cf2-aa9b-288244cae105", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "be545879-086e-4926-a753-c7427bcaa18d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f4ae-001e-001f-6ee6-64eb66000000", + "Body" : "jtccreatemetadatajtccreatemetadata0pageblobapitestcreatemetadatae9012229f0feFri, 06 Sep 2019 19:09:16 GMT\"0x8D732FDB642291E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "be545879-086e-4926-a753-c7427bcaa18d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatae9012229f0fe?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" : "3b21496c-eb35-49ea-aa64-a7b61080537d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f4c5-001e-001f-02e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "3b21496c-eb35-49ea-aa64-a7b61080537d" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0pageblobapitestcreatemetadatae9012229f0fe", "javablobcreatemetadata1pageblobapitestcreatemetadatae90070540" ] +} \ 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..e19fd4c85a4c --- /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://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata22789943c009?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" : "0fe5d8d7-489e-4583-81ec-1a2fcc19dacf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6657103\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f4e2-001e-001f-1ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "0fe5d8d7-489e-4583-81ec-1a2fcc19dacf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata22789943c009/javablobcreatemetadata1pageblobapitestcreatemetadata227796993", + "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" : "7a073e3f-6cc5-493e-af54-14d008b6fa66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB66B217F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f4f8-001e-001f-2fe6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "7a073e3f-6cc5-493e-af54-14d008b6fa66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata22789943c009/javablobcreatemetadata1pageblobapitestcreatemetadata227796993", + "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" : "2189c262-31c1-465b-be6f-6aaf7c88b60c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB6711657\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f512-001e-001f-45e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "2189c262-31c1-465b-be6f-6aaf7c88b60c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata22789943c009/javablobcreatemetadata1pageblobapitestcreatemetadata227796993", + "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" : "4c5108fc-53e1-4563-a8ba-e9ade8ecd69c" + }, + "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" : "Fri, 06 Sep 2019 19:09:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:16 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" : "\"0x8D732FDB6711657\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:16 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65f52d-001e-001f-5be6-64eb66000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "4c5108fc-53e1-4563-a8ba-e9ade8ecd69c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "38e85732-262b-43c0-9af5-46a8fe2f4282" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f544-001e-001f-71e6-64eb66000000", + "Body" : "jtccreatemetadatajtccreatemetadata0pageblobapitestcreatemetadata22789943c009Fri, 06 Sep 2019 19:09:16 GMT\"0x8D732FDB6657103\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "38e85732-262b-43c0-9af5-46a8fe2f4282", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata22789943c009?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" : "3d8049f4-f0cf-4469-bf89-9c3634cbd8a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f557-001e-001f-02e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:16 GMT", + "x-ms-client-request-id" : "3d8049f4-f0cf-4469-bf89-9c3634cbd8a0" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0pageblobapitestcreatemetadata22789943c009", "javablobcreatemetadata1pageblobapitestcreatemetadata227796993" ] +} \ 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..ba2ed611fbba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin84d17737b895a76c8?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" : "c4910359-2b61-4dd3-a934-cb1ace83254d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5B18628\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f1e4-001e-001f-0de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "c4910359-2b61-4dd3-a934-cb1ace83254d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin84d17737b895a76c8/javablobcreatemin1pageblobapitestcreatemin84d145209eb6db", + "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" : "0e636d69-2c7b-427f-b8e2-211255afb92d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5B86FC8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f20a-001e-001f-26e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "0e636d69-2c7b-427f-b8e2-211255afb92d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin84d17737b895a76c8/javablobcreatemin1pageblobapitestcreatemin84d145209eb6db", + "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" : "38e6768e-6a68-43af-8d8e-557bc589182b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5BDA12B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f233-001e-001f-48e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "38e6768e-6a68-43af-8d8e-557bc589182b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fc35d9ae-5ec3-4124-94d5-edd442a18d43" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f251-001e-001f-5fe6-64eb66000000", + "Body" : "jtccreateminjtccreatemin0pageblobapitestcreatemin84d17737b895a76c8Fri, 06 Sep 2019 19:09:15 GMT\"0x8D732FDB5B18628\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "fc35d9ae-5ec3-4124-94d5-edd442a18d43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin84d17737b895a76c8?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" : "5723c58c-0774-477b-9d8d-28b32dafe4ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f266-001e-001f-72e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "5723c58c-0774-477b-9d8d-28b32dafe4ca" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0pageblobapitestcreatemin84d17737b895a76c8", "javablobcreatemin1pageblobapitestcreatemin84d145209eb6db" ] +} \ 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..9e1bce896b81 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber04287482d6ec9fa1854d648?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" : "008f7176-4777-40c1-a308-a8faf35393fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5CEB215\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f286-001e-001f-0de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "008f7176-4777-40c1-a308-a8faf35393fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber04287482d6ec9fa1854d648/javablobcreatesequencenumber1419583df91925be7f4a", + "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" : "d3c69bc3-f76e-4170-92ab-33174805a970" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5D4D837\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f2a9-001e-001f-28e6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:14 GMT", + "x-ms-client-request-id" : "d3c69bc3-f76e-4170-92ab-33174805a970" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber04287482d6ec9fa1854d648/javablobcreatesequencenumber1419583df91925be7f4a", + "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" : "688c0b4d-3798-47fa-92fa-3c284e0533bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB5DA098C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65f2bf-001e-001f-3ce6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "688c0b4d-3798-47fa-92fa-3c284e0533bf" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber04287482d6ec9fa1854d648/javablobcreatesequencenumber1419583df91925be7f4a", + "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" : "66e5b1a9-d5d3-4a11-8b40-39778cf41819" + }, + "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" : "Fri, 06 Sep 2019 19:09:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:15 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" : "\"0x8D732FDB5DA098C\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:15 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ec65f2cd-001e-001f-4ae6-64eb66000000", + "x-ms-client-request-id" : "66e5b1a9-d5d3-4a11-8b40-39778cf41819", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2114a1a1-faad-4604-ad62-4f6bad24eef2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65f2e2-001e-001f-5ce6-64eb66000000", + "Body" : "jtccreatesequencenumberjtccreatesequencenumber04287482d6ec9fa1854d648Fri, 06 Sep 2019 19:09:15 GMT\"0x8D732FDB5CEB215\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "2114a1a1-faad-4604-ad62-4f6bad24eef2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber04287482d6ec9fa1854d648?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" : "a0db02a0-8587-43cc-b342-9cd7e1997a36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65f2f3-001e-001f-6ce6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:15 GMT", + "x-ms-client-request-id" : "a0db02a0-8587-43cc-b342-9cd7e1997a36" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatesequencenumber04287482d6ec9fa1854d648", "javablobcreatesequencenumber1419583df91925be7f4a" ] +} \ 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..2e0a1b561fa6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesebd914526be71?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" : "9045193f-50cb-4ed4-940e-4f36ede88437" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC79A38FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7611f4-401e-003a-04e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "9045193f-50cb-4ed4-940e-4f36ede88437" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesebd914526be71/javablobgetpageranges1pageblobapitestgetpagerangesebd8140182", + "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" : "ef40a66c-819c-4880-986f-70281c80b767" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7A05015\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761208-401e-003a-15e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "ef40a66c-819c-4880-986f-70281c80b767" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesebd914526be71/javablobgetpageranges1pageblobapitestgetpagerangesebd8140182?comp=page", + "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" : "cc85099e-30f7-47e3-ac66-cb0722a319ba", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "KJNBVjcEvgI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "ETag" : "\"0x8D732FDC7A6E14E\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f761215-401e-003a-21e6-6473d5000000", + "x-ms-client-request-id" : "cc85099e-30f7-47e3-ac66-cb0722a319ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesebd914526be71/javablobgetpageranges1pageblobapitestgetpagerangesebd8140182?comp=pagelist", + "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" : "21b7dcfd-d6c5-4d92-afb8-7ddb14951987" + }, + "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" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "ETag" : "\"0x8D732FDC7A6E14E\"", + "x-ms-request-id" : "8f76122d-401e-003a-36e6-6473d5000000", + "Body" : "0511", + "x-ms-client-request-id" : "21b7dcfd-d6c5-4d92-afb8-7ddb14951987", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eaa5e234-92ac-4da1-bbc7-6fcc48329296" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761240-401e-003a-45e6-6473d5000000", + "Body" : "jtcgetpagerangesjtcgetpageranges0pageblobapitestgetpagerangesebd914526be71Fri, 06 Sep 2019 19:09:45 GMT\"0x8D732FDC79A38FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "eaa5e234-92ac-4da1-bbc7-6fcc48329296", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesebd914526be71?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" : "37b21049-a633-466f-a27f-c489f6636e91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761253-401e-003a-53e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "37b21049-a633-466f-a27f-c489f6636e91" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpageranges0pageblobapitestgetpagerangesebd914526be71", "javablobgetpageranges1pageblobapitestgetpagerangesebd8140182", "641da1d5-b70b-4a1c-ab87-cee880977102" ] +} \ 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..899458190e8d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac12603262a0c?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" : "a1503d02-ad79-4c98-aaef-c9626dddd217" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7E18C84\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7612b7-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "a1503d02-ad79-4c98-aaef-c9626dddd217" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac12603262a0c/javablobgetpagerangesac1pageblobapitestgetpagerangesac12622680", + "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" : "78307750-e06d-47ff-b525-2008dd97f3f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7F030B7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7612df-401e-003a-48e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "78307750-e06d-47ff-b525-2008dd97f3f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac12603262a0c/javablobgetpagerangesac1pageblobapitestgetpagerangesac12622680?comp=pagelist", + "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" : "b49baa95-3a70-4fda-a674-27b04b101468" + }, + "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" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "ETag" : "\"0x8D732FDC7F030B7\"", + "x-ms-request-id" : "8f7612e3-401e-003a-4ce6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "b49baa95-3a70-4fda-a674-27b04b101468", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3c0e4ed2-8500-4198-9f3f-83dd09a3bac5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7612f0-401e-003a-58e6-6473d5000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac12603262a0cFri, 06 Sep 2019 19:09:45 GMT\"0x8D732FDC7E18C84\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "3c0e4ed2-8500-4198-9f3f-83dd09a3bac5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac12603262a0c?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" : "f252b3bd-ecab-4571-bebf-4555fbde7658" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761304-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "f252b3bd-ecab-4571-bebf-4555fbde7658" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac12603262a0c", "javablobgetpagerangesac1pageblobapitestgetpagerangesac12622680" ] +} \ 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..f2442bd1efba --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac18b122370ad?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" : "d911023e-a82a-47e6-954a-88817ef8b3e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC808F441\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76130e-401e-003a-74e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "d911023e-a82a-47e6-954a-88817ef8b3e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac18b122370ad/javablobgetpagerangesac1pageblobapitestgetpagerangesac18b61455", + "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" : "c7f94c6b-b1b0-4f8a-af84-5182d51dce70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC80F31C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76131d-401e-003a-01e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "c7f94c6b-b1b0-4f8a-af84-5182d51dce70" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac18b122370ad/javablobgetpagerangesac1pageblobapitestgetpagerangesac18b61455?comp=pagelist", + "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" : "68f74542-2b7a-4540-9556-f8bfbf9c6889" + }, + "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" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "ETag" : "\"0x8D732FDC80F31C6\"", + "x-ms-request-id" : "8f76134a-401e-003a-24e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "68f74542-2b7a-4540-9556-f8bfbf9c6889", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "64cff76c-799c-4785-b0ce-5f3dc870d293" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761364-401e-003a-3ce6-6473d5000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac18b122370adFri, 06 Sep 2019 19:09:46 GMT\"0x8D732FDC808F441\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "64cff76c-799c-4785-b0ce-5f3dc870d293", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac18b122370ad?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" : "626227dd-c58f-4d84-9def-456f319c45e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76137e-401e-003a-53e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "626227dd-c58f-4d84-9def-456f319c45e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac18b122370ad", "javablobgetpagerangesac1pageblobapitestgetpagerangesac18b61455" ] +} \ 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..199f56b3dfc1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac8c294297e1d?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" : "350f597f-8452-4a7b-80a9-762a506ee0f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC8264766\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76139c-401e-003a-6fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "350f597f-8452-4a7b-80a9-762a506ee0f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac8c294297e1d/javablobgetpagerangesac1pageblobapitestgetpagerangesac8c215854", + "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" : "c5f9c045-5825-4fd2-a312-5b2e4b6c6661" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC82C0F7D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7613ad-401e-003a-7ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "c5f9c045-5825-4fd2-a312-5b2e4b6c6661" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac8c294297e1d/javablobgetpagerangesac1pageblobapitestgetpagerangesac8c215854?comp=pagelist", + "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" : "7468dda4-06ce-4782-8c1f-a0ac9e959346" + }, + "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" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "ETag" : "\"0x8D732FDC82C0F7D\"", + "x-ms-request-id" : "8f7613bd-401e-003a-0be6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "7468dda4-06ce-4782-8c1f-a0ac9e959346", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f5f22ab6-a4d6-44a4-9151-ad28799d55e2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7613ca-401e-003a-17e6-6473d5000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac8c294297e1dFri, 06 Sep 2019 19:09:46 GMT\"0x8D732FDC8264766\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "f5f22ab6-a4d6-44a4-9151-ad28799d55e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac8c294297e1d?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" : "9503e8d6-8a74-4c08-9645-79619eef524c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7613d3-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "9503e8d6-8a74-4c08-9645-79619eef524c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac8c294297e1d", "javablobgetpagerangesac1pageblobapitestgetpagerangesac8c215854" ] +} \ 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..686cca6d8cca --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738a?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" : "577edca8-9f82-4841-89a9-f69bd8b2deff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC843253B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7613e4-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "577edca8-9f82-4841-89a9-f69bd8b2deff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738a/javablobgetpagerangesac1pageblobapitestgetpagerangesaceee59616", + "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" : "2206dd13-902b-4729-a6b1-e14bb7142834" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC84877D7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7613ed-401e-003a-35e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "2206dd13-902b-4729-a6b1-e14bb7142834" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738a/javablobgetpagerangesac1pageblobapitestgetpagerangesaceee59616", + "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" : "97d83e40-b262-4b95-a8f6-fdb306360b67" + }, + "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" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:45 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" : "\"0x8D732FDC84877D7\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:46 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7613f9-401e-003a-40e6-6473d5000000", + "x-ms-client-request-id" : "97d83e40-b262-4b95-a8f6-fdb306360b67", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738a/javablobgetpagerangesac1pageblobapitestgetpagerangesaceee59616?comp=pagelist", + "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" : "9feeb9cb-3068-4386-94bf-8430e51dee17" + }, + "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" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "ETag" : "\"0x8D732FDC84877D7\"", + "x-ms-request-id" : "8f761409-401e-003a-4de6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "9feeb9cb-3068-4386-94bf-8430e51dee17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eee1af40-39fb-46cd-89ff-99e766862bfe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76141e-401e-003a-5de6-6473d5000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738aFri, 06 Sep 2019 19:09:46 GMT\"0x8D732FDC843253B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "eee1af40-39fb-46cd-89ff-99e766862bfe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738a?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" : "ddd04ab0-e1e1-453e-9d4c-0b5eb220907c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76142e-401e-003a-6ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "ddd04ab0-e1e1-453e-9d4c-0b5eb220907c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesaceee3609738a", "javablobgetpagerangesac1pageblobapitestgetpagerangesaceee59616" ] +} \ 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..d6aa4817e710 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac15e36823854?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" : "cd889216-5a78-4182-9a1b-24a9d86745d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC863382B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76144f-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "cd889216-5a78-4182-9a1b-24a9d86745d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac15e36823854/javablobgetpagerangesac1pageblobapitestgetpagerangesac15e10926", + "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" : "d11432a1-c187-4720-befd-6a2894a2a3fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC86C34F4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761463-401e-003a-16e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "d11432a1-c187-4720-befd-6a2894a2a3fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac15e36823854/javablobgetpagerangesac1pageblobapitestgetpagerangesac15e10926?comp=pagelist", + "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" : "eef81ff9-a299-4b5e-a9b2-2abd7007b8af" + }, + "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" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "ETag" : "\"0x8D732FDC86C34F4\"", + "x-ms-request-id" : "8f761472-401e-003a-24e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "eef81ff9-a299-4b5e-a9b2-2abd7007b8af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e870b934-7282-4ba1-8927-68cd6d0a61c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76147e-401e-003a-2fe6-6473d5000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac15e36823854Fri, 06 Sep 2019 19:09:46 GMT\"0x8D732FDC863382B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "e870b934-7282-4ba1-8927-68cd6d0a61c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac15e36823854?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" : "926e5893-8840-476a-8e6d-b8cdcaf2ba2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76148c-401e-003a-3be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "926e5893-8840-476a-8e6d-b8cdcaf2ba2c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac15e36823854", "javablobgetpagerangesac1pageblobapitestgetpagerangesac15e10926" ] +} \ 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..4f7dd9e72c2e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3?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" : "9c953971-48f1-4a96-b7ba-bb4f045e57d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC883994E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76149b-401e-003a-48e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "9c953971-48f1-4a96-b7ba-bb4f045e57d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3/javablobgetpagerangesac1pageblobapitestgetpagerangesac9ca98065", + "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" : "6d8cb4cc-5ff1-47b8-878c-d00e3d5ec8a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC88987F4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7614ad-401e-003a-58e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:45 GMT", + "x-ms-client-request-id" : "6d8cb4cc-5ff1-47b8-878c-d00e3d5ec8a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3/javablobgetpagerangesac1pageblobapitestgetpagerangesac9ca98065?comp=lease", + "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" : "9aa84d4b-5aa9-4eb3-9251-a043ce2506b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC88987F4\"", + "x-ms-lease-id" : "d2767ec8-018f-4cfb-aff6-96a5be89922a", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7614c5-401e-003a-6ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "9aa84d4b-5aa9-4eb3-9251-a043ce2506b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3/javablobgetpagerangesac1pageblobapitestgetpagerangesac9ca98065?comp=pagelist", + "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" : "80e0a6ec-7c77-44ca-98b2-6eb89c862213" + }, + "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" : "Fri, 06 Sep 2019 19:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "ETag" : "\"0x8D732FDC88987F4\"", + "x-ms-request-id" : "8f7614d6-401e-003a-79e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "80e0a6ec-7c77-44ca-98b2-6eb89c862213", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2627cab-ae8a-41cd-a37a-436a05c0abc6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7614e3-401e-003a-06e6-6473d5000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3Fri, 06 Sep 2019 19:09:46 GMT\"0x8D732FDC883994E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "d2627cab-ae8a-41cd-a37a-436a05c0abc6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3?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" : "0849134c-51b7-41dd-96c7-9875cceb62a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7614ee-401e-003a-11e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "0849134c-51b7-41dd-96c7-9875cceb62a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac9ca066676d3", "javablobgetpagerangesac1pageblobapitestgetpagerangesac9ca98065" ] +} \ 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..338df083f37c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail08261159a4dd66c8a94fb29?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" : "31d38b8b-9c43-488f-941a-f96d482807f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC8A5816B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76150d-401e-003a-2ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "31d38b8b-9c43-488f-941a-f96d482807f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail08261159a4dd66c8a94fb29/javablobgetpagerangesacfail17105120556e003e424cc", + "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" : "5defaf0d-f635-4967-90ff-bd76010ecfc6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC8AB48C1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761527-401e-003a-40e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "5defaf0d-f635-4967-90ff-bd76010ecfc6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail08261159a4dd66c8a94fb29/javablobgetpagerangesacfail17105120556e003e424cc?comp=pagelist", + "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" : "b1924366-c1b9-4be5-8d1f-9de18179b3ba" + }, + "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" : "8f761532-401e-003a-4be6-6473d5000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "b1924366-c1b9-4be5-8d1f-9de18179b3ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1171d215-4fb8-4477-ab00-898f64db72d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761543-401e-003a-58e6-6473d5000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail08261159a4dd66c8a94fb29Fri, 06 Sep 2019 19:09:47 GMT\"0x8D732FDC8A5816B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "1171d215-4fb8-4477-ab00-898f64db72d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail08261159a4dd66c8a94fb29?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" : "b3f96911-9cfe-482d-8bb1-28acfbf5427a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761549-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "b3f96911-9cfe-482d-8bb1-28acfbf5427a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail08261159a4dd66c8a94fb29", "javablobgetpagerangesacfail17105120556e003e424cc" ] +} \ 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..4e66e102c922 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0251198ef089cc083441dea?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" : "dfa045d6-4ebe-4e50-b165-fe6569c9cbdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC8CB622A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761554-401e-003a-69e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "dfa045d6-4ebe-4e50-b165-fe6569c9cbdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0251198ef089cc083441dea/javablobgetpagerangesacfail1432138ea4b37d750c4f8", + "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" : "d263f4c9-62e4-4ac4-89da-865f293585f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC8DB64E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761590-401e-003a-1de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "d263f4c9-62e4-4ac4-89da-865f293585f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0251198ef089cc083441dea/javablobgetpagerangesacfail1432138ea4b37d750c4f8?comp=pagelist", + "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" : "f363e01b-b899-419c-9101-35c5384ff132" + }, + "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" : "8f7615a4-401e-003a-2ee6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f7615a4-401e-003a-2ee6-6473d5000000\nTime:2019-09-06T19:09:47.4502682Z", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "f363e01b-b899-419c-9101-35c5384ff132", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "591c03c8-d03b-4639-9f80-7512158b807d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7615b0-401e-003a-38e6-6473d5000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail0251198ef089cc083441deaFri, 06 Sep 2019 19:09:47 GMT\"0x8D732FDC8CB622A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "591c03c8-d03b-4639-9f80-7512158b807d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0251198ef089cc083441dea?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" : "d5003869-7cc3-48ac-9b6c-0b2d776cd167" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7615b4-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "d5003869-7cc3-48ac-9b6c-0b2d776cd167" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail0251198ef089cc083441dea", "javablobgetpagerangesacfail1432138ea4b37d750c4f8" ] +} \ 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..63f079bb5818 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail068461aa6845d198d54ec9a?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" : "d32f2014-59e3-4fb9-be98-bf111a9b33c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC8F82262\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7615c8-401e-003a-4ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "d32f2014-59e3-4fb9-be98-bf111a9b33c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail068461aa6845d198d54ec9a/javablobgetpagerangesacfail13898989f134721dfc40c", + "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" : "5a0c6219-023e-4f07-9b71-3c8976b2ba83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC909D2DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761606-401e-003a-03e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "5a0c6219-023e-4f07-9b71-3c8976b2ba83" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail068461aa6845d198d54ec9a/javablobgetpagerangesacfail13898989f134721dfc40c?comp=pagelist", + "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" : "5de360ba-5646-4fed-92b6-2181bb62cfed" + }, + "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" : "8f76160f-401e-003a-0ce6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f76160f-401e-003a-0ce6-6473d5000000\nTime:2019-09-06T19:09:47.7535575Z", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "5de360ba-5646-4fed-92b6-2181bb62cfed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7efe3c83-b98a-4bb7-a2c9-79a0c042b2de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761619-401e-003a-16e6-6473d5000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail068461aa6845d198d54ec9aFri, 06 Sep 2019 19:09:47 GMT\"0x8D732FDC8F82262\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "7efe3c83-b98a-4bb7-a2c9-79a0c042b2de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail068461aa6845d198d54ec9a?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" : "b7637618-e520-48cd-846c-797c31ca70de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76161f-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "b7637618-e520-48cd-846c-797c31ca70de" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail068461aa6845d198d54ec9a", "javablobgetpagerangesacfail13898989f134721dfc40c" ] +} \ 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..d8223c3eca61 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail015233c9c3ec03512c4114b?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" : "bd53515d-6530-426b-a199-108f22a6500a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC923D0E6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761635-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:46 GMT", + "x-ms-client-request-id" : "bd53515d-6530-426b-a199-108f22a6500a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail015233c9c3ec03512c4114b/javablobgetpagerangesacfail149210377bf1c40562468", + "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" : "e1b7bd50-429b-4534-8287-0e06ee387252" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC929BE8A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761655-401e-003a-47e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "e1b7bd50-429b-4534-8287-0e06ee387252" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail015233c9c3ec03512c4114b/javablobgetpagerangesacfail149210377bf1c40562468", + "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" : "169e9523-54c8-4eda-a90a-9c9140381754" + }, + "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" : "Fri, 06 Sep 2019 19:09:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:47 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" : "\"0x8D732FDC929BE8A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:47 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f761661-401e-003a-51e6-6473d5000000", + "x-ms-client-request-id" : "169e9523-54c8-4eda-a90a-9c9140381754", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail015233c9c3ec03512c4114b/javablobgetpagerangesacfail149210377bf1c40562468?comp=pagelist", + "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" : "10e7be13-82ec-41f5-b6bb-7cac6e842e48" + }, + "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" : "8f761671-401e-003a-5fe6-6473d5000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "10e7be13-82ec-41f5-b6bb-7cac6e842e48", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cc2bda3d-b01e-4a27-a88a-90a984d65131" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76167b-401e-003a-68e6-6473d5000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail015233c9c3ec03512c4114bFri, 06 Sep 2019 19:09:47 GMT\"0x8D732FDC923D0E6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "cc2bda3d-b01e-4a27-a88a-90a984d65131", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail015233c9c3ec03512c4114b?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" : "de8a9bd9-b9e0-4d49-83fa-7b0508a2ea18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76168f-401e-003a-7be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "de8a9bd9-b9e0-4d49-83fa-7b0508a2ea18" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail015233c9c3ec03512c4114b", "javablobgetpagerangesacfail149210377bf1c40562468" ] +} \ 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..b79ef1dc9f51 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0442992667d713cb7048858?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" : "54339395-d673-4865-84e5-88cdb0a37230" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC94718E7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7616a8-401e-003a-11e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "54339395-d673-4865-84e5-88cdb0a37230" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0442992667d713cb7048858/javablobgetpagerangesacfail192318476dcbe92fba445", + "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" : "97513d9a-71ba-4d41-9c85-462029f71a3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC94D7B9D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7616b8-401e-003a-19e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "97513d9a-71ba-4d41-9c85-462029f71a3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0442992667d713cb7048858/javablobgetpagerangesacfail192318476dcbe92fba445?comp=lease", + "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" : "f398c21c-1b4e-4643-98c8-54170f1496e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC94D7B9D\"", + "x-ms-lease-id" : "77121ad8-e70e-4677-aa56-077081866505", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7616c7-401e-003a-28e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "f398c21c-1b4e-4643-98c8-54170f1496e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0442992667d713cb7048858/javablobgetpagerangesacfail192318476dcbe92fba445?comp=pagelist", + "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" : "5fce1bca-a91d-461d-b59d-9ac20e39e4e8" + }, + "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" : "8f7616d7-401e-003a-34e6-6473d5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:8f7616d7-401e-003a-34e6-6473d5000000\nTime:2019-09-06T19:09:48.2350148Z", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "5fce1bca-a91d-461d-b59d-9ac20e39e4e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2ccae573-4289-4c68-84a0-6d3b06089c0b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7616e4-401e-003a-3fe6-6473d5000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail0442992667d713cb7048858Fri, 06 Sep 2019 19:09:48 GMT\"0x8D732FDC94718E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "2ccae573-4289-4c68-84a0-6d3b06089c0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0442992667d713cb7048858?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" : "bf9a9c99-a780-455f-8d29-6a98d4c13747" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7616f2-401e-003a-4be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "bf9a9c99-a780-455f-8d29-6a98d4c13747" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail0442992667d713cb7048858", "javablobgetpagerangesacfail192318476dcbe92fba445" ] +} \ 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..bf2f5ff6c7e4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f?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" : "b66e8877-29ea-49f1-9b66-fa337ea86732" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9834634\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761757-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "b66e8877-29ea-49f1-9b66-fa337ea86732" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8", + "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" : "7732c710-d8e3-4772-9d00-a6c7d8f09667" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC989A88C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761763-401e-003a-2be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "7732c710-d8e3-4772-9d00-a6c7d8f09667" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8", + "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" : "9f5f5593-d7a4-4812-98d4-cce4c144e111" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC98F764D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76177c-401e-003a-43e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "9f5f5593-d7a4-4812-98d4-cce4c144e111" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8?comp=page", + "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" : "e2a01d75-1055-4d3b-9df6-5e2560ee304a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "HLRRydkh7Zo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "ETag" : "\"0x8D732FDC99655BD\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76178c-401e-003a-52e6-6473d5000000", + "x-ms-client-request-id" : "e2a01d75-1055-4d3b-9df6-5e2560ee304a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8?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", + "x-ms-client-request-id" : "0c4e8045-cbda-4b8a-8023-bdcfef6b63ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:48.6812368Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC99655BD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76179c-401e-003a-5ee6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "0c4e8045-cbda-4b8a-8023-bdcfef6b63ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8?comp=page", + "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" : "846eb7fe-ed38-4fc8-b074-7a039a4353a2", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "SyIgnuzYMXw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "ETag" : "\"0x8D732FDC9A302F2\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7617ae-401e-003a-6ee6-6473d5000000", + "x-ms-client-request-id" : "846eb7fe-ed38-4fc8-b074-7a039a4353a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8?comp=page", + "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" : "e64b4ceb-bd69-4a03-910d-7856ad037deb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9A8D0BC\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7617b8-401e-003a-76e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "e64b4ceb-bd69-4a03-910d-7856ad037deb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f/javablobgetpagerangesdiff151123c2b1d52fa63044a8?prevsnapshot=2019-09-06T19%3a09%3a48.6812368Z&comp=pagelist", + "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" : "54151a4e-7e02-4982-afbc-c01660095580" + }, + "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" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "ETag" : "\"0x8D732FDC9A8D0BC\"", + "x-ms-request-id" : "8f7617cd-401e-003a-09e6-6473d5000000", + "Body" : "05115121023", + "x-ms-client-request-id" : "54151a4e-7e02-4982-afbc-c01660095580", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc57cbfe-7f92-4453-835d-aa693cbe8d74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7617dd-401e-003a-17e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffjtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059fFri, 06 Sep 2019 19:09:48 GMT\"0x8D732FDC9834634\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "bc57cbfe-7f92-4453-835d-aa693cbe8d74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f?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" : "330e6373-5427-4d72-b00f-809632da92d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7617ed-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "330e6373-5427-4d72-b00f-809632da92d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff3c744059f", "javablobgetpagerangesdiff151123c2b1d52fa63044a8", "bad4c944-3feb-4127-9f87-f96c04db1eff", "ebbc8c3f-a970-4164-84b0-645630e62095" ] +} \ 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..8d1d39d5f72d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac078763998013cba7f54946a?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" : "43f2feb6-93b1-4c41-bced-cafd5d52def6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9F33A4F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761899-401e-003a-3be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "43f2feb6-93b1-4c41-bced-cafd5d52def6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac078763998013cba7f54946a/javablobgetpagerangesdiffac109162ff83cfa36bb84c3", + "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" : "acc0f79c-ac88-4381-b5a2-5cd8979b7c39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9F94DB9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7618ae-401e-003a-4ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "acc0f79c-ac88-4381-b5a2-5cd8979b7c39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac078763998013cba7f54946a/javablobgetpagerangesdiffac109162ff83cfa36bb84c3?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", + "x-ms-client-request-id" : "03af35a7-d3db-47bf-b97e-21c78edc82dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:49.3248360Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9F94DB9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7618bb-401e-003a-57e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "03af35a7-d3db-47bf-b97e-21c78edc82dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac078763998013cba7f54946a/javablobgetpagerangesdiffac109162ff83cfa36bb84c3?prevsnapshot=2019-09-06T19%3a09%3a49.3248360Z&comp=pagelist", + "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" : "99a530e7-40f0-417e-889c-9df13923d8e5" + }, + "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" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "ETag" : "\"0x8D732FDC9F94DB9\"", + "x-ms-request-id" : "8f7618c5-401e-003a-60e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "99a530e7-40f0-417e-889c-9df13923d8e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bca6c2cd-27c4-4f79-b130-05617dc48b95" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7618d1-401e-003a-69e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac078763998013cba7f54946aFri, 06 Sep 2019 19:09:49 GMT\"0x8D732FDC9F33A4F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "bca6c2cd-27c4-4f79-b130-05617dc48b95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac078763998013cba7f54946a?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" : "7ac725d0-0d41-4334-85fd-55504cbb97a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7618d9-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "7ac725d0-0d41-4334-85fd-55504cbb97a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac078763998013cba7f54946a", "javablobgetpagerangesdiffac109162ff83cfa36bb84c3" ] +} \ 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..9ab9685eded6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac027819ba5889726151473fb?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" : "36c00af6-26b2-4a9b-8558-1edbb304b784" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA148602\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7618f5-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "36c00af6-26b2-4a9b-8558-1edbb304b784" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac027819ba5889726151473fb/javablobgetpagerangesdiffac16476825c64cff9b87406", + "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" : "dbfb017f-5f75-4f22-b066-37ef60357dfb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA1A23FC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761913-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "dbfb017f-5f75-4f22-b066-37ef60357dfb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac027819ba5889726151473fb/javablobgetpagerangesdiffac16476825c64cff9b87406?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", + "x-ms-client-request-id" : "973882d2-b4cd-445a-912d-f285b4686421" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:49.5440363Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA1A23FC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761924-401e-003a-33e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "973882d2-b4cd-445a-912d-f285b4686421" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac027819ba5889726151473fb/javablobgetpagerangesdiffac16476825c64cff9b87406?prevsnapshot=2019-09-06T19%3a09%3a49.5440363Z&comp=pagelist", + "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" : "ac0ac179-aff8-46b8-b121-b71d0961103f" + }, + "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" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "ETag" : "\"0x8D732FDCA1A23FC\"", + "x-ms-request-id" : "8f76193d-401e-003a-48e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "ac0ac179-aff8-46b8-b121-b71d0961103f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eedc9902-0253-4192-8a92-5591f802905f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761949-401e-003a-53e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac027819ba5889726151473fbFri, 06 Sep 2019 19:09:49 GMT\"0x8D732FDCA148602\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "eedc9902-0253-4192-8a92-5591f802905f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac027819ba5889726151473fb?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" : "e7d1e8f1-400b-45df-ac2e-fda29355f3e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761964-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "e7d1e8f1-400b-45df-ac2e-fda29355f3e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac027819ba5889726151473fb", "javablobgetpagerangesdiffac16476825c64cff9b87406" ] +} \ 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..95b2df189601 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac072211cfe1ac1e454b4dad8?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" : "92db24c9-b9ed-4a0d-a2e3-882a82ff6c2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA3E866F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761988-401e-003a-0ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "92db24c9-b9ed-4a0d-a2e3-882a82ff6c2e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac072211cfe1ac1e454b4dad8/javablobgetpagerangesdiffac115643021b39db4c1e4d9", + "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" : "0d6d4a0c-20d0-4868-b70a-6aefe850a23a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA51E303\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761a03-401e-003a-7de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "0d6d4a0c-20d0-4868-b70a-6aefe850a23a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac072211cfe1ac1e454b4dad8/javablobgetpagerangesdiffac115643021b39db4c1e4d9?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", + "x-ms-client-request-id" : "d728ae1b-3aa9-4999-bcea-e7ee202a50ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:49.9073741Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA51E303\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761a0f-401e-003a-09e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "d728ae1b-3aa9-4999-bcea-e7ee202a50ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac072211cfe1ac1e454b4dad8/javablobgetpagerangesdiffac115643021b39db4c1e4d9?prevsnapshot=2019-09-06T19%3a09%3a49.9073741Z&comp=pagelist", + "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" : "86e816d4-8c70-42bb-bca6-4752a8de6555" + }, + "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" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "ETag" : "\"0x8D732FDCA51E303\"", + "x-ms-request-id" : "8f761a25-401e-003a-19e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "86e816d4-8c70-42bb-bca6-4752a8de6555", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c33004c7-13ac-4c80-b86f-d347afa8a3eb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761a2d-401e-003a-21e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac072211cfe1ac1e454b4dad8Fri, 06 Sep 2019 19:09:49 GMT\"0x8D732FDCA3E866F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "c33004c7-13ac-4c80-b86f-d347afa8a3eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac072211cfe1ac1e454b4dad8?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" : "c5e02c5f-0d28-43ee-92e0-5a68a7efc193" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761a3c-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "c5e02c5f-0d28-43ee-92e0-5a68a7efc193" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac072211cfe1ac1e454b4dad8", "javablobgetpagerangesdiffac115643021b39db4c1e4d9" ] +} \ 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..0b502e79e814 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0422123eb322d640354cadb?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" : "7434bee2-fdf9-47c8-9011-74bd44a38f57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA7645D5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761a7e-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "7434bee2-fdf9-47c8-9011-74bd44a38f57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0422123eb322d640354cadb/javablobgetpagerangesdiffac1845068849118962a846e", + "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" : "bc44f189-056a-454f-b720-3c688cd0f86b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA7BBC1C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761a94-401e-003a-7be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "bc44f189-056a-454f-b720-3c688cd0f86b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0422123eb322d640354cadb/javablobgetpagerangesdiffac1845068849118962a846e?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", + "x-ms-client-request-id" : "0e01fa74-5e3f-4d79-8a0d-ee9657804e2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:50.1796262Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCA7BBC1C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761ab0-401e-003a-15e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "0e01fa74-5e3f-4d79-8a0d-ee9657804e2f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0422123eb322d640354cadb/javablobgetpagerangesdiffac1845068849118962a846e", + "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" : "824faa02-9716-48c6-b696-b08358ca75c5" + }, + "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" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:49 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" : "\"0x8D732FDCA7BBC1C\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:50 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f761ac5-401e-003a-25e6-6473d5000000", + "x-ms-client-request-id" : "824faa02-9716-48c6-b696-b08358ca75c5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0422123eb322d640354cadb/javablobgetpagerangesdiffac1845068849118962a846e?prevsnapshot=2019-09-06T19%3a09%3a50.1796262Z&comp=pagelist", + "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" : "984a8516-4245-4480-8fb9-c324abaae4fb" + }, + "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" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "ETag" : "\"0x8D732FDCA7BBC1C\"", + "x-ms-request-id" : "8f761acd-401e-003a-2de6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "984a8516-4245-4480-8fb9-c324abaae4fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "56836c34-0759-418d-8910-ee01962feb7c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761ae3-401e-003a-40e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0422123eb322d640354cadbFri, 06 Sep 2019 19:09:50 GMT\"0x8D732FDCA7645D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "56836c34-0759-418d-8910-ee01962feb7c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0422123eb322d640354cadb?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" : "d18c1f86-5ade-4f76-96cd-39b895affada" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761afb-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "d18c1f86-5ade-4f76-96cd-39b895affada" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0422123eb322d640354cadb", "javablobgetpagerangesdiffac1845068849118962a846e" ] +} \ 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..aef7496aa8fe --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00483181092a11846846fe9?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" : "21802016-3c2f-4d0f-906c-f1822b32f50b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCAA8ACC1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761b1f-401e-003a-76e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "21802016-3c2f-4d0f-906c-f1822b32f50b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00483181092a11846846fe9/javablobgetpagerangesdiffac163050ec17a56fcd4d4d5", + "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" : "2a23564d-a169-4d1f-a7b0-26796f420941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCABF8BFC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761b5d-401e-003a-2be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "2a23564d-a169-4d1f-a7b0-26796f420941" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00483181092a11846846fe9/javablobgetpagerangesdiffac163050ec17a56fcd4d4d5?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", + "x-ms-client-request-id" : "40fb839b-95b7-45af-94d0-050798bc5ee3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:50.6270410Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCABF8BFC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761b6e-401e-003a-3ae6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "40fb839b-95b7-45af-94d0-050798bc5ee3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00483181092a11846846fe9/javablobgetpagerangesdiffac163050ec17a56fcd4d4d5?prevsnapshot=2019-09-06T19%3a09%3a50.6270410Z&comp=pagelist", + "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" : "26e0f242-ae14-4732-9e74-6ebe0631ee33" + }, + "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" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "ETag" : "\"0x8D732FDCABF8BFC\"", + "x-ms-request-id" : "8f761b81-401e-003a-4de6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "26e0f242-ae14-4732-9e74-6ebe0631ee33", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7737e219-e169-4544-b194-2408cfc340d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761b86-401e-003a-51e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac00483181092a11846846fe9Fri, 06 Sep 2019 19:09:50 GMT\"0x8D732FDCAA8ACC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "7737e219-e169-4544-b194-2408cfc340d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00483181092a11846846fe9?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" : "3812d199-3f5c-49f0-9af4-6443fc5c99e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761b90-401e-003a-5be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "3812d199-3f5c-49f0-9af4-6443fc5c99e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac00483181092a11846846fe9", "javablobgetpagerangesdiffac163050ec17a56fcd4d4d5" ] +} \ 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..8a1d200a06a8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0178131a403e0adc204403a?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" : "f569a7c9-02fb-4c86-b0aa-eb470831ae60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCADF5A6D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761ba1-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "f569a7c9-02fb-4c86-b0aa-eb470831ae60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0178131a403e0adc204403a/javablobgetpagerangesdiffac193771cc318c762575479", + "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" : "7478a310-81db-46bd-8485-4896966ed0e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCAE62FE8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761bb4-401e-003a-78e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "7478a310-81db-46bd-8485-4896966ed0e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0178131a403e0adc204403a/javablobgetpagerangesdiffac193771cc318c762575479?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", + "x-ms-client-request-id" : "eacf7cf8-a4e6-4dd4-b366-04219b60d599" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:50.8802766Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCAE62FE8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761bc0-401e-003a-02e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:49 GMT", + "x-ms-client-request-id" : "eacf7cf8-a4e6-4dd4-b366-04219b60d599" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0178131a403e0adc204403a/javablobgetpagerangesdiffac193771cc318c762575479?comp=lease", + "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" : "9d185728-b675-49b1-81d8-d797900ce161" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCAE62FE8\"", + "x-ms-lease-id" : "c25e519a-5262-4d2e-ae7e-493038b3c63e", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761bd7-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "9d185728-b675-49b1-81d8-d797900ce161" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0178131a403e0adc204403a/javablobgetpagerangesdiffac193771cc318c762575479?prevsnapshot=2019-09-06T19%3a09%3a50.8802766Z&comp=pagelist", + "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" : "aba1b6c2-08fe-44c2-badb-ff8c1cdc6aeb" + }, + "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" : "Fri, 06 Sep 2019 19:09:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "ETag" : "\"0x8D732FDCAE62FE8\"", + "x-ms-request-id" : "8f761be5-401e-003a-24e6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "aba1b6c2-08fe-44c2-badb-ff8c1cdc6aeb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c4d9fe7c-e8b0-4da0-96b2-6e33fcddcf00" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761bf1-401e-003a-30e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0178131a403e0adc204403aFri, 06 Sep 2019 19:09:50 GMT\"0x8D732FDCADF5A6D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "c4d9fe7c-e8b0-4da0-96b2-6e33fcddcf00", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0178131a403e0adc204403a?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" : "34f3ca49-7fd6-4216-9c74-073c4240b8bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761c01-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "34f3ca49-7fd6-4216-9c74-073c4240b8bc" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0178131a403e0adc204403a", "javablobgetpagerangesdiffac193771cc318c762575479" ] +} \ 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..1206341b3753 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0698076d40e914342b4a3?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" : "bcb6db0d-8aba-4b1b-9308-39e39a0798e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB0B571F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761c28-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "bcb6db0d-8aba-4b1b-9308-39e39a0798e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0698076d40e914342b4a3/javablobgetpagerangesdiffacfail143561a9211a15cf7f4", + "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" : "7b5b84a6-b2d1-47a5-9368-5647098d378c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB11B71F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761c40-401e-003a-74e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "7b5b84a6-b2d1-47a5-9368-5647098d378c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0698076d40e914342b4a3/javablobgetpagerangesdiffacfail143561a9211a15cf7f4?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", + "x-ms-client-request-id" : "49747d87-1f3c-4af1-8344-70252cd19225" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:51.1625385Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB11B71F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761c50-401e-003a-03e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "49747d87-1f3c-4af1-8344-70252cd19225" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0698076d40e914342b4a3/javablobgetpagerangesdiffacfail143561a9211a15cf7f4?prevsnapshot=2019-09-06T19%3a09%3a51.1625385Z&comp=pagelist", + "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" : "46f5d804-1388-4619-92a9-a54965298aec" + }, + "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" : "8f761c5c-401e-003a-0ee6-6473d5000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "46f5d804-1388-4619-92a9-a54965298aec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18e6be02-538f-471a-9472-0a9418bc2012" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761c67-401e-003a-17e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail0698076d40e914342b4a3Fri, 06 Sep 2019 19:09:51 GMT\"0x8D732FDCB0B571F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "18e6be02-538f-471a-9472-0a9418bc2012", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0698076d40e914342b4a3?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" : "bcfa7ef6-5f78-402f-81fe-50992fac0037" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761c6c-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "bcfa7ef6-5f78-402f-81fe-50992fac0037" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail0698076d40e914342b4a3", "javablobgetpagerangesdiffacfail143561a9211a15cf7f4" ] +} \ 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..12abbdce860d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0773588c37b1be8fa04e9?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" : "d120c27a-fa8a-4bc4-9696-f0843d29c145" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB309B73\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761c81-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "d120c27a-fa8a-4bc4-9696-f0843d29c145" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0773588c37b1be8fa04e9/javablobgetpagerangesdiffacfail14236788fe86ea636a4", + "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" : "026bf22e-7921-4a72-875b-3e7b35d2fc98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB3CC8F0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761ca4-401e-003a-49e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "026bf22e-7921-4a72-875b-3e7b35d2fc98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0773588c37b1be8fa04e9/javablobgetpagerangesdiffacfail14236788fe86ea636a4?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", + "x-ms-client-request-id" : "533ca53d-c109-4b5d-b5c0-7f46874021a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:51.4437987Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB3CC8F0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761cae-401e-003a-51e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "533ca53d-c109-4b5d-b5c0-7f46874021a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0773588c37b1be8fa04e9/javablobgetpagerangesdiffacfail14236788fe86ea636a4?prevsnapshot=2019-09-06T19%3a09%3a51.4437987Z&comp=pagelist", + "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" : "36481239-8a9e-4bd3-95dc-2874d6cb7b8d" + }, + "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" : "8f761ccd-401e-003a-6be6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f761ccd-401e-003a-6be6-6473d5000000\nTime:2019-09-06T19:09:51.5071291Z", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "36481239-8a9e-4bd3-95dc-2874d6cb7b8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5397bf76-106d-4925-a778-242915d7e38d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761cd8-401e-003a-73e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail0773588c37b1be8fa04e9Fri, 06 Sep 2019 19:09:51 GMT\"0x8D732FDCB309B73\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "5397bf76-106d-4925-a778-242915d7e38d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0773588c37b1be8fa04e9?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" : "0508023b-c85a-4b47-96d0-76a3ec27208b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761ced-401e-003a-03e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "0508023b-c85a-4b47-96d0-76a3ec27208b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail0773588c37b1be8fa04e9", "javablobgetpagerangesdiffacfail14236788fe86ea636a4" ] +} \ 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..88ae7c8d7de5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail009144ca1701c7b8c14ae?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" : "c9ca5209-719c-4531-9417-8ea040117ca6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB5B112F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761cff-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "c9ca5209-719c-4531-9417-8ea040117ca6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail009144ca1701c7b8c14ae/javablobgetpagerangesdiffacfail122092d4c2579521054", + "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" : "4ff039d3-62f7-4e9a-91a0-da23067bf901" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB60FB57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761d07-401e-003a-18e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "4ff039d3-62f7-4e9a-91a0-da23067bf901" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail009144ca1701c7b8c14ae/javablobgetpagerangesdiffacfail122092d4c2579521054?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", + "x-ms-client-request-id" : "7eab3919-d68b-4fad-8951-56b23366f386" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:51.6820211Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB60FB57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761d0c-401e-003a-1de6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "7eab3919-d68b-4fad-8951-56b23366f386" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail009144ca1701c7b8c14ae/javablobgetpagerangesdiffacfail122092d4c2579521054?prevsnapshot=2019-09-06T19%3a09%3a51.6820211Z&comp=pagelist", + "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" : "cee99a5f-7fe3-4dcd-94a7-2179b55e3603" + }, + "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" : "8f761d19-401e-003a-29e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f761d19-401e-003a-29e6-6473d5000000\nTime:2019-09-06T19:09:51.7133244Z", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "cee99a5f-7fe3-4dcd-94a7-2179b55e3603", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0977fed5-5db5-463a-82ae-ea4828209c2b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761d28-401e-003a-36e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail009144ca1701c7b8c14aeFri, 06 Sep 2019 19:09:51 GMT\"0x8D732FDCB5B112F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "0977fed5-5db5-463a-82ae-ea4828209c2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail009144ca1701c7b8c14ae?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" : "8f29936b-ab31-49c3-97e0-26a2f6690ea8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761d31-401e-003a-3de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "8f29936b-ab31-49c3-97e0-26a2f6690ea8" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail009144ca1701c7b8c14ae", "javablobgetpagerangesdiffacfail122092d4c2579521054" ] +} \ 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..cd78159c57da --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0296156bb3310c85a4457?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" : "1738e863-04fc-4055-8121-8b5af22873e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB7AAED0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761d3b-401e-003a-46e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "1738e863-04fc-4055-8121-8b5af22873e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0296156bb3310c85a4457/javablobgetpagerangesdiffacfail1633087c9e2e4c46fa4", + "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" : "eda3304e-2ed3-4011-9eec-2d4b33c450f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB80E702\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761d49-401e-003a-52e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "eda3304e-2ed3-4011-9eec-2d4b33c450f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0296156bb3310c85a4457/javablobgetpagerangesdiffacfail1633087c9e2e4c46fa4?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", + "x-ms-client-request-id" : "c3273f0c-655c-4a69-a120-e1f801f8bf9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:51.8912140Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCB80E702\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761d60-401e-003a-65e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:50 GMT", + "x-ms-client-request-id" : "c3273f0c-655c-4a69-a120-e1f801f8bf9a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0296156bb3310c85a4457/javablobgetpagerangesdiffacfail1633087c9e2e4c46fa4", + "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" : "55fb1711-244b-4dc6-9daa-e8fbe8f6e2b3" + }, + "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" : "Fri, 06 Sep 2019 19:09:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:51 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" : "\"0x8D732FDCB80E702\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:51 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f761d72-401e-003a-71e6-6473d5000000", + "x-ms-client-request-id" : "55fb1711-244b-4dc6-9daa-e8fbe8f6e2b3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0296156bb3310c85a4457/javablobgetpagerangesdiffacfail1633087c9e2e4c46fa4?prevsnapshot=2019-09-06T19%3a09%3a51.8912140Z&comp=pagelist", + "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" : "b18e7895-8199-4c67-8caa-cec632f9075c" + }, + "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" : "8f761d7b-401e-003a-7ae6-6473d5000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "b18e7895-8199-4c67-8caa-cec632f9075c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e801f4bb-208f-4f29-aae0-d07fb1b7bd8d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761d86-401e-003a-04e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail0296156bb3310c85a4457Fri, 06 Sep 2019 19:09:51 GMT\"0x8D732FDCB7AAED0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "e801f4bb-208f-4f29-aae0-d07fb1b7bd8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0296156bb3310c85a4457?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" : "7623b7ae-0e93-4ce5-9b2b-35ba147d9fc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761d8c-401e-003a-0ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "7623b7ae-0e93-4ce5-9b2b-35ba147d9fc0" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail0296156bb3310c85a4457", "javablobgetpagerangesdiffacfail1633087c9e2e4c46fa4" ] +} \ 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..72984d45c313 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail07656472eb3adf944a485?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" : "af958c8a-079b-4413-a4c1-153ecd348078" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBA30127\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761da8-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "af958c8a-079b-4413-a4c1-153ecd348078" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail07656472eb3adf944a485/javablobgetpagerangesdiffacfail10833259141d6a282c4", + "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" : "e886966d-eae7-41a3-82b6-7ab0bd696c07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBA93916\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761dc4-401e-003a-3be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "e886966d-eae7-41a3-82b6-7ab0bd696c07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail07656472eb3adf944a485/javablobgetpagerangesdiffacfail10833259141d6a282c4?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", + "x-ms-client-request-id" : "88d24901-9d76-4d58-a728-21c4ebf4213e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:52.1574615Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBA93916\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761dd4-401e-003a-46e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "88d24901-9d76-4d58-a728-21c4ebf4213e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail07656472eb3adf944a485/javablobgetpagerangesdiffacfail10833259141d6a282c4?comp=lease", + "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" : "5a816077-e309-446e-9369-04ba7da900e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBA93916\"", + "x-ms-lease-id" : "38b0be18-2111-49c5-a984-72099511089c", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761de0-401e-003a-50e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "5a816077-e309-446e-9369-04ba7da900e1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail07656472eb3adf944a485/javablobgetpagerangesdiffacfail10833259141d6a282c4?prevsnapshot=2019-09-06T19%3a09%3a52.1574615Z&comp=pagelist", + "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" : "0c787039-afec-4a43-be0d-824d0ca122c7" + }, + "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" : "8f761de7-401e-003a-57e6-6473d5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:8f761de7-401e-003a-57e6-6473d5000000\nTime:2019-09-06T19:09:52.2288150Z", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "0c787039-afec-4a43-be0d-824d0ca122c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "003293b3-3f25-4d6a-8dcd-7dc459ba77d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761df2-401e-003a-61e6-6473d5000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail07656472eb3adf944a485Fri, 06 Sep 2019 19:09:52 GMT\"0x8D732FDCBA30127\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "003293b3-3f25-4d6a-8dcd-7dc459ba77d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail07656472eb3adf944a485?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" : "6d57060a-c531-4af3-ab8e-ccc185148024" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761e01-401e-003a-6ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "6d57060a-c531-4af3-ab8e-ccc185148024" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail07656472eb3adf944a485", "javablobgetpagerangesdiffacfail10833259141d6a282c4" ] +} \ 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..1a650599d548 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror052555cc559695507941b1?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" : "e2f0d6e6-1882-4921-b43f-f1b5c000e810" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBCA41BF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761e0f-401e-003a-7ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "e2f0d6e6-1882-4921-b43f-f1b5c000e810" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror052555cc559695507941b1/javablobgetpagerangesdifferror1717873baf6e67d5ef4", + "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" : "c085dcb5-d7db-44d4-aa22-a19ba8e83dd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBE7B075\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761e57-401e-003a-33e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "c085dcb5-d7db-44d4-aa22-a19ba8e83dd5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror052555cc559695507941b1/javablobgetpagerangesdifferror281064f5937c9b9be34?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d144e932-d166-40bf-aa0e-4ba1b2c27fb8" + }, + "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" : "8f761e64-401e-003a-3ee6-6473d5000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8f761e64-401e-003a-3ee6-6473d5000000\nTime:2019-09-06T19:09:52.5611321ZprevsnapshotsnapshotMust be in the specific snapshot date time format.", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "d144e932-d166-40bf-aa0e-4ba1b2c27fb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8e9dc119-af17-4acf-acd5-3cc3032fe3f2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761e72-401e-003a-48e6-6473d5000000", + "Body" : "jtcgetpagerangesdifferrorjtcgetpagerangesdifferror052555cc559695507941b1Fri, 06 Sep 2019 19:09:52 GMT\"0x8D732FDCBCA41BF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "8e9dc119-af17-4acf-acd5-3cc3032fe3f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror052555cc559695507941b1?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" : "7dd7ff51-5456-4645-b966-c18147f1e506" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761e7b-401e-003a-50e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "7dd7ff51-5456-4645-b966-c18147f1e506" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdifferror052555cc559695507941b1", "javablobgetpagerangesdifferror1717873baf6e67d5ef4", "javablobgetpagerangesdifferror281064f5937c9b9be34" ] +} \ 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..c83c92d3156c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin06419823c426a229ad4f67b?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" : "cfa2bcd4-0d1e-496b-ba97-15814fa635e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9C9881A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761809-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "cfa2bcd4-0d1e-496b-ba97-15814fa635e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin06419823c426a229ad4f67b/javablobgetpagerangesdiffmin149842186c1f50c91e4f", + "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" : "557adacb-1ca3-48f1-89a0-0ba474c24692" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9D4099F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76183d-401e-003a-66e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "557adacb-1ca3-48f1-89a0-0ba474c24692" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin06419823c426a229ad4f67b/javablobgetpagerangesdiffmin149842186c1f50c91e4f?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", + "x-ms-client-request-id" : "e98a2c53-0fb2-4f57-bee1-2f6171c0ee64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:09:49.0816078Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC9D4099F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761851-401e-003a-79e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "e98a2c53-0fb2-4f57-bee1-2f6171c0ee64" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin06419823c426a229ad4f67b/javablobgetpagerangesdiffmin149842186c1f50c91e4f?prevsnapshot=2019-09-06T19%3a09%3a49.0816078Z&comp=pagelist", + "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" : "37c1c42f-9c38-46a7-9465-68b12d496a94" + }, + "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" : "Fri, 06 Sep 2019 19:09:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "ETag" : "\"0x8D732FDC9D4099F\"", + "x-ms-request-id" : "8f761866-401e-003a-0be6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "37c1c42f-9c38-46a7-9465-68b12d496a94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "370b65c3-d541-4a4d-bd87-bb3c8978666b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761879-401e-003a-1ee6-6473d5000000", + "Body" : "jtcgetpagerangesdiffminjtcgetpagerangesdiffmin06419823c426a229ad4f67bFri, 06 Sep 2019 19:09:48 GMT\"0x8D732FDC9C9881A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "370b65c3-d541-4a4d-bd87-bb3c8978666b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin06419823c426a229ad4f67b?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" : "202e9af8-4e23-4a85-9328-90e0971f9616" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761883-401e-003a-28e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:48 GMT", + "x-ms-client-request-id" : "202e9af8-4e23-4a85-9328-90e0971f9616" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffmin06419823c426a229ad4f67b", "javablobgetpagerangesdiffmin149842186c1f50c91e4f" ] +} \ 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..2f904efb0798 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror0807555e6e79bd808e43f6a4?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" : "3dcb8652-e004-425d-8e6e-03a346c83a0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC967A126\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7616fd-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "3dcb8652-e004-425d-8e6e-03a346c83a0a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror0807555e6e79bd808e43f6a4/javablobgetpagerangeserror100260edbe587143ee477", + "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" : "7ed636c8-15f5-4e66-bb36-6da54672356a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC96DDC92\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76170f-401e-003a-63e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "7ed636c8-15f5-4e66-bb36-6da54672356a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror0807555e6e79bd808e43f6a4/javablobgetpagerangeserror22274523fd6da33c46458?comp=pagelist", + "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" : "1759169d-2182-4834-a352-fdb7101d8ea4" + }, + "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" : "8f761717-401e-003a-6ae6-6473d5000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:8f761717-401e-003a-6ae6-6473d5000000\nTime:2019-09-06T19:09:48.4141855Z", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "1759169d-2182-4834-a352-fdb7101d8ea4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f4aa773-15df-4dcd-acdd-d8730647e314" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761726-401e-003a-78e6-6473d5000000", + "Body" : "jtcgetpagerangeserrorjtcgetpagerangeserror0807555e6e79bd808e43f6a4Fri, 06 Sep 2019 19:09:48 GMT\"0x8D732FDC967A126\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "8f4aa773-15df-4dcd-acdd-d8730647e314", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror0807555e6e79bd808e43f6a4?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" : "1acf283d-5a0c-411d-8b2c-8fc0f52d899e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761735-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:47 GMT", + "x-ms-client-request-id" : "1acf283d-5a0c-411d-8b2c-8fc0f52d899e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangeserror0807555e6e79bd808e43f6a4", "javablobgetpagerangeserror100260edbe587143ee477", "javablobgetpagerangeserror22274523fd6da33c46458" ] +} \ 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..88bfe8031aef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin82a84043a8?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" : "b767677c-edf5-4f3c-8afa-5ddd0765411f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7C12B6A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761273-401e-003a-69e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "b767677c-edf5-4f3c-8afa-5ddd0765411f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin82a84043a8/javablobgetpagerangesmin1671868429537de2814b0f", + "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" : "20dd49f8-ff75-4868-b9b1-939191964e6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC7C6CCF5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761290-401e-003a-7ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "20dd49f8-ff75-4868-b9b1-939191964e6b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin82a84043a8/javablobgetpagerangesmin1671868429537de2814b0f?comp=pagelist", + "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" : "27d594f5-cfd3-410a-b21c-1964364655c8" + }, + "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" : "Fri, 06 Sep 2019 19:09:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "ETag" : "\"0x8D732FDC7C6CCF5\"", + "x-ms-request-id" : "8f76129d-401e-003a-0be6-6473d5000000", + "Body" : "", + "x-ms-client-request-id" : "27d594f5-cfd3-410a-b21c-1964364655c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "41d6fdfb-4c16-445c-aad7-77ef283b18c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7612a4-401e-003a-12e6-6473d5000000", + "Body" : "jtcgetpagerangesminjtcgetpagerangesmin0pageblobapitestgetpagerangesmin82a84043a8Fri, 06 Sep 2019 19:09:45 GMT\"0x8D732FDC7C12B6A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "41d6fdfb-4c16-445c-aad7-77ef283b18c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin82a84043a8?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" : "ea26cdb5-4a77-46b5-bf33-1493edccc157" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7612a9-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:44 GMT", + "x-ms-client-request-id" : "ea26cdb5-4a77-46b5-bf33-1493edccc157" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesmin0pageblobapitestgetpagerangesmin82a84043a8", "javablobgetpagerangesmin1671868429537de2814b0f" ] +} \ 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..70f49b03b71d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia80f07776c9f7838?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" : "adb1cda6-3130-4088-8e50-2b09c15babae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCBFE088E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761e91-401e-003a-5fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "adb1cda6-3130-4088-8e50-2b09c15babae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia80f07776c9f7838/javablobpagerangeia1pageblobapitestpagerangeia80f48242c409", + "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" : "cf6b17ec-9a41-4d22-b981-a1bcdbe03348" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC043FF4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761e9e-401e-003a-67e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "cf6b17ec-9a41-4d22-b981-a1bcdbe03348" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18d64860-0d59-4383-8926-01a6724a36d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761eaf-401e-003a-71e6-6473d5000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia80f07776c9f7838Fri, 06 Sep 2019 19:09:52 GMT\"0x8D732FDCBFE088E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "18d64860-0d59-4383-8926-01a6724a36d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia80f07776c9f7838?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" : "e3553663-ea31-46bb-924a-c2b317de1e5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761ec2-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "e3553663-ea31-46bb-924a-c2b317de1e5c" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia80f07776c9f7838", "javablobpagerangeia1pageblobapitestpagerangeia80f48242c409" ] +} \ 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..fcdea07e4e6e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaf1619513766f083?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" : "12a9e8c9-afdd-41f9-8765-2209776913d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC1B5BB2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761ed6-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "12a9e8c9-afdd-41f9-8765-2209776913d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaf1619513766f083/javablobpagerangeia1pageblobapitestpagerangeiaf16717257965", + "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" : "68176aa5-76ab-49ae-ba6a-131bd5f4ef97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC216BCF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761efa-401e-003a-27e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:51 GMT", + "x-ms-client-request-id" : "68176aa5-76ab-49ae-ba6a-131bd5f4ef97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dae51bf9-adbc-40ea-b62e-a046d019d453" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761f00-401e-003a-2de6-6473d5000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiaf1619513766f083Fri, 06 Sep 2019 19:09:52 GMT\"0x8D732FDCC1B5BB2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "dae51bf9-adbc-40ea-b62e-a046d019d453", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaf1619513766f083?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" : "c76054c1-4ea1-404f-9f72-b31c7ba0ee21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761f0f-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "c76054c1-4ea1-404f-9f72-b31c7ba0ee21" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiaf1619513766f083", "javablobpagerangeia1pageblobapitestpagerangeiaf16717257965" ] +} \ 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..e24a85fdb2b4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia3d21378246a4021?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" : "1d602d2c-e8e2-429f-b127-d89b744716b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC31F674\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761f1c-401e-003a-3fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "1d602d2c-e8e2-429f-b127-d89b744716b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia3d21378246a4021/javablobpagerangeia1pageblobapitestpagerangeia3d262185080e", + "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" : "c0529a49-68e5-41c4-8f25-2be92f532621" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC387BBB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761f2f-401e-003a-4ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "c0529a49-68e5-41c4-8f25-2be92f532621" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1dda25b6-fb67-4a56-897e-d303be995b79" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761f52-401e-003a-61e6-6473d5000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia3d21378246a4021Fri, 06 Sep 2019 19:09:53 GMT\"0x8D732FDCC31F674\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "1dda25b6-fb67-4a56-897e-d303be995b79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia3d21378246a4021?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" : "184ed48d-5771-4903-9994-8234a195fdb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761f61-401e-003a-6de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "184ed48d-5771-4903-9994-8234a195fdb6" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia3d21378246a4021", "javablobpagerangeia1pageblobapitestpagerangeia3d262185080e" ] +} \ 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..84dc04e7234f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia45135914dca4c70?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" : "11e95098-9a6d-4f5b-a77c-99f52baae659" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC4AB49A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761f78-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "11e95098-9a6d-4f5b-a77c-99f52baae659" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia45135914dca4c70/javablobpagerangeia1pageblobapitestpagerangeia45198339630a", + "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" : "0037c998-12ab-47d6-956f-2a2ffa1a9ada" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC50C485\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761f88-401e-003a-0ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "0037c998-12ab-47d6-956f-2a2ffa1a9ada" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac8fd311-b46d-4f09-887d-47a9ba435e86" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f761f90-401e-003a-11e6-6473d5000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia45135914dca4c70Fri, 06 Sep 2019 19:09:53 GMT\"0x8D732FDCC4AB49A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "ac8fd311-b46d-4f09-887d-47a9ba435e86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia45135914dca4c70?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" : "30d0d878-75b8-4d30-b328-51b6412caf2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f761f9d-401e-003a-19e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "30d0d878-75b8-4d30-b328-51b6412caf2c" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia45135914dca4c70", "javablobpagerangeia1pageblobapitestpagerangeia45198339630a" ] +} \ 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..2319bb7440ea --- /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://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiae04660866ec129b?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" : "e5b70c31-fce1-4d2e-a39f-2f78fb35d10b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC6967A2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761fb5-401e-003a-29e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "e5b70c31-fce1-4d2e-a39f-2f78fb35d10b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiae04660866ec129b/javablobpagerangeia1pageblobapitestpagerangeiae04372094856", + "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" : "5ac5f33f-795f-4078-8d32-2a3de74ff80e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC75935A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f761fe4-401e-003a-4be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "5ac5f33f-795f-4078-8d32-2a3de74ff80e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0422d645-1a46-4f74-9cad-f1f62feae350" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762000-401e-003a-5fe6-6473d5000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiae04660866ec129bFri, 06 Sep 2019 19:09:53 GMT\"0x8D732FDCC6967A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "0422d645-1a46-4f74-9cad-f1f62feae350", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiae04660866ec129b?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" : "9a582712-c4f0-4276-b066-2dc5b8292a5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762008-401e-003a-66e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "9a582712-c4f0-4276-b066-2dc5b8292a5c" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiae04660866ec129b", "javablobpagerangeia1pageblobapitestpagerangeiae04372094856" ] +} \ 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..212a713fd7bb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia09d491874ca33ba?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" : "bf57c8a6-edfd-472a-b3fd-08cb2ee63481" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC8A6539\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762015-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "bf57c8a6-edfd-472a-b3fd-08cb2ee63481" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia09d491874ca33ba/javablobpagerangeia1pageblobapitestpagerangeia09d337853c79", + "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" : "506b27b1-3582-41a1-9550-198c6b829082" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCC902694\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76202b-401e-003a-7fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "506b27b1-3582-41a1-9550-198c6b829082" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "47713427-91a5-41cc-a339-13aed47d42b1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762036-401e-003a-0ae6-6473d5000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia09d491874ca33baFri, 06 Sep 2019 19:09:53 GMT\"0x8D732FDCC8A6539\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "47713427-91a5-41cc-a339-13aed47d42b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia09d491874ca33ba?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" : "0b40e5ed-e2cb-4842-9f16-9a33ea519f06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762040-401e-003a-12e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "0b40e5ed-e2cb-4842-9f16-9a33ea519f06" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia09d491874ca33ba", "javablobpagerangeia1pageblobapitestpagerangeia09d337853c79" ] +} \ 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..a72000f9ccbc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresizeb9141091c83b11632c0a?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" : "3fde2f55-07be-484b-98c4-7ed0445cb35a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCA19C61\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762056-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "3fde2f55-07be-484b-98c4-7ed0445cb35a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresizeb9141091c83b11632c0a/javablobresize1pageblobapitestresizeb9105802ad2413833", + "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" : "05ff8a8d-458c-4ff9-a33b-f7db0305d78a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCA84839\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762062-401e-003a-2ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "05ff8a8d-458c-4ff9-a33b-f7db0305d78a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresizeb9141091c83b11632c0a/javablobresize1pageblobapitestresizeb9105802ad2413833?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" : "8a144ce8-02fd-4223-8953-b6dc07a79d9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCB9634B\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762091-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:52 GMT", + "x-ms-client-request-id" : "8a144ce8-02fd-4223-8953-b6dc07a79d9f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresizeb9141091c83b11632c0a/javablobresize1pageblobapitestresizeb9105802ad2413833", + "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" : "b34b5c66-52f3-4904-b310-ea3cbd523f61" + }, + "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" : "Fri, 06 Sep 2019 19:09:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09: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" : "\"0x8D732FDCCB9634B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:53 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "8f7620a2-401e-003a-5ee6-6473d5000000", + "x-ms-client-request-id" : "b34b5c66-52f3-4904-b310-ea3cbd523f61", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0553adaa-306b-410b-81eb-1839f5ac1530" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7620ac-401e-003a-66e6-6473d5000000", + "Body" : "jtcresizejtcresize0pageblobapitestresizeb9141091c83b11632c0aFri, 06 Sep 2019 19:09:53 GMT\"0x8D732FDCCA19C61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "0553adaa-306b-410b-81eb-1839f5ac1530", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresizeb9141091c83b11632c0a?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" : "c414fcb4-a51f-44d3-8a7a-b8051bc6d92f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7620be-401e-003a-75e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "c414fcb4-a51f-44d3-8a7a-b8051bc6d92f" + }, + "Exception" : null + } ], + "variables" : [ "jtcresize0pageblobapitestresizeb9141091c83b11632c0a", "javablobresize1pageblobapitestresizeb9105802ad2413833" ] +} \ 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..d462214240c4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac84525364fcd337851d?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" : "a24e1494-a610-49bc-a3e4-7becd1c91019" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCF3EF0D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76213b-401e-003a-56e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "a24e1494-a610-49bc-a3e4-7becd1c91019" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac84525364fcd337851d/javablobresizeac1pageblobapitestresizeac84574138f8e48db", + "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" : "50701471-32bf-4717-91bf-a0c1ac74b823" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD021654\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76217b-401e-003a-0ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "50701471-32bf-4717-91bf-a0c1ac74b823" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac84525364fcd337851d/javablobresizeac1pageblobapitestresizeac84574138f8e48db?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" : "c72a5649-3176-4beb-a4ea-d7054a286826" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD085963\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762185-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "c72a5649-3176-4beb-a4ea-d7054a286826" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a7b643a6-bb1e-4ab6-a0a9-df49c98ad249" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76218d-401e-003a-1ae6-6473d5000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac84525364fcd337851dFri, 06 Sep 2019 19:09:54 GMT\"0x8D732FDCCF3EF0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "a7b643a6-bb1e-4ab6-a0a9-df49c98ad249", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac84525364fcd337851d?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" : "82bb582f-9f1b-4b4a-9df8-60bd3e002bb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762196-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "82bb582f-9f1b-4b4a-9df8-60bd3e002bb0" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac84525364fcd337851d", "javablobresizeac1pageblobapitestresizeac84574138f8e48db" ] +} \ 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..6f716cdd959e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac44e20233c9f9b9a086?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" : "e9d659e0-aa32-4b64-9c41-b5b9ad4f7b34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD1B7DDD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76219f-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "e9d659e0-aa32-4b64-9c41-b5b9ad4f7b34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac44e20233c9f9b9a086/javablobresizeac1pageblobapitestresizeac44e42439899af26", + "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" : "6f72223d-e161-40a5-81a2-265d2a8bb9de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD21B3C4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7621b5-401e-003a-3de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "6f72223d-e161-40a5-81a2-265d2a8bb9de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac44e20233c9f9b9a086/javablobresizeac1pageblobapitestresizeac44e42439899af26?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" : "7618fd82-70d8-4947-8ac8-5c495179277a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD26BE09\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7621c4-401e-003a-49e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "7618fd82-70d8-4947-8ac8-5c495179277a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "446a6038-47e1-4aff-af1c-c25e2e77338b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7621ce-401e-003a-53e6-6473d5000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac44e20233c9f9b9a086Fri, 06 Sep 2019 19:09:54 GMT\"0x8D732FDCD1B7DDD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "446a6038-47e1-4aff-af1c-c25e2e77338b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac44e20233c9f9b9a086?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" : "297a07d0-d870-48fe-a1d3-f9bfde7a7e8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7621da-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "297a07d0-d870-48fe-a1d3-f9bfde7a7e8c" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac44e20233c9f9b9a086", "javablobresizeac1pageblobapitestresizeac44e42439899af26" ] +} \ 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..ddc187e67e38 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc2967523fb337892f5?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" : "71bf05e0-0e77-4a41-8531-02e1e1dd6adc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD399492\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7621f8-401e-003a-77e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "71bf05e0-0e77-4a41-8531-02e1e1dd6adc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc2967523fb337892f5/javablobresizeac1pageblobapitestresizeacc2994396959850f", + "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" : "d7650d3f-a3c1-4570-aa40-82158fa5223d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD40B4D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76220e-401e-003a-06e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "d7650d3f-a3c1-4570-aa40-82158fa5223d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc2967523fb337892f5/javablobresizeac1pageblobapitestresizeacc2994396959850f?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" : "d88a839f-b0ba-4f1c-b92d-d97df7b86aa0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD463462\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762229-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "d88a839f-b0ba-4f1c-b92d-d97df7b86aa0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "31a665e2-1734-476b-886d-64a31ea38b56" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762238-401e-003a-2ae6-6473d5000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeacc2967523fb337892f5Fri, 06 Sep 2019 19:09:54 GMT\"0x8D732FDCD399492\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "31a665e2-1734-476b-886d-64a31ea38b56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc2967523fb337892f5?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" : "f4342f72-338e-4d88-bffc-fd7f46cc9b91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76223f-401e-003a-30e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "f4342f72-338e-4d88-bffc-fd7f46cc9b91" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeacc2967523fb337892f5", "javablobresizeac1pageblobapitestresizeacc2994396959850f" ] +} \ 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..71c0269d826d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5b?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" : "c6d01c5a-9613-43bd-b6dc-a7e2f3260a45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD6F579C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762294-401e-003a-74e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "c6d01c5a-9613-43bd-b6dc-a7e2f3260a45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5b/javablobresizeac1pageblobapitestresizeac12a0796471d0270", + "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" : "51787ca9-f000-4366-ad5a-7299c6128fc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD753ED2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7622a6-401e-003a-01e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "51787ca9-f000-4366-ad5a-7299c6128fc7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5b/javablobresizeac1pageblobapitestresizeac12a0796471d0270", + "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" : "6c0709f9-4a0e-46a1-a02d-ca04d167e01e" + }, + "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" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:54 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" : "\"0x8D732FDCD753ED2\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:55 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7622b5-401e-003a-0be6-6473d5000000", + "x-ms-client-request-id" : "6c0709f9-4a0e-46a1-a02d-ca04d167e01e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5b/javablobresizeac1pageblobapitestresizeac12a0796471d0270?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" : "c921105d-491b-42c6-b3af-53174c72dd58" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD7FEFB8\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7622ce-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "c921105d-491b-42c6-b3af-53174c72dd58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dbab65bb-f0a8-4be6-9ac3-c0efee9e258b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7622de-401e-003a-29e6-6473d5000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5bFri, 06 Sep 2019 19:09:55 GMT\"0x8D732FDCD6F579C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "dbab65bb-f0a8-4be6-9ac3-c0efee9e258b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5b?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" : "ee050370-6eff-417b-b169-61e583426f64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7622ee-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "ee050370-6eff-417b-b169-61e583426f64" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac12a64312dd6a7c9b5b", "javablobresizeac1pageblobapitestresizeac12a0796471d0270" ] +} \ 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..e0da46140b27 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc9458547ce647884d1?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" : "657785df-fefd-45bc-a8c5-0419dafacc70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCD96983E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762317-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "657785df-fefd-45bc-a8c5-0419dafacc70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc9458547ce647884d1/javablobresizeac1pageblobapitestresizeacc9422899ac3d919", + "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" : "27087ac9-8dab-4d36-9a9c-4501d129ada4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDAD4C10\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76238b-401e-003a-2de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "27087ac9-8dab-4d36-9a9c-4501d129ada4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc9458547ce647884d1/javablobresizeac1pageblobapitestresizeacc9422899ac3d919?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" : "960d543b-17ea-415f-b90b-39484b8fd8c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDB36808\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7623a3-401e-003a-41e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "960d543b-17ea-415f-b90b-39484b8fd8c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3456772d-bb32-4465-a9f6-b84efaed1a30" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7623b7-401e-003a-51e6-6473d5000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeacc9458547ce647884d1Fri, 06 Sep 2019 19:09:55 GMT\"0x8D732FDCD96983E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "3456772d-bb32-4465-a9f6-b84efaed1a30", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc9458547ce647884d1?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" : "e400002f-a5c3-4724-b68d-b40e57bf7d36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7623cb-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "e400002f-a5c3-4724-b68d-b40e57bf7d36" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeacc9458547ce647884d1", "javablobresizeac1pageblobapitestresizeacc9422899ac3d919" ] +} \ 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..a596c17c2a0e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac7d30260029b718d01b?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" : "35078586-030c-4cad-99dd-8dc57ef6cef9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDCD9427\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7623f5-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "35078586-030c-4cad-99dd-8dc57ef6cef9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac7d30260029b718d01b/javablobresizeac1pageblobapitestresizeac7d3079631e1c83e", + "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" : "d541bb55-7c39-4ded-9cad-60f9e92eca19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDD4DAA2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762416-401e-003a-22e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "d541bb55-7c39-4ded-9cad-60f9e92eca19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac7d30260029b718d01b/javablobresizeac1pageblobapitestresizeac7d3079631e1c83e?comp=lease", + "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" : "ae2d0423-ab69-4630-9031-b9537b9abaa2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDD4DAA2\"", + "x-ms-lease-id" : "4fd29d55-1e16-448e-b956-2c902f74aa4f", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76242d-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "ae2d0423-ab69-4630-9031-b9537b9abaa2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac7d30260029b718d01b/javablobresizeac1pageblobapitestresizeac7d3079631e1c83e?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" : "eabac5ba-bd66-43b7-a872-a30406d2ccea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDE027F2\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76243d-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "eabac5ba-bd66-43b7-a872-a30406d2ccea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d0c4e60f-f3f8-43cb-acdf-5df33efe0f6c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762457-401e-003a-59e6-6473d5000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac7d30260029b718d01bFri, 06 Sep 2019 19:09:55 GMT\"0x8D732FDCDCD9427\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "d0c4e60f-f3f8-43cb-acdf-5df33efe0f6c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac7d30260029b718d01b?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" : "33124917-c96f-47c3-9fe1-c626f0d0d670" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762468-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:54 GMT", + "x-ms-client-request-id" : "33124917-c96f-47c3-9fe1-c626f0d0d670" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac7d30260029b718d01b", "javablobresizeac1pageblobapitestresizeac7d3079631e1c83e" ] +} \ 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..c50b509e09bc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail75b971765a45e4?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" : "7f6b92be-24ed-44c1-bc08-f568fc374b40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDEFCA77\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762476-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "7f6b92be-24ed-44c1-bc08-f568fc374b40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail75b971765a45e4/javablobresizeacfail1pageblobapitestresizeacfail75b40142231", + "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" : "09071473-a8a2-4840-9a47-1f3277c4b2ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCDF64D46\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762489-401e-003a-80e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "09071473-a8a2-4840-9a47-1f3277c4b2ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail75b971765a45e4/javablobresizeacfail1pageblobapitestresizeacfail75b40142231?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" : "a273a6bd-156d-4a95-962d-ea9176ec6150" + }, + "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" : "8f762493-401e-003a-08e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f762493-401e-003a-08e6-6473d5000000\nTime:2019-09-06T19:09:56.0164195Z", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "a273a6bd-156d-4a95-962d-ea9176ec6150", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f9ddf195-218d-4482-aa04-e08e92b443c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7624a3-401e-003a-16e6-6473d5000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail75b971765a45e4Fri, 06 Sep 2019 19:09:55 GMT\"0x8D732FDCDEFCA77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "f9ddf195-218d-4482-aa04-e08e92b443c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail75b971765a45e4?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" : "ce409123-571f-4b6c-ac95-3ddda5f39389" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7624b9-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "ce409123-571f-4b6c-ac95-3ddda5f39389" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail75b971765a45e4", "javablobresizeacfail1pageblobapitestresizeacfail75b40142231" ] +} \ 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..88feb76c6d35 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail92a326921bfe0b?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" : "e730fa3f-fc00-46b3-90c4-a5a83899c8ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE0D1DA0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7624ce-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "e730fa3f-fc00-46b3-90c4-a5a83899c8ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail92a326921bfe0b/javablobresizeacfail1pageblobapitestresizeacfail92a66809c02", + "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" : "c06b6b53-f5e4-48e8-a1cd-228b44fea423" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE137926\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7624e1-401e-003a-44e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "c06b6b53-f5e4-48e8-a1cd-228b44fea423" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail92a326921bfe0b/javablobresizeacfail1pageblobapitestresizeacfail92a66809c02?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" : "c03c6e8e-43de-4481-937d-dfad43319419" + }, + "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" : "8f7624f2-401e-003a-51e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f7624f2-401e-003a-51e6-6473d5000000\nTime:2019-09-06T19:09:56.2045976Z", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "c03c6e8e-43de-4481-937d-dfad43319419", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18c832a7-1909-413e-8fe6-137115353945" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762508-401e-003a-61e6-6473d5000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail92a326921bfe0bFri, 06 Sep 2019 19:09:56 GMT\"0x8D732FDCE0D1DA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "18c832a7-1909-413e-8fe6-137115353945", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail92a326921bfe0b?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" : "440dcb1d-bf08-4ca4-9f8b-6b0ed4d3f12d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762510-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "440dcb1d-bf08-4ca4-9f8b-6b0ed4d3f12d" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail92a326921bfe0b", "javablobresizeacfail1pageblobapitestresizeacfail92a66809c02" ] +} \ 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..36e92589e7a0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaileca922269c7244?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" : "730ea5cc-4e7f-4b76-b902-b41e58dd63cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE28C2AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762524-401e-003a-78e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "730ea5cc-4e7f-4b76-b902-b41e58dd63cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaileca922269c7244/javablobresizeacfail1pageblobapitestresizeacfaileca481495c6", + "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" : "8fa7e4eb-c6b8-4d92-942e-0bc34323613f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE2EA8B2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762536-401e-003a-07e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "8fa7e4eb-c6b8-4d92-942e-0bc34323613f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaileca922269c7244/javablobresizeacfail1pageblobapitestresizeacfaileca481495c6?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" : "c4b59fdd-3752-4ed3-90fc-e874e3ca96d8" + }, + "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" : "8f762542-401e-003a-13e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f762542-401e-003a-13e6-6473d5000000\nTime:2019-09-06T19:09:56.3807662Z", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "c4b59fdd-3752-4ed3-90fc-e874e3ca96d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "17b957eb-544a-4796-82e9-2a26b8606104" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762547-401e-003a-18e6-6473d5000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfaileca922269c7244Fri, 06 Sep 2019 19:09:56 GMT\"0x8D732FDCE28C2AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "17b957eb-544a-4796-82e9-2a26b8606104", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaileca922269c7244?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" : "a30e6019-51bc-474e-8704-3cd73b888158" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76254f-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "a30e6019-51bc-474e-8704-3cd73b888158" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfaileca922269c7244", "javablobresizeacfail1pageblobapitestresizeacfaileca481495c6" ] +} \ 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..d5b9c319a368 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailcb167433aee63c?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" : "239bfcf0-a580-43b0-b98a-1364e312429a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE4C0AB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762561-401e-003a-2ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "239bfcf0-a580-43b0-b98a-1364e312429a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailcb167433aee63c/javablobresizeacfail1pageblobapitestresizeacfailcb11892730f", + "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" : "bf02b3db-4377-4e46-9c26-ec0ffb5ce760" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE585AB0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762595-401e-003a-54e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "bf02b3db-4377-4e46-9c26-ec0ffb5ce760" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailcb167433aee63c/javablobresizeacfail1pageblobapitestresizeacfailcb11892730f", + "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" : "6697e291-a27b-4542-81fe-9f5e16b1464b" + }, + "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" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:55 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" : "\"0x8D732FDCE585AB0\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:56 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7625aa-401e-003a-65e6-6473d5000000", + "x-ms-client-request-id" : "6697e291-a27b-4542-81fe-9f5e16b1464b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailcb167433aee63c/javablobresizeacfail1pageblobapitestresizeacfailcb11892730f?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" : "7c924f5d-de59-413a-ab87-bdbba8e2df5d" + }, + "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" : "8f7625c3-401e-003a-7ae6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f7625c3-401e-003a-7ae6-6473d5000000\nTime:2019-09-06T19:09:56.6880574Z", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "7c924f5d-de59-413a-ab87-bdbba8e2df5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fdd8346e-ad5f-47ad-a130-04affeebd7af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7625ca-401e-003a-7fe6-6473d5000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfailcb167433aee63cFri, 06 Sep 2019 19:09:56 GMT\"0x8D732FDCE4C0AB4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "fdd8346e-ad5f-47ad-a130-04affeebd7af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailcb167433aee63c?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" : "630fe3b3-96b9-45ee-ae74-96a16e528c55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7625d9-401e-003a-0ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "630fe3b3-96b9-45ee-ae74-96a16e528c55" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfailcb167433aee63c", "javablobresizeacfail1pageblobapitestresizeacfailcb11892730f" ] +} \ 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..aedcd3421744 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6?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" : "640059de-361b-4296-8d29-4e1abc7f6ffa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE7A7903\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7625e8-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "640059de-361b-4296-8d29-4e1abc7f6ffa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6/javablobresizeacfail1pageblobapitestresizeacfailf1993511df5", + "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" : "21765762-a042-4758-9f95-88cb87181c3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE80ACCC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762619-401e-003a-3de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "21765762-a042-4758-9f95-88cb87181c3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6/javablobresizeacfail1pageblobapitestresizeacfailf1993511df5?comp=lease", + "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" : "ef414017-1d76-4226-9703-64d3d32f6791" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE80ACCC\"", + "x-ms-lease-id" : "97279a6e-c207-4e80-91a7-68691ac1fee6", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762628-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:55 GMT", + "x-ms-client-request-id" : "ef414017-1d76-4226-9703-64d3d32f6791" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6/javablobresizeacfail1pageblobapitestresizeacfailf1993511df5?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" : "d8706a4f-71a6-473a-98cc-15deb294282f" + }, + "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" : "8f76262f-401e-003a-50e6-6473d5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:8f76262f-401e-003a-50e6-6473d5000000\nTime:2019-09-06T19:09:56.9533095Z", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "d8706a4f-71a6-473a-98cc-15deb294282f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d7bf57a1-7d6c-4cb2-a370-a25160343aca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762633-401e-003a-54e6-6473d5000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6Fri, 06 Sep 2019 19:09:56 GMT\"0x8D732FDCE7A7903\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "d7bf57a1-7d6c-4cb2-a370-a25160343aca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6?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" : "f949173d-3793-4aa4-95b3-ed41f4874218" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76263a-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "f949173d-3793-4aa4-95b3-ed41f4874218" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfailf19505023ec9f6", "javablobresizeacfail1pageblobapitestresizeacfailf1993511df5" ] +} \ 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..994ba593b891 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror6df5834964ef5bb?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" : "7d46fd07-173c-4882-ab07-c33814aea9e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCE9AB30A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762651-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "7d46fd07-173c-4882-ab07-c33814aea9e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror6df5834964ef5bb/javablobresizeerror1pageblobapitestresizeerror6df718208067", + "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" : "abc4aa2c-9767-4368-a262-2f157d080746" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEA0E69D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762666-401e-003a-7ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "abc4aa2c-9767-4368-a262-2f157d080746" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror6df5834964ef5bb/javablobresizeerror2pageblobapitestresizeerror6df0839823e9?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" : "3612dc49-b994-4437-98b7-802ae629a90d" + }, + "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" : "8f762670-401e-003a-02e6-6473d5000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:8f762670-401e-003a-02e6-6473d5000000\nTime:2019-09-06T19:09:57.1374852Z", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "3612dc49-b994-4437-98b7-802ae629a90d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0cd4f3df-7f3e-47ad-9138-5f6d26fc58e2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762683-401e-003a-0ee6-6473d5000000", + "Body" : "jtcresizeerrorjtcresizeerror0pageblobapitestresizeerror6df5834964ef5bbFri, 06 Sep 2019 19:09:57 GMT\"0x8D732FDCE9AB30A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "0cd4f3df-7f3e-47ad-9138-5f6d26fc58e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror6df5834964ef5bb?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" : "255acaed-257c-4176-babd-97676ee913b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76268a-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "255acaed-257c-4176-babd-97676ee913b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeerror0pageblobapitestresizeerror6df5834964ef5bb", "javablobresizeerror1pageblobapitestresizeerror6df718208067", "javablobresizeerror2pageblobapitestresizeerror6df0839823e9" ] +} \ 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..d5957bfdac23 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin3b206191ea75017ad?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" : "7603fd09-be36-41eb-b4eb-a79316bbb110" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCD191A1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7620d7-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "7603fd09-be36-41eb-b4eb-a79316bbb110" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin3b206191ea75017ad/javablobresizemin1pageblobapitestresizemin3b2420169c7cd0", + "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" : "ce50c260-b7d6-493c-ac73-ef04d9406688" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCD900C0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7620f7-401e-003a-1fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "ce50c260-b7d6-493c-ac73-ef04d9406688" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin3b206191ea75017ad/javablobresizemin1pageblobapitestresizemin3b2420169c7cd0?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" : "ac0bf497-a563-4e59-900e-7d5eaa04c80d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCCE02E67\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762110-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "ac0bf497-a563-4e59-900e-7d5eaa04c80d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ae36157f-3d65-4d3a-8f57-d04ae0cd9846" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762121-401e-003a-3fe6-6473d5000000", + "Body" : "jtcresizeminjtcresizemin0pageblobapitestresizemin3b206191ea75017adFri, 06 Sep 2019 19:09:54 GMT\"0x8D732FDCCD191A1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "ae36157f-3d65-4d3a-8f57-d04ae0cd9846", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin3b206191ea75017ad?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" : "cfb8b848-28d7-4007-ba79-ba673820170b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76212e-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:53 GMT", + "x-ms-client-request-id" : "cfb8b848-28d7-4007-ba79-ba673820170b" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizemin0pageblobapitestresizemin3b206191ea75017ad", "javablobresizemin1pageblobapitestresizemin3b2420169c7cd0" ] +} \ 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..d6cb15b96ec5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber82b88158376d?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" : "127addb5-ab3a-4727-a791-b5d490e01b4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEBA0286\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76269c-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "127addb5-ab3a-4727-a791-b5d490e01b4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber82b88158376d/javablobsequencenumber1pageblobapitestsequencenumber82b517414", + "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" : "0ba2ef7c-3d9e-40bc-af0a-46dc5dd828a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEC035DA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7626b0-401e-003a-31e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "0ba2ef7c-3d9e-40bc-af0a-46dc5dd828a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber82b88158376d/javablobsequencenumber1pageblobapitestsequencenumber82b517414?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" : "ffcddd47-4ad1-48b0-8f9f-8ce9b5b13d2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEC651C8\"", + "x-ms-blob-sequence-number" : "5", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7626bd-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "ffcddd47-4ad1-48b0-8f9f-8ce9b5b13d2e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber82b88158376d/javablobsequencenumber1pageblobapitestsequencenumber82b517414", + "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" : "7e1b5a3d-c831-4524-8b48-7d715a89b0c6" + }, + "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" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:56 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" : "\"0x8D732FDCEC651C8\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:57 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7626c5-401e-003a-44e6-6473d5000000", + "x-ms-client-request-id" : "7e1b5a3d-c831-4524-8b48-7d715a89b0c6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aeea316f-6c8c-4e47-abf3-46820451e8c6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7626ca-401e-003a-49e6-6473d5000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumber82b88158376dFri, 06 Sep 2019 19:09:57 GMT\"0x8D732FDCEBA0286\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "aeea316f-6c8c-4e47-abf3-46820451e8c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber82b88158376d?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" : "29248334-541a-4141-9d8e-db2f163909d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7626d0-401e-003a-4fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "29248334-541a-4141-9d8e-db2f163909d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumber82b88158376d", "javablobsequencenumber1pageblobapitestsequencenumber82b517414" ] +} \ 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..d0129bf0a020 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5f380307df0f?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" : "562b9fb8-7e1b-4cf1-af38-c97ea56df194" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEDD4A7D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7626d9-401e-003a-58e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "562b9fb8-7e1b-4cf1-af38-c97ea56df194" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5f380307df0f/javablobsequencenumber1pageblobapitestsequencenumber5f3514462", + "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" : "784c9b81-9b82-49a9-a066-9f5f67129d2d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEE3A4BF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7626ec-401e-003a-65e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "784c9b81-9b82-49a9-a066-9f5f67129d2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5f380307df0f/javablobsequencenumber1pageblobapitestsequencenumber5f3514462?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" : "882506e7-132b-41f6-84d8-9a9593b1b7b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCEE9C0B7\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7626fa-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "882506e7-132b-41f6-84d8-9a9593b1b7b0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5f380307df0f/javablobsequencenumber1pageblobapitestsequencenumber5f3514462", + "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" : "8b9704a2-1c7e-4e6f-b9ff-a7a6f5933b8d" + }, + "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" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:56 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" : "\"0x8D732FDCEE9C0B7\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:57 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f76270b-401e-003a-02e6-6473d5000000", + "x-ms-client-request-id" : "8b9704a2-1c7e-4e6f-b9ff-a7a6f5933b8d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "195467f8-749a-40cf-9154-8a01bb7c433a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76271e-401e-003a-13e6-6473d5000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumber5f380307df0fFri, 06 Sep 2019 19:09:57 GMT\"0x8D732FDCEDD4A7D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "195467f8-749a-40cf-9154-8a01bb7c433a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5f380307df0f?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" : "29ee5c05-5714-4b23-b109-b76a1f755d1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76272f-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "29ee5c05-5714-4b23-b109-b76a1f755d1b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumber5f380307df0f", "javablobsequencenumber1pageblobapitestsequencenumber5f3514462" ] +} \ 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..3ead3a07488c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberc3d504473e47?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" : "6956eb59-03de-4d9f-87be-d79cfdbfdbb1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF1530FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762777-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "6956eb59-03de-4d9f-87be-d79cfdbfdbb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberc3d504473e47/javablobsequencenumber1pageblobapitestsequencenumberc3d70289f", + "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" : "79b8cb2c-ef82-4f2a-9043-34ed48fe3067" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF1C274B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762786-401e-003a-69e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:56 GMT", + "x-ms-client-request-id" : "79b8cb2c-ef82-4f2a-9043-34ed48fe3067" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberc3d504473e47/javablobsequencenumber1pageblobapitestsequencenumberc3d70289f?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" : "b4cf56c3-9dc4-4d43-8ce4-1c249f07677d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF224343\"", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762798-401e-003a-77e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "b4cf56c3-9dc4-4d43-8ce4-1c249f07677d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberc3d504473e47/javablobsequencenumber1pageblobapitestsequencenumberc3d70289f", + "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" : "c3b1e1a9-4322-41a4-aa5d-8e1c1e10604c" + }, + "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" : "Fri, 06 Sep 2019 19:09:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:57 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" : "\"0x8D732FDCF224343\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:57 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7627a2-401e-003a-80e6-6473d5000000", + "x-ms-client-request-id" : "c3b1e1a9-4322-41a4-aa5d-8e1c1e10604c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d89a922c-7700-4a28-b7cf-3e2fac5a7388" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7627aa-401e-003a-07e6-6473d5000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumberc3d504473e47Fri, 06 Sep 2019 19:09:57 GMT\"0x8D732FDCF1530FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "d89a922c-7700-4a28-b7cf-3e2fac5a7388", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberc3d504473e47?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" : "0e67b99d-592b-4c3e-a8d5-f3b530731668" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7627b0-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "0e67b99d-592b-4c3e-a8d5-f3b530731668" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumberc3d504473e47", "javablobsequencenumber1pageblobapitestsequencenumberc3d70289f" ] +} \ 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..574236c04f64 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacc6830231b7?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" : "b228cbe8-330e-42b3-8f0b-1c0c2d6e3ed8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF61198A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76282e-401e-003a-76e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "b228cbe8-330e-42b3-8f0b-1c0c2d6e3ed8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacc6830231b7/javablobsequencenumberac156372acc7b88a4f7e44e7", + "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" : "705f7c9f-6799-4d26-99aa-7eb306a1e73b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF68D2E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76283f-401e-003a-04e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "705f7c9f-6799-4d26-99aa-7eb306a1e73b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacc6830231b7/javablobsequencenumberac156372acc7b88a4f7e44e7?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" : "afba00b2-a32c-4a56-b20e-354550f06aa0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF6E2B53\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76284d-401e-003a-0fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "afba00b2-a32c-4a56-b20e-354550f06aa0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c4e8f81-bbd7-4b75-a946-1371801561a7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76285d-401e-003a-1ce6-6473d5000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberacc6830231b7Fri, 06 Sep 2019 19:09:58 GMT\"0x8D732FDCF61198A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "1c4e8f81-bbd7-4b75-a946-1371801561a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacc6830231b7?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" : "d193f785-8ee2-47b9-a48c-322c5e2e04c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762866-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "d193f785-8ee2-47b9-a48c-322c5e2e04c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberacc6830231b7", "javablobsequencenumberac156372acc7b88a4f7e44e7" ] +} \ 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..42ebb001a69f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac15f81560f9?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" : "5de46ded-92dc-4a1c-85ee-3a04c492a9bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF7DA92D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762879-401e-003a-30e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "5de46ded-92dc-4a1c-85ee-3a04c492a9bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac15f81560f9/javablobsequencenumberac1803958ce9a37a4e7b4c04", + "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" : "a2c44252-1ec0-4b0f-a3e4-a2801a90bf8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF84027A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762883-401e-003a-39e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "a2c44252-1ec0-4b0f-a3e4-a2801a90bf8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac15f81560f9/javablobsequencenumberac1803958ce9a37a4e7b4c04?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" : "b0caada2-82f1-4c26-a07a-f36a183b2154" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF89F752\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762891-401e-003a-46e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "b0caada2-82f1-4c26-a07a-f36a183b2154" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f92f7b38-44a7-4b5c-bb6f-3ff111693e53" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7628a1-401e-003a-54e6-6473d5000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac15f81560f9Fri, 06 Sep 2019 19:09:58 GMT\"0x8D732FDCF7DA92D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "f92f7b38-44a7-4b5c-bb6f-3ff111693e53", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac15f81560f9?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" : "84c49c23-a924-46b7-acc6-68f8320428b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7628ae-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "84c49c23-a924-46b7-acc6-68f8320428b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac15f81560f9", "javablobsequencenumberac1803958ce9a37a4e7b4c04" ] +} \ 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..501509795537 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac52a33023a2?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" : "cb720717-d86f-489b-ad3c-fcc9f3483ca9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFB148DF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7628e2-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "cb720717-d86f-489b-ad3c-fcc9f3483ca9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac52a33023a2/javablobsequencenumberac196689cb04d963d13c42c8", + "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" : "0212738c-1c49-48fd-aa4a-96b5d8bfccbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFB6B745\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7628f0-401e-003a-17e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "0212738c-1c49-48fd-aa4a-96b5d8bfccbf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac52a33023a2/javablobsequencenumberac196689cb04d963d13c42c8?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" : "b51285d6-ee98-45df-8916-2ffa1502c24c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFBBE8A0\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762904-401e-003a-26e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "b51285d6-ee98-45df-8916-2ffa1502c24c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d44f925b-432a-485c-8cf7-93e513a60a4a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762910-401e-003a-31e6-6473d5000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac52a33023a2Fri, 06 Sep 2019 19:09:58 GMT\"0x8D732FDCFB148DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "d44f925b-432a-485c-8cf7-93e513a60a4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac52a33023a2?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" : "31e7d48c-430f-4470-adb4-fcb756bc2c86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762919-401e-003a-39e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "31e7d48c-430f-4470-adb4-fcb756bc2c86" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac52a33023a2", "javablobsequencenumberac196689cb04d963d13c42c8" ] +} \ 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..068d56464b04 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac7c7287667c?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" : "469ae465-3c99-4b28-ba0d-71940f25623c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFCC9FBF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76292f-401e-003a-4be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "469ae465-3c99-4b28-ba0d-71940f25623c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac7c7287667c/javablobsequencenumberac12867449a88bc85a6242d1", + "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" : "101dcaaf-b87a-4039-a17b-4d216366d250" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFD2AA5A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762952-401e-003a-67e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "101dcaaf-b87a-4039-a17b-4d216366d250" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac7c7287667c/javablobsequencenumberac12867449a88bc85a6242d1", + "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" : "d5a93da0-82aa-4f30-b123-ffec98ffedca" + }, + "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" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:58 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" : "\"0x8D732FDCFD2AA5A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:59 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f762967-401e-003a-79e6-6473d5000000", + "x-ms-client-request-id" : "d5a93da0-82aa-4f30-b123-ffec98ffedca", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac7c7287667c/javablobsequencenumberac12867449a88bc85a6242d1?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" : "27a74d5b-0dc8-4cec-8f61-56aea82204d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFDDA972\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762975-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "27a74d5b-0dc8-4cec-8f61-56aea82204d8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "279c4ebb-7e31-45b0-b715-a2f168e1025a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762982-401e-003a-11e6-6473d5000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac7c7287667cFri, 06 Sep 2019 19:09:59 GMT\"0x8D732FDCFCC9FBF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "279c4ebb-7e31-45b0-b715-a2f168e1025a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac7c7287667c?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" : "048694d6-6f8d-4e13-97bc-7715c0fe938d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76298a-401e-003a-19e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "048694d6-6f8d-4e13-97bc-7715c0fe938d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac7c7287667c", "javablobsequencenumberac12867449a88bc85a6242d1" ] +} \ 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..f31fee0c6ba5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaca872728374?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" : "a0d7bc92-3c01-493b-a1b5-c02cc141a3a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFF5B58F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762996-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "a0d7bc92-3c01-493b-a1b5-c02cc141a3a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaca872728374/javablobsequencenumberac1570231fe7e61938014c1e", + "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" : "4f84f4b1-7aaa-48d3-9cd4-7bbf13e7906e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCFFEF4FA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7629bb-401e-003a-40e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "4f84f4b1-7aaa-48d3-9cd4-7bbf13e7906e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaca872728374/javablobsequencenumberac1570231fe7e61938014c1e?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" : "48ae3557-cfe4-41fb-ae17-9d90d928d0a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD004C2B6\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7629c6-401e-003a-48e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "48ae3557-cfe4-41fb-ae17-9d90d928d0a3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f354588-b87a-4e69-b794-ec594a566086" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7629d4-401e-003a-56e6-6473d5000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberaca872728374Fri, 06 Sep 2019 19:09:59 GMT\"0x8D732FDCFF5B58F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "8f354588-b87a-4e69-b794-ec594a566086", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaca872728374?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" : "e4e0747f-a3b6-4867-a4d6-2e4cd8faf0d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7629df-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "e4e0747f-a3b6-4867-a4d6-2e4cd8faf0d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberaca872728374", "javablobsequencenumberac1570231fe7e61938014c1e" ] +} \ 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..56d588de00d0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac63629633cb?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" : "d49582ca-ffb3-47ae-802e-8dae0c37f49f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0155334\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7629ef-401e-003a-69e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "d49582ca-ffb3-47ae-802e-8dae0c37f49f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac63629633cb/javablobsequencenumberac113324c36b5a3ace934b85", + "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" : "b6cb8cb5-389f-4dc6-8387-e1d34fc636a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD01B0F2B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7629fe-401e-003a-77e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "b6cb8cb5-389f-4dc6-8387-e1d34fc636a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac63629633cb/javablobsequencenumberac113324c36b5a3ace934b85?comp=lease", + "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" : "5d621a1d-4c50-4d01-af61-430636c465aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD01B0F2B\"", + "x-ms-lease-id" : "9a98f028-327e-434b-abe0-8961d9059c3b", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762a0c-401e-003a-04e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "5d621a1d-4c50-4d01-af61-430636c465aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac63629633cb/javablobsequencenumberac113324c36b5a3ace934b85?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" : "2da03fc6-715c-4c69-88af-1097c5cec600" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0254AC7\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762a11-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "2da03fc6-715c-4c69-88af-1097c5cec600" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "69bd1532-cd12-4090-9003-cc90dd7c0d9d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762a1e-401e-003a-14e6-6473d5000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac63629633cbFri, 06 Sep 2019 19:09:59 GMT\"0x8D732FDD0155334\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "69bd1532-cd12-4090-9003-cc90dd7c0d9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac63629633cb?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" : "40c29bba-5e64-4b6b-85e5-a67171bfb3ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762a2c-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "40c29bba-5e64-4b6b-85e5-a67171bfb3ea" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac63629633cb", "javablobsequencenumberac113324c36b5a3ace934b85" ] +} \ 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..51f76a3a2544 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail063256ad6ab44ff1c24efe8?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" : "c8bc9773-be58-4c9d-bbfe-c4ded1d81256" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0378985\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762a3d-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "c8bc9773-be58-4c9d-bbfe-c4ded1d81256" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail063256ad6ab44ff1c24efe8/javablobsequencenumberacfail1622516fc15cfd8bb141", + "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" : "15f33556-f089-4d01-835c-cc650fdad0fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD03DBA95\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762a4f-401e-003a-3ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "15f33556-f089-4d01-835c-cc650fdad0fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail063256ad6ab44ff1c24efe8/javablobsequencenumberacfail1622516fc15cfd8bb141?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" : "028a86a8-dff8-4952-a5bf-a68e3601325e" + }, + "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" : "8f762a64-401e-003a-50e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f762a64-401e-003a-50e6-6473d5000000\nTime:2019-09-06T19:09:59.8410571Z", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "028a86a8-dff8-4952-a5bf-a68e3601325e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f86b2bc-5aa5-4eed-9fed-5aa1a3d31f64" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762a73-401e-003a-5fe6-6473d5000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail063256ad6ab44ff1c24efe8Fri, 06 Sep 2019 19:09:59 GMT\"0x8D732FDD0378985\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "8f86b2bc-5aa5-4eed-9fed-5aa1a3d31f64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail063256ad6ab44ff1c24efe8?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" : "faa912f6-ff77-4ff8-8023-eca92c954ec0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762a83-401e-003a-6ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:58 GMT", + "x-ms-client-request-id" : "faa912f6-ff77-4ff8-8023-eca92c954ec0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail063256ad6ab44ff1c24efe8", "javablobsequencenumberacfail1622516fc15cfd8bb141" ] +} \ 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..3cb35d2adc14 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061355938d93906ad04055a?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" : "8b33aa0f-c589-459f-bb67-446b1f624883" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0592378\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762a95-401e-003a-7de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "8b33aa0f-c589-459f-bb67-446b1f624883" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061355938d93906ad04055a/javablobsequencenumberacfail176159e6d8134573494f", + "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" : "7a8d140f-dd5e-4635-a14b-7f91d662de9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD06BDA65\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762acb-401e-003a-26e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "7a8d140f-dd5e-4635-a14b-7f91d662de9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061355938d93906ad04055a/javablobsequencenumberacfail176159e6d8134573494f?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" : "b19503df-d86e-4b5b-b07a-2cf7ea30a6ad" + }, + "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" : "8f762ad8-401e-003a-33e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f762ad8-401e-003a-33e6-6473d5000000\nTime:2019-09-06T19:10:00.1463474Z", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "b19503df-d86e-4b5b-b07a-2cf7ea30a6ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c9af8ae8-0da2-445b-a396-70bb581ab86b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762ae4-401e-003a-3de6-6473d5000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail061355938d93906ad04055aFri, 06 Sep 2019 19:09:59 GMT\"0x8D732FDD0592378\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "c9af8ae8-0da2-445b-a396-70bb581ab86b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061355938d93906ad04055a?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" : "7f9a97a4-6187-46e7-bc09-947f81e8c891" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762aee-401e-003a-47e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "7f9a97a4-6187-46e7-bc09-947f81e8c891" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail061355938d93906ad04055a", "javablobsequencenumberacfail176159e6d8134573494f" ] +} \ 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..32a9b88b0232 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail05219509731be13b0443269?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" : "3c4dd3d3-ecba-43ad-b812-8ee3b579da5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0859583\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762afd-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "3c4dd3d3-ecba-43ad-b812-8ee3b579da5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail05219509731be13b0443269/javablobsequencenumberacfail121822c917c612b9454d", + "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" : "30ef6b86-b0be-406b-a3fb-584ddcdcec56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD09B3303\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762b3f-401e-003a-0de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "30ef6b86-b0be-406b-a3fb-584ddcdcec56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail05219509731be13b0443269/javablobsequencenumberacfail121822c917c612b9454d?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" : "b04fbfe4-637b-447e-9092-8bbe2bca4122" + }, + "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" : "8f762b4f-401e-003a-1be6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f762b4f-401e-003a-1be6-6473d5000000\nTime:2019-09-06T19:10:00.4466331Z", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "b04fbfe4-637b-447e-9092-8bbe2bca4122", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f61a92a9-998a-4bca-8b94-ed3936134af9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762b5f-401e-003a-29e6-6473d5000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail05219509731be13b0443269Fri, 06 Sep 2019 19:10:00 GMT\"0x8D732FDD0859583\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "f61a92a9-998a-4bca-8b94-ed3936134af9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail05219509731be13b0443269?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" : "36e74a93-3841-40e5-b16d-18e5a810a6bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762b6d-401e-003a-32e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "36e74a93-3841-40e5-b16d-18e5a810a6bd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail05219509731be13b0443269", "javablobsequencenumberacfail121822c917c612b9454d" ] +} \ 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..c50f956b2026 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061425effb02470e9741799?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" : "881ca1f0-5fc8-4d4e-bc8c-6956004e7523" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0AEF980\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762b82-401e-003a-45e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "881ca1f0-5fc8-4d4e-bc8c-6956004e7523" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061425effb02470e9741799/javablobsequencenumberacfail1132790b59760f28bb49", + "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" : "39449408-6e5d-4282-a569-a3cccd3a2d41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0B48D6D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762b96-401e-003a-56e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "39449408-6e5d-4282-a569-a3cccd3a2d41" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061425effb02470e9741799/javablobsequencenumberacfail1132790b59760f28bb49", + "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" : "8562535e-4158-4541-8339-3748ec8d6db4" + }, + "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" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09: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" : "\"0x8D732FDD0B48D6D\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:10:00 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f762bab-401e-003a-66e6-6473d5000000", + "x-ms-client-request-id" : "8562535e-4158-4541-8339-3748ec8d6db4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061425effb02470e9741799/javablobsequencenumberacfail1132790b59760f28bb49?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" : "f1630b10-e2b0-4db4-976c-7aaee5e9d719" + }, + "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" : "8f762bb8-401e-003a-72e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f762bb8-401e-003a-72e6-6473d5000000\nTime:2019-09-06T19:10:00.6678442Z", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "f1630b10-e2b0-4db4-976c-7aaee5e9d719", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7efd6f64-abd6-41a4-969c-94f60679cd5c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762bc6-401e-003a-7de6-6473d5000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail061425effb02470e9741799Fri, 06 Sep 2019 19:10:00 GMT\"0x8D732FDD0AEF980\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "7efd6f64-abd6-41a4-969c-94f60679cd5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail061425effb02470e9741799?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" : "7ab11334-4325-45ac-80ac-5f79d09472d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762be0-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "7ab11334-4325-45ac-80ac-5f79d09472d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail061425effb02470e9741799", "javablobsequencenumberacfail1132790b59760f28bb49" ] +} \ 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..e2c1442a339a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail080812e06aa5f25b18443db?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" : "978c8ee2-e426-49e4-b501-c5ac05fd8307" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0D66135\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762bfb-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "978c8ee2-e426-49e4-b501-c5ac05fd8307" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail080812e06aa5f25b18443db/javablobsequencenumberacfail17769986fe4bd7bb0048", + "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" : "845ad155-53ee-4de2-bd7a-f10bdb7d790a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0DCB865\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762c0d-401e-003a-3de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "845ad155-53ee-4de2-bd7a-f10bdb7d790a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail080812e06aa5f25b18443db/javablobsequencenumberacfail17769986fe4bd7bb0048?comp=lease", + "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" : "cb4edd5b-f813-497c-8ea0-75d8d496cac1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0DCB865\"", + "x-ms-lease-id" : "e98f9556-2836-4de6-a79f-825ea25f8d76", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762c23-401e-003a-53e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:59 GMT", + "x-ms-client-request-id" : "cb4edd5b-f813-497c-8ea0-75d8d496cac1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail080812e06aa5f25b18443db/javablobsequencenumberacfail17769986fe4bd7bb0048?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" : "07fd50f4-b22d-4144-89f6-a63b4d9d76f8" + }, + "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" : "8f762c33-401e-003a-61e6-6473d5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:8f762c33-401e-003a-61e6-6473d5000000\nTime:2019-09-06T19:10:00.9330964Z", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "07fd50f4-b22d-4144-89f6-a63b4d9d76f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c2d48e67-3041-47e6-a3ba-d56b5c56a012" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762c44-401e-003a-6ce6-6473d5000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail080812e06aa5f25b18443dbFri, 06 Sep 2019 19:10:00 GMT\"0x8D732FDD0D66135\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "c2d48e67-3041-47e6-a3ba-d56b5c56a012", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail080812e06aa5f25b18443db?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" : "9449513f-71e4-46df-8c3f-ee0a2934ee37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762c4c-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "9449513f-71e4-46df-8c3f-ee0a2934ee37" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail080812e06aa5f25b18443db", "javablobsequencenumberacfail17769986fe4bd7bb0048" ] +} \ 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..42d862f81aef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror032489c5d4e15e84884f3c9?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" : "f3c1da28-cf40-48cb-83a1-50d654e84d8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD0FA45A5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762c63-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "f3c1da28-cf40-48cb-83a1-50d654e84d8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror032489c5d4e15e84884f3c9/javablobsequencenumbererror1255880068a220a9764fe", + "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" : "11785994-2d23-4c03-857a-4cbbaf270bf6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD100274F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762c78-401e-003a-17e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "11785994-2d23-4c03-857a-4cbbaf270bf6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror032489c5d4e15e84884f3c9/javablobsequencenumbererror2078971339486cda8e454?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" : "8f0d943e-51b6-4173-b392-1a0700126657" + }, + "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" : "8f762c8a-401e-003a-26e6-6473d5000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:8f762c8a-401e-003a-26e6-6473d5000000\nTime:2019-09-06T19:10:01.1152697Z", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "8f0d943e-51b6-4173-b392-1a0700126657", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2b66bf48-747b-49c5-961a-9a3ac84843b3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762c9a-401e-003a-34e6-6473d5000000", + "Body" : "jtcsequencenumbererrorjtcsequencenumbererror032489c5d4e15e84884f3c9Fri, 06 Sep 2019 19:10:01 GMT\"0x8D732FDD0FA45A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "2b66bf48-747b-49c5-961a-9a3ac84843b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror032489c5d4e15e84884f3c9?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" : "faec74b4-ea33-468b-ade4-e2e79fc67af2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762ca7-401e-003a-40e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "faec74b4-ea33-468b-ade4-e2e79fc67af2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumbererror032489c5d4e15e84884f3c9", "javablobsequencenumbererror1255880068a220a9764fe", "javablobsequencenumbererror2078971339486cda8e454" ] +} \ 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..8582221f64c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumberminbb848637e?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" : "f83e0a2b-2ec0-4c03-9d31-10b43f7801b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF367CBC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7627c8-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "f83e0a2b-2ec0-4c03-9d31-10b43f7801b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumberminbb848637e/javablobsequencenumbermin19972083df0aa404864148", + "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" : "8d7e6e3a-ce3a-47b2-a083-0c2cd79367ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF3C12ED\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7627d5-401e-003a-2ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "8d7e6e3a-ce3a-47b2-a083-0c2cd79367ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumberminbb848637e/javablobsequencenumbermin19972083df0aa404864148?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" : "4f056087-bd05-41a8-bfc1-adef483b2c79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDCF416B65\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7627e4-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "4f056087-bd05-41a8-bfc1-adef483b2c79" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1ac28813-00c2-41ab-953a-cecf6a74fa1e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7627f7-401e-003a-44e6-6473d5000000", + "Body" : "jtcsequencenumberminjtcsequencenumbermin0pageblobapitestsequencenumberminbb848637eFri, 06 Sep 2019 19:09:58 GMT\"0x8D732FDCF367CBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "1ac28813-00c2-41ab-953a-cecf6a74fa1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumberminbb848637e?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" : "b52a70f7-a719-4c62-b7a2-99440573ceca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f762803-401e-003a-4fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:57 GMT", + "x-ms-client-request-id" : "b52a70f7-a719-4c62-b7a2-99440573ceca" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumbermin0pageblobapitestsequencenumberminbb848637e", "javablobsequencenumbermin19972083df0aa404864148" ] +} \ 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..c53b4b9724b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json @@ -0,0 +1,270 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569?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" : "acc3f17a-4a7e-4e2c-a7fe-b9c8fc54b542" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD115EAAE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762cb8-401e-003a-4ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "acc3f17a-4a7e-4e2c-a7fe-b9c8fc54b542" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy119944b3d7d092a5c44a", + "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" : "91204044-7827-4e6e-9b67-5357d1f605b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD11D2C0F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762cca-401e-003a-5ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "91204044-7827-4e6e-9b67-5357d1f605b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e696bd6c-f8b2-4cad-9492-5ac6ba10bb5c", + "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" : "\"0x8D732FDD1246E94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f762cdf-401e-003a-6ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "e696bd6c-f8b2-4cad-9492-5ac6ba10bb5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy119944b3d7d092a5c44a?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", + "x-ms-client-request-id" : "32196272-978a-4448-9f0d-fa6c5c5b10d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:01.3539991Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD11D2C0F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f762cf6-401e-003a-03e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "32196272-978a-4448-9f0d-fa6c5c5b10d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy214971a8f7e500ed1445?comp=incrementalcopy", + "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" : "dccb5a13-5d6a-4dfc-be36-2c59f1630e3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b22ddfca-60ee-419c-8c62-4922d709b328", + "ETag" : "\"0x8D732FDD137E65A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f762d0c-401e-003a-18e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "x-ms-client-request-id" : "dccb5a13-5d6a-4dfc-be36-2c59f1630e3c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy214971a8f7e500ed1445", + "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" : "65c07242-bb99-4aeb-9f37-d9848bdb9ca2" + }, + "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" : "Fri, 06 Sep 2019 19:10:01 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" : "Fri, 06 Sep 2019 19:10:01 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f762d44-401e-003a-47e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b22ddfca-60ee-419c-8c62-4922d709b328", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy119944b3d7d092a5c44a?snapshot=2019-09-06T19:10:01.3539991Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 06 Sep 2019 19:10:00 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD137E65A\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "65c07242-bb99-4aeb-9f37-d9848bdb9ca2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy214971a8f7e500ed1445", + "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" : "1c22a3db-efa3-44e6-8a9b-4255acf016bb" + }, + "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-06T19:10:01.5681978Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 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" : "Fri, 06 Sep 2019 19:10:01 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f762f3b-401e-003a-7de6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b22ddfca-60ee-419c-8c62-4922d709b328", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy119944b3d7d092a5c44a?snapshot=2019-09-06T19:10:01.3539991Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:01 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:01 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD137E65A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "1c22a3db-efa3-44e6-8a9b-4255acf016bb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy214971a8f7e500ed1445", + "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" : "288a7ecf-0b22-4a4a-a0a8-7da50fcb911e" + }, + "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-06T19:10:01.5681978Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:01 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" : "Fri, 06 Sep 2019 19:10:01 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f7631a1-401e-003a-05e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b22ddfca-60ee-419c-8c62-4922d709b328", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569/javablobstartincrementalcopy119944b3d7d092a5c44a?snapshot=2019-09-06T19:10:01.3539991Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:02 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:01 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD137E65A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "288a7ecf-0b22-4a4a-a0a8-7da50fcb911e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a0297422-771b-445f-9364-be2257c947aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7631ae-401e-003a-11e6-6473d5000000", + "Body" : "jtcstartincrementalcopyjtcstartincrementalcopy040600ec70c49b505f4f569Fri, 06 Sep 2019 19:10:01 GMT\"0x8D732FDD1246E94\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:02 GMT", + "x-ms-client-request-id" : "a0297422-771b-445f-9364-be2257c947aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy040600ec70c49b505f4f569?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" : "e17dd311-4efd-4b29-b590-0d9ee2a94f45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7631c0-401e-003a-21e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:02 GMT", + "x-ms-client-request-id" : "e17dd311-4efd-4b29-b590-0d9ee2a94f45" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopy040600ec70c49b505f4f569", "javablobstartincrementalcopy119944b3d7d092a5c44a", "javablobstartincrementalcopy214971a8f7e500ed1445" ] +} \ 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..141787fa5bf0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json @@ -0,0 +1,277 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d?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" : "b4a05b06-52d1-4e34-bd16-ce666f0fde39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD2E28F5B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7632ee-401e-003a-27e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "b4a05b06-52d1-4e34-bd16-ce666f0fde39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac1754489dbc7a666a0b4", + "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" : "2da5da7c-38f6-41e0-be5f-177fd7691134" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD2E90AB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763309-401e-003a-3de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "2da5da7c-38f6-41e0-be5f-177fd7691134" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "252053cc-7b79-40a7-b4c2-6cdd9c04b2d0", + "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" : "\"0x8D732FDD2EEEE6B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f763321-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "252053cc-7b79-40a7-b4c2-6cdd9c04b2d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac1754489dbc7a666a0b4?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", + "x-ms-client-request-id" : "acf6b23c-8cc8-427f-8abf-8bcfeaa64026" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:04.3718040Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD2E90AB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763336-401e-003a-65e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "acf6b23c-8cc8-427f-8abf-8bcfeaa64026" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac2934206c917e7a80d74?comp=incrementalcopy", + "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" : "b13a5b8e-2a04-4d82-b398-7b328ace977e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b4929c9b-5d78-4e78-b685-b7ad11a8abdd", + "ETag" : "\"0x8D732FDD303017F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f763346-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "b13a5b8e-2a04-4d82-b398-7b328ace977e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac2934206c917e7a80d74", + "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" : "73c34505-73a1-4ed2-a7fb-de209df37427" + }, + "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" : "Fri, 06 Sep 2019 19:10:04 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" : "Fri, 06 Sep 2019 19:10:04 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f763381-401e-003a-25e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b4929c9b-5d78-4e78-b685-b7ad11a8abdd", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac1754489dbc7a666a0b4?snapshot=2019-09-06T19:10:04.3718040Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD303017F\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "73c34505-73a1-4ed2-a7fb-de209df37427" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac2934206c917e7a80d74", + "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" : "563c5bbf-3d9e-432c-ab96-fb6456277025" + }, + "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-06T19:10:04.5199414Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 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" : "Fri, 06 Sep 2019 19:10:04 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f7635a2-401e-003a-10e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b4929c9b-5d78-4e78-b685-b7ad11a8abdd", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac1754489dbc7a666a0b4?snapshot=2019-09-06T19:10:04.3718040Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:04 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:04 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD303017F\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "563c5bbf-3d9e-432c-ab96-fb6456277025" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac1754489dbc7a666a0b4?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", + "x-ms-client-request-id" : "47916b1c-7d28-4c81-8185-532c78dd1bb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:06.5878603Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD2E90AB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7637bc-401e-003a-5ce6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "47916b1c-7d28-4c81-8185-532c78dd1bb7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d/javablobstartincrementalcopyac2934206c917e7a80d74?comp=incrementalcopy", + "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" : "ba433aab-e75c-4f1e-9391-9c1e934c862e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "cccd8361-dea1-4b61-98dd-f014e196b794", + "ETag" : "\"0x8D732FDD4509136\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f7637d1-401e-003a-6fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "ba433aab-e75c-4f1e-9391-9c1e934c862e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2b00dfe6-1801-449f-b1a8-3aebd6383f56" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7637e0-401e-003a-7de6-6473d5000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac099724fc5ce0bdf31c493dFri, 06 Sep 2019 19:10:04 GMT\"0x8D732FDD2EEEE6B\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "2b00dfe6-1801-449f-b1a8-3aebd6383f56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099724fc5ce0bdf31c493d?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" : "6627a095-31f6-471f-8190-8ad56c8ff0bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7637f2-401e-003a-0ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "6627a095-31f6-471f-8190-8ad56c8ff0bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac099724fc5ce0bdf31c493d", "javablobstartincrementalcopyac1754489dbc7a666a0b4", "javablobstartincrementalcopyac2934206c917e7a80d74" ] +} \ 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..e5e991909afe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json @@ -0,0 +1,277 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d?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" : "9d445d7a-5159-4aea-b1c6-4879b85cccbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD4656EEC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76381a-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "9d445d7a-5159-4aea-b1c6-4879b85cccbf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac1469534f97e9fcf31a4", + "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" : "20b30bbc-c0ce-4977-81f6-b81a76256a27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD46F1D06\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763831-401e-003a-45e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "20b30bbc-c0ce-4977-81f6-b81a76256a27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "36e43d34-6749-4386-b629-ea9a9ae234af", + "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" : "\"0x8D732FDD4743E46\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f763856-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "36e43d34-6749-4386-b629-ea9a9ae234af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac1469534f97e9fcf31a4?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", + "x-ms-client-request-id" : "47bb5aa8-2aee-470f-9b17-0c004ab722d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:06.9101593Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD46F1D06\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76386e-401e-003a-7be6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:05 GMT", + "x-ms-client-request-id" : "47bb5aa8-2aee-470f-9b17-0c004ab722d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac297977f6f80d0abf904?comp=incrementalcopy", + "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" : "a9aa8378-e591-4c62-af53-4d396dedd998" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "585e31a2-23a7-4cd2-be09-9e6bfab364e9", + "ETag" : "\"0x8D732FDD48122A4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f763884-401e-003a-0fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:06 GMT", + "x-ms-client-request-id" : "a9aa8378-e591-4c62-af53-4d396dedd998" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac297977f6f80d0abf904", + "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" : "bd88d79b-f66d-4187-83fb-4a11eeb9ae7c" + }, + "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" : "Fri, 06 Sep 2019 19:10:06 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" : "Fri, 06 Sep 2019 19:10:06 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f763892-401e-003a-1de6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "585e31a2-23a7-4cd2-be09-9e6bfab364e9", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac1469534f97e9fcf31a4?snapshot=2019-09-06T19:10:06.9101593Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 06 Sep 2019 19:10:06 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD48122A4\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "bd88d79b-f66d-4187-83fb-4a11eeb9ae7c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac297977f6f80d0abf904", + "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" : "fd60f25c-151a-422b-9dd8-099bc15a6755" + }, + "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-06T19:10:06.9972398Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 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" : "Fri, 06 Sep 2019 19:10:06 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f763a59-401e-003a-10e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "585e31a2-23a7-4cd2-be09-9e6bfab364e9", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac1469534f97e9fcf31a4?snapshot=2019-09-06T19:10:06.9101593Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:07 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:06 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD48122A4\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "fd60f25c-151a-422b-9dd8-099bc15a6755" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac1469534f97e9fcf31a4?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", + "x-ms-client-request-id" : "3699d163-1481-4412-9cd8-7008c7d3c0c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:09.0671605Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD46F1D06\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763c3e-401e-003a-09e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "3699d163-1481-4412-9cd8-7008c7d3c0c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d/javablobstartincrementalcopyac297977f6f80d0abf904?comp=incrementalcopy", + "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" : "6e4f4580-427f-42cb-9c31-43ae164ab24a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "9a408d4a-2dc3-4f9d-9d00-649cbe2fb80b", + "ETag" : "\"0x8D732FDD5CBA462\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f763c5a-401e-003a-1de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "6e4f4580-427f-42cb-9c31-43ae164ab24a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ae1dfbc4-3afd-4c1e-a56c-b1d4e990ff3b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f763c6c-401e-003a-2be6-6473d5000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac0627741ac8e4b2ad76438dFri, 06 Sep 2019 19:10:06 GMT\"0x8D732FDD4743E46\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "ae1dfbc4-3afd-4c1e-a56c-b1d4e990ff3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0627741ac8e4b2ad76438d?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" : "e7b1c9fe-6160-4935-8a5e-4a139f09e520" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f763c7b-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "e7b1c9fe-6160-4935-8a5e-4a139f09e520" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac0627741ac8e4b2ad76438d", "javablobstartincrementalcopyac1469534f97e9fcf31a4", "javablobstartincrementalcopyac297977f6f80d0abf904" ] +} \ 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..5fd1f53a7b12 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4?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" : "f564671b-61d2-4577-acd7-18bec9b04693" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD5DED646\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763c8b-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "f564671b-61d2-4577-acd7-18bec9b04693" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac10931893162b1f45554", + "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" : "2b87acf2-31ae-4248-ab12-82440a5dd852" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD5E79785\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763cb1-401e-003a-65e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "2b87acf2-31ae-4248-ab12-82440a5dd852" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fc9b12b6-d85a-48d6-b3ad-d8785504bcfc", + "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" : "\"0x8D732FDD5ED0807\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f763cbe-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "fc9b12b6-d85a-48d6-b3ad-d8785504bcfc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac10931893162b1f45554?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", + "x-ms-client-request-id" : "05ecbe25-9474-47a9-a2db-7b5bd2841143" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:09.3734447Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD5E79785\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763cc9-401e-003a-7ae6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "05ecbe25-9474-47a9-a2db-7b5bd2841143" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac238163b9874e8918814?comp=incrementalcopy", + "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" : "7afb35e2-6f78-4baf-bcd4-605864ccfd56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1f746999-3263-40a3-a4e6-4b2140119372", + "ETag" : "\"0x8D732FDD603D8B6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f763cd9-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-client-request-id" : "7afb35e2-6f78-4baf-bcd4-605864ccfd56" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac238163b9874e8918814", + "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" : "69af1839-991b-470d-88f6-01b6bd9eba11" + }, + "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-06T19:10:09.5946497Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 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" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f763d57-401e-003a-66e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "1f746999-3263-40a3-a4e6-4b2140119372", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac10931893162b1f45554?snapshot=2019-09-06T19:10:09.3734447Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:08 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:09 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD603D8B6\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "69af1839-991b-470d-88f6-01b6bd9eba11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac10931893162b1f45554?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", + "x-ms-client-request-id" : "c265c09e-80d1-445b-aebe-a5aeb604390e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:10.6596367Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD5E79785\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763f2c-401e-003a-6fe6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "c265c09e-80d1-445b-aebe-a5aeb604390e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4/javablobstartincrementalcopyac238163b9874e8918814?comp=incrementalcopy", + "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" : "8fe1c915-b104-4b93-a7a5-79733f8e27ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f69ecd59-8659-499a-915f-4330f6baf1a0", + "ETag" : "\"0x8D732FDD6BE7B69\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f763f48-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "8fe1c915-b104-4b93-a7a5-79733f8e27ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9c6ed223-c258-4ae9-bdef-7bbf167228cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f763f5f-401e-003a-1ee6-6473d5000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac099166eafc285cfcdd40c4Fri, 06 Sep 2019 19:10:09 GMT\"0x8D732FDD5ED0807\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "9c6ed223-c258-4ae9-bdef-7bbf167228cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac099166eafc285cfcdd40c4?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" : "6b5399d2-3385-4c61-a11a-1af2566fca36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f763f6b-401e-003a-29e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "6b5399d2-3385-4c61-a11a-1af2566fca36" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac099166eafc285cfcdd40c4", "javablobstartincrementalcopyac10931893162b1f45554", "javablobstartincrementalcopyac238163b9874e8918814" ] +} \ 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..8c659178414c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json @@ -0,0 +1,316 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046?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" : "f4e9d4f4-1fe4-4101-8756-900e4a33e7f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD6D1FCFF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763f77-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "f4e9d4f4-1fe4-4101-8756-900e4a33e7f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac1437259bad95a9e23d4", + "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" : "27c51132-7c7f-483c-80c0-15a14c4150e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD6D8E782\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763f83-401e-003a-3fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "27c51132-7c7f-483c-80c0-15a14c4150e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "498ab595-265a-458b-baa8-596ea880d719", + "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" : "\"0x8D732FDD6DF4364\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f763fad-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:09 GMT", + "x-ms-client-request-id" : "498ab595-265a-458b-baa8-596ea880d719" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac1437259bad95a9e23d4?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", + "x-ms-client-request-id" : "715e8bf1-913a-420a-944f-c01dbf520fd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:10.9679246Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD6D8E782\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763fbd-401e-003a-6fe6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:10 GMT", + "x-ms-client-request-id" : "715e8bf1-913a-420a-944f-c01dbf520fd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac297191f98b812f8ce04?comp=incrementalcopy", + "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" : "345b401d-e700-4b2f-a5e7-dd146a35ed55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "e0c982b6-b727-4671-a40b-a536158b0506", + "ETag" : "\"0x8D732FDD6F1A57D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f763fd3-401e-003a-01e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:10 GMT", + "x-ms-client-request-id" : "345b401d-e700-4b2f-a5e7-dd146a35ed55" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac297191f98b812f8ce04", + "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" : "17e1c2bc-f2ce-4a48-a55c-87552de44d15" + }, + "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" : "Fri, 06 Sep 2019 19:10: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" : "Fri, 06 Sep 2019 19:10:11 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f764006-401e-003a-29e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "e0c982b6-b727-4671-a40b-a536158b0506", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac1437259bad95a9e23d4?snapshot=2019-09-06T19:10:10.9679246Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 06 Sep 2019 19:10:10 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD6F1A57D\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "17e1c2bc-f2ce-4a48-a55c-87552de44d15" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac297191f98b812f8ce04", + "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" : "3be189f6-c3b4-48b7-bad6-09f1e51a2641" + }, + "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-06T19:10:11.1120573Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10: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" : "Fri, 06 Sep 2019 19:10:11 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f7641f0-401e-003a-4de6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "e0c982b6-b727-4671-a40b-a536158b0506", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac1437259bad95a9e23d4?snapshot=2019-09-06T19:10:10.9679246Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:11 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:11 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD6F1A57D\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "3be189f6-c3b4-48b7-bad6-09f1e51a2641" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac1437259bad95a9e23d4?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", + "x-ms-client-request-id" : "7176b133-66c4-44d3-9008-9ffac4ef58ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:13.1869885Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD6D8E782\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764399-401e-003a-41e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "7176b133-66c4-44d3-9008-9ffac4ef58ce" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac297191f98b812f8ce04", + "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" : "e52c9368-60fb-4484-bb20-038f41cfc649" + }, + "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-06T19:10:11.1120573Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10: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" : "Fri, 06 Sep 2019 19:10:11 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f7643a7-401e-003a-4ee6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "e0c982b6-b727-4671-a40b-a536158b0506", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac1437259bad95a9e23d4?snapshot=2019-09-06T19:10:10.9679246Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:11 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD6F1A57D\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "e52c9368-60fb-4484-bb20-038f41cfc649" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046/javablobstartincrementalcopyac297191f98b812f8ce04?comp=incrementalcopy", + "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" : "5dbf0747-47ad-4614-82f9-c664a632c0e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "538ae89b-2b54-45f7-a980-286bbb12e481", + "ETag" : "\"0x8D732FDD844189F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f7643b5-401e-003a-5be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "5dbf0747-47ad-4614-82f9-c664a632c0e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fe41dddb-8907-4fef-af64-84e6f2cfbd5c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7643ca-401e-003a-6ae6-6473d5000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac0842359f90c12aaf7d4046Fri, 06 Sep 2019 19:10:10 GMT\"0x8D732FDD6DF4364\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "fe41dddb-8907-4fef-af64-84e6f2cfbd5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0842359f90c12aaf7d4046?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" : "e55afce2-cf3f-4d88-8208-12294c0f76c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7643df-401e-003a-7be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "e55afce2-cf3f-4d88-8208-12294c0f76c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac0842359f90c12aaf7d4046", "javablobstartincrementalcopyac1437259bad95a9e23d4", "javablobstartincrementalcopyac297191f98b812f8ce04" ] +} \ 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..345fe87f5130 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json @@ -0,0 +1,277 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10?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" : "7c3b745d-4045-4641-ae82-78145b62f35a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD85578EC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7643f4-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "7c3b745d-4045-4641-ae82-78145b62f35a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac14392145ed017b3f004", + "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" : "6a0c6ac1-b437-49e2-8041-b58259b05b45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD85B4FA3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76440f-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "6a0c6ac1-b437-49e2-8041-b58259b05b45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e116bb0a-639e-4352-83a8-2fc3933fe795", + "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" : "\"0x8D732FDD861D376\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764424-401e-003a-38e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "e116bb0a-639e-4352-83a8-2fc3933fe795" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac14392145ed017b3f004?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", + "x-ms-client-request-id" : "d6f2090a-0be8-4d10-b867-a8f1f70435ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:13.5032824Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD85B4FA3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764438-401e-003a-47e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "d6f2090a-0be8-4d10-b867-a8f1f70435ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac2160164b497e29889c4?comp=incrementalcopy", + "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" : "1e5d8f0b-bd13-4fe9-905d-bac16f41d263" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d401a1b7-a242-43a2-90ad-1d4bd2b4d81d", + "ETag" : "\"0x8D732FDD87BD7AF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f764473-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "x-ms-client-request-id" : "1e5d8f0b-bd13-4fe9-905d-bac16f41d263" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac2160164b497e29889c4", + "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" : "fd823665-f9ba-4556-9e64-b2ff0a7c9e05" + }, + "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" : "Fri, 06 Sep 2019 19:10: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" : "Fri, 06 Sep 2019 19:10:13 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f764492-401e-003a-1ae6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "d401a1b7-a242-43a2-90ad-1d4bd2b4d81d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac14392145ed017b3f004?snapshot=2019-09-06T19:10:13.5032824Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 06 Sep 2019 19:10:12 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD87BD7AF\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "fd823665-f9ba-4556-9e64-b2ff0a7c9e05" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac2160164b497e29889c4", + "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" : "7edc4e7d-288c-427f-8060-0a835d234797" + }, + "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-06T19:10:13.7164790Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10: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" : "Fri, 06 Sep 2019 19:10:13 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f76461f-401e-003a-72e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "d401a1b7-a242-43a2-90ad-1d4bd2b4d81d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac14392145ed017b3f004?snapshot=2019-09-06T19:10:13.5032824Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:13 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:13 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDD87BD7AF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "7edc4e7d-288c-427f-8060-0a835d234797" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac14392145ed017b3f004?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", + "x-ms-client-request-id" : "2ac34de9-3e47-41f4-b65d-465b56f44606" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:15.7503663Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD85B4FA3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76479e-401e-003a-34e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:14 GMT", + "x-ms-client-request-id" : "2ac34de9-3e47-41f4-b65d-465b56f44606" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10/javablobstartincrementalcopyac2160164b497e29889c4?comp=incrementalcopy", + "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" : "74a684bf-fd0b-4b64-ad0c-cabe6a92d510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "eac88803-8b83-448c-843c-c96105f9a043", + "ETag" : "\"0x8D732FDD9C6CEB6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f7647b0-401e-003a-45e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:14 GMT", + "x-ms-client-request-id" : "74a684bf-fd0b-4b64-ad0c-cabe6a92d510" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d8310a1c-d0af-4b48-b4e1-1d2956e3d940" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7647bf-401e-003a-51e6-6473d5000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac078384ff768bb004874e10Fri, 06 Sep 2019 19:10:13 GMT\"0x8D732FDD861D376\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:14 GMT", + "x-ms-client-request-id" : "d8310a1c-d0af-4b48-b4e1-1d2956e3d940", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac078384ff768bb004874e10?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" : "b44f9265-51b5-46b8-8bab-81491c137478" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7647c5-401e-003a-57e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:14 GMT", + "x-ms-client-request-id" : "b44f9265-51b5-46b8-8bab-81491c137478" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac078384ff768bb004874e10", "javablobstartincrementalcopyac14392145ed017b3f004", "javablobstartincrementalcopyac2160164b497e29889c4" ] +} \ 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..902978ffe67a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047?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" : "5c005ef4-9358-461f-a57f-8480df4b651d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD9D8A6B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7647d9-401e-003a-65e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:14 GMT", + "x-ms-client-request-id" : "5c005ef4-9358-461f-a57f-8480df4b651d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047/javablobstartincrementalcopyacfail196858956ad60af94", + "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" : "3afc6541-34b9-429d-8683-ca37ad4ba068" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD9DEF056\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7647ed-401e-003a-73e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "3afc6541-34b9-429d-8683-ca37ad4ba068" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "39def779-569a-4075-8777-dd684fc0b874", + "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" : "\"0x8D732FDD9E5C373\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764805-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "39def779-569a-4075-8777-dd684fc0b874" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047/javablobstartincrementalcopyacfail196858956ad60af94?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", + "x-ms-client-request-id" : "0617c0a2-a2b7-4b22-95d1-6fe0bf6d5702" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:16.0426370Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD9DEF056\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76481b-401e-003a-19e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "0617c0a2-a2b7-4b22-95d1-6fe0bf6d5702" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047/javablobstartincrementalcopyacfail2551691bd11abbeda?comp=incrementalcopy", + "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" : "1c2daf16-ab04-42ea-9f55-334b7a1ac27f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "21305462-7e0f-4b8e-932f-ef766d2f08d7", + "ETag" : "\"0x8D732FDD9F53CBD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f764837-401e-003a-31e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "1c2daf16-ab04-42ea-9f55-334b7a1ac27f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047/javablobstartincrementalcopyacfail196858956ad60af94?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", + "x-ms-client-request-id" : "9e27b460-6d89-4e3e-9d60-37fc4f247034" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:16.1497366Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD9DEF056\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764856-401e-003a-4ce6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "9e27b460-6d89-4e3e-9d60-37fc4f247034" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047/javablobstartincrementalcopyacfail2551691bd11abbeda?comp=incrementalcopy", + "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" : "70af1e30-a739-49bc-9ec6-513e51169b22" + }, + "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" : "8f764879-401e-003a-68e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f764879-401e-003a-68e6-6473d5000000\nTime:2019-09-06T19:10:16.2086294Z", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "70af1e30-a739-49bc-9ec6-513e51169b22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4b5fa1c6-32c2-4daf-bb3b-bd87bf21761c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76488f-401e-003a-7ce6-6473d5000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail02581178d9517a8dd047Fri, 06 Sep 2019 19:10:16 GMT\"0x8D732FDD9E5C373\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "4b5fa1c6-32c2-4daf-bb3b-bd87bf21761c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail02581178d9517a8dd047?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" : "232be997-fc8f-4028-b07e-28ad009522bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7648a2-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "232be997-fc8f-4028-b07e-28ad009522bc" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail02581178d9517a8dd047", "javablobstartincrementalcopyacfail196858956ad60af94", "javablobstartincrementalcopyacfail2551691bd11abbeda" ] +} \ 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..c29326bbb73d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144?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" : "0285eb1a-f485-435e-9ad2-667c2b5b3c06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA183026\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7648bb-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "0285eb1a-f485-435e-9ad2-667c2b5b3c06" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144/javablobstartincrementalcopyacfail168654cd5048b3adf", + "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" : "cd0b0630-ebf9-4ffe-8e7f-40618788d3a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA1EA092\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7648d3-401e-003a-37e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "cd0b0630-ebf9-4ffe-8e7f-40618788d3a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7be2297c-d498-4ad7-a2e4-23cc76bdcb2b", + "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" : "\"0x8D732FDDA24FE86\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7648eb-401e-003a-4ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "7be2297c-d498-4ad7-a2e4-23cc76bdcb2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144/javablobstartincrementalcopyacfail168654cd5048b3adf?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", + "x-ms-client-request-id" : "eaa7c535-8653-4e48-8f8a-5c35c4e7b38f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:16.4540188Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA1EA092\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7648f9-401e-003a-58e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "eaa7c535-8653-4e48-8f8a-5c35c4e7b38f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144/javablobstartincrementalcopyacfail218799203182a25da?comp=incrementalcopy", + "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" : "ab893013-6b82-464e-8dfb-ec45561802d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "30b6cee2-e3cb-460d-9dba-822fb5704c08", + "ETag" : "\"0x8D732FDDA31DEFA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f76490b-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "ab893013-6b82-464e-8dfb-ec45561802d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144/javablobstartincrementalcopyacfail168654cd5048b3adf?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", + "x-ms-client-request-id" : "2d4bdc38-f03b-4c27-8e4d-6ff54e98c1de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:16.5410999Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA1EA092\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764924-401e-003a-80e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "2d4bdc38-f03b-4c27-8e4d-6ff54e98c1de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144/javablobstartincrementalcopyacfail218799203182a25da?comp=incrementalcopy", + "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" : "660b18dc-4a26-4ac7-bc8f-73b59f4e78dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "PendingCopyOperation", + "retry-after" : "0", + "Content-Length" : "233", + "StatusCode" : "409", + "x-ms-request-id" : "8f764935-401e-003a-0ee6-6473d5000000", + "Body" : "PendingCopyOperationThere is currently a pending copy operation.\nRequestId:8f764935-401e-003a-0ee6-6473d5000000\nTime:2019-09-06T19:10:16.5829860Z", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "660b18dc-4a26-4ac7-bc8f-73b59f4e78dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1913e45c-ce0a-4d0b-a5ec-dc1382909eed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764946-401e-003a-1de6-6473d5000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail0980795c1967354a9144Fri, 06 Sep 2019 19:10:16 GMT\"0x8D732FDDA24FE86\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "1913e45c-ce0a-4d0b-a5ec-dc1382909eed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0980795c1967354a9144?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" : "5f63ca87-9b88-4c8c-b9ad-f89fa41e49de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f764955-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "5f63ca87-9b88-4c8c-b9ad-f89fa41e49de" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail0980795c1967354a9144", "javablobstartincrementalcopyacfail168654cd5048b3adf", "javablobstartincrementalcopyacfail218799203182a25da" ] +} \ 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..9dd73f5fb78d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148?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" : "f0c53bb9-ac97-48cf-ae4b-be32418c7e0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA508BED\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764967-401e-003a-3de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "f0c53bb9-ac97-48cf-ae4b-be32418c7e0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148/javablobstartincrementalcopyacfail130036e5d213f8977", + "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" : "5f6b6eb2-461a-4458-9cc3-fd439a8cf2b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA5B42BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764978-401e-003a-4de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "5f6b6eb2-461a-4458-9cc3-fd439a8cf2b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3ee07946-2e8a-4909-8508-32baabc6c513", + "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" : "\"0x8D732FDDA6DD8D6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7649b9-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "3ee07946-2e8a-4909-8508-32baabc6c513" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148/javablobstartincrementalcopyacfail130036e5d213f8977?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", + "x-ms-client-request-id" : "891112ee-0710-44d0-b119-04ad4614806d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:16.9324627Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA5B42BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7649c9-401e-003a-0be6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:15 GMT", + "x-ms-client-request-id" : "891112ee-0710-44d0-b119-04ad4614806d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148/javablobstartincrementalcopyacfail25624850507d7d02e?comp=incrementalcopy", + "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" : "a0711e90-0d71-42ac-8b7c-b981ead9d477" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "3ff4907a-8931-49c1-962b-a303164c4a12", + "ETag" : "\"0x8D732FDDA7A1CAC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f7649d6-401e-003a-18e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "a0711e90-0d71-42ac-8b7c-b981ead9d477" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148/javablobstartincrementalcopyacfail130036e5d213f8977?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", + "x-ms-client-request-id" : "15baaa9d-6d84-4986-a698-320b71d60326" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:17.0125388Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDA5B42BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7649f6-401e-003a-35e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "15baaa9d-6d84-4986-a698-320b71d60326" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148/javablobstartincrementalcopyacfail25624850507d7d02e?comp=incrementalcopy", + "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" : "8dae2b83-87bb-443b-bed8-8f7dd3e2179e" + }, + "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" : "8f764a33-401e-003a-6de6-6473d5000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:8f764a33-401e-003a-6de6-6473d5000000\nTime:2019-09-06T19:10:17.1325081Z", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "8dae2b83-87bb-443b-bed8-8f7dd3e2179e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bbb25598-aef9-4de7-9c6d-7075cbeffc89" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764a42-401e-003a-79e6-6473d5000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail01098023243f867ab148Fri, 06 Sep 2019 19:10:16 GMT\"0x8D732FDDA6DD8D6\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "bbb25598-aef9-4de7-9c6d-7075cbeffc89", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail01098023243f867ab148?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" : "cc75b22b-13eb-4dd3-957f-a2b1d73e022c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f764a51-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "cc75b22b-13eb-4dd3-957f-a2b1d73e022c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail01098023243f867ab148", "javablobstartincrementalcopyacfail130036e5d213f8977", "javablobstartincrementalcopyacfail25624850507d7d02e" ] +} \ 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..962e4b850324 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48?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" : "cd1dcd2e-a370-4729-951d-6da365212fc8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDAAA0C5E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764a5c-401e-003a-10e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "cd1dcd2e-a370-4729-951d-6da365212fc8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail184860572fa9caedb", + "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" : "7e905481-a94f-4bc0-b02b-15fb44b2165e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDABD7741\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764aa9-401e-003a-51e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "7e905481-a94f-4bc0-b02b-15fb44b2165e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5394f73f-c954-4241-a181-eeb74c39dc79", + "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" : "\"0x8D732FDDAC33952\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764ab6-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "5394f73f-c954-4241-a181-eeb74c39dc79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail184860572fa9caedb?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", + "x-ms-client-request-id" : "24882d8a-6ccc-4a3c-8619-8e7743d79915" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:17.4909808Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDABD7741\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764ac2-401e-003a-67e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "24882d8a-6ccc-4a3c-8619-8e7743d79915" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail204859289a4830295?comp=incrementalcopy", + "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" : "f0b8c8c7-8312-41d4-bfce-c89b97ca68fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ead4a4a4-94a6-4344-b13d-dcbe27d24880", + "ETag" : "\"0x8D732FDDACF55C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f764ad3-401e-003a-77e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "f0b8c8c7-8312-41d4-bfce-c89b97ca68fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail184860572fa9caedb?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", + "x-ms-client-request-id" : "ec6904db-9f66-4501-88a7-02ebe9b0431a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:17.5710556Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDABD7741\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764ae9-401e-003a-07e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "ec6904db-9f66-4501-88a7-02ebe9b0431a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail204859289a4830295", + "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" : "c815794b-65c4-4e34-89c4-262dae439e9d" + }, + "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-06T19:10:17.5760600Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 06 Sep 2019 19:10: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" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "8f764af6-401e-003a-12e6-6473d5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "ead4a4a4-94a6-4344-b13d-dcbe27d24880", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail184860572fa9caedb?snapshot=2019-09-06T19:10:17.4909808Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-copy-completion-time" : "Fri, 06 Sep 2019 19:10:17 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDDACF55C9\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "c815794b-65c4-4e34-89c4-262dae439e9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48/javablobstartincrementalcopyacfail204859289a4830295?comp=incrementalcopy", + "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" : "30a72a21-d66f-4668-b382-e171342fb9e5" + }, + "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" : "8f764afc-401e-003a-18e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f764afc-401e-003a-18e6-6473d5000000\nTime:2019-09-06T19:10:17.6490009Z", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "30a72a21-d66f-4668-b382-e171342fb9e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ffb3d9f7-428c-464b-86ef-0402d35ff76e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764b15-401e-003a-2ee6-6473d5000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail0318638587aabeb0da48Fri, 06 Sep 2019 19:10:17 GMT\"0x8D732FDDAC33952\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "ffb3d9f7-428c-464b-86ef-0402d35ff76e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0318638587aabeb0da48?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" : "70f644e5-2291-4a51-b59f-fadc6930dc79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f764b24-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "70f644e5-2291-4a51-b59f-fadc6930dc79" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail0318638587aabeb0da48", "javablobstartincrementalcopyacfail184860572fa9caedb", "javablobstartincrementalcopyacfail204859289a4830295" ] +} \ 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..fffe0ade1990 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror06636764d3f427984a4a?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" : "37fb08b4-095a-45a2-b792-5cce87443960" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDAFB4D64\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764b38-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "37fb08b4-095a-45a2-b792-5cce87443960" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror06636764d3f427984a4a/javablobstartincrementalcopyerror193447d4103ed1fff0", + "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" : "54a3fa7c-628a-4bc0-a87b-560a9637a389" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDB0B82C1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764b8c-401e-003a-13e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:16 GMT", + "x-ms-client-request-id" : "54a3fa7c-628a-4bc0-a87b-560a9637a389" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror06636764d3f427984a4a/javablobstartincrementalcopyerror271245d7359a9fbad2?comp=incrementalcopy", + "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" : "5bbd6dd5-b133-468e-83c0-84e006abe64a" + }, + "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" : "8f764b96-401e-003a-1de6-6473d5000000", + "Body" : "InvalidSourceBlobUrlThe source url for incremental copy request must be valid azure storage blob url.\nRequestId:8f764b96-401e-003a-1de6-6473d5000000\nTime:2019-09-06T19:10:17.9733085Z", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "5bbd6dd5-b133-468e-83c0-84e006abe64a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "59f6185d-22f8-495a-bbfd-ff0b478019ab" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764ba0-401e-003a-27e6-6473d5000000", + "Body" : "jtcstartincrementalcopyerrorjtcstartincrementalcopyerror06636764d3f427984a4aFri, 06 Sep 2019 19:10:17 GMT\"0x8D732FDDAFB4D64\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "59f6185d-22f8-495a-bbfd-ff0b478019ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror06636764d3f427984a4a?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" : "1c0f8841-68ef-4356-b70e-97befccf4978" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f764bb0-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "1c0f8841-68ef-4356-b70e-97befccf4978" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyerror06636764d3f427984a4a", "javablobstartincrementalcopyerror193447d4103ed1fff0", "javablobstartincrementalcopyerror271245d7359a9fbad2" ] +} \ 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..d138b1b6c32a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json @@ -0,0 +1,155 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin05227889fc56f2e6f04b8?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" : "784006ef-188f-48ad-ba77-3ecba2e90ee4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD29B14B7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7631dc-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:02 GMT", + "x-ms-client-request-id" : "784006ef-188f-48ad-ba77-3ecba2e90ee4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin05227889fc56f2e6f04b8/javablobstartincrementalcopymin134514304fa18fb1584", + "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" : "6a418fff-719d-420a-b405-48c65918ceef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD2AE64CF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763236-401e-003a-09e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:10:02 GMT", + "x-ms-client-request-id" : "6a418fff-719d-420a-b405-48c65918ceef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin05227889fc56f2e6f04b8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6ab65ca9-315d-43cb-8b96-bd3c12cff52e", + "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" : "\"0x8D732FDD2B384CD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76323f-401e-003a-11e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:02 GMT", + "x-ms-client-request-id" : "6ab65ca9-315d-43cb-8b96-bd3c12cff52e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin05227889fc56f2e6f04b8/javablobstartincrementalcopymin134514304fa18fb1584?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", + "x-ms-client-request-id" : "1a60fda1-b69b-4399-aa8d-4ff4ff33ce83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:10:03.9704322Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDD2AE64CF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f763257-401e-003a-26e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "1a60fda1-b69b-4399-aa8d-4ff4ff33ce83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin05227889fc56f2e6f04b8/javablobstartincrementalcopymin216576e3dd2dc0ca6b4?comp=incrementalcopy", + "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" : "1fb09a75-b9a1-4352-85a2-a854c141accb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c93abc34-9f79-488c-9156-92f1f3f4a0e7", + "ETag" : "\"0x8D732FDD2D1FAD1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "8f7632a5-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "1fb09a75-b9a1-4352-85a2-a854c141accb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "53e7749d-dbb6-4329-bf0a-d3381d3e8d58" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7632bc-401e-003a-7fe6-6473d5000000", + "Body" : "jtcstartincrementalcopyminjtcstartincrementalcopymin05227889fc56f2e6f04b8Fri, 06 Sep 2019 19:10:03 GMT\"0x8D732FDD2B384CD\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "53e7749d-dbb6-4329-bf0a-d3381d3e8d58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin05227889fc56f2e6f04b8?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" : "ce90bae6-226b-42fc-b71e-16205e780129" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7632d3-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:03 GMT", + "x-ms-client-request-id" : "ce90bae6-226b-42fc-b71e-16205e780129" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopymin05227889fc56f2e6f04b8", "javablobstartincrementalcopymin134514304fa18fb1584", "javablobstartincrementalcopymin216576e3dd2dc0ca6b4" ] +} \ 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..f58aa24125d2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage360463769ad463f7?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" : "1c294945-7ae5-4cca-8b6a-c1feafabd0cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB825DC57\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fc60-001e-001f-30e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "1c294945-7ae5-4cca-8b6a-c1feafabd0cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage360463769ad463f7/javablobuploadpage1pageblobapitestuploadpage360798287fa5d", + "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" : "9f2a3c08-97ec-477d-a8e2-731bce3f43ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB83095C2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fc91-001e-001f-5be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "x-ms-client-request-id" : "9f2a3c08-97ec-477d-a8e2-731bce3f43ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage360463769ad463f7/javablobuploadpage1pageblobapitestuploadpage360798287fa5d?comp=page", + "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" : "4c8d2cfe-786f-4d9f-bdbe-7bd4040ba601", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "COCrbL97wow=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:18 GMT", + "ETag" : "\"0x8D732FDB8379C48\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65fcb0-001e-001f-76e6-64eb66000000", + "x-ms-client-request-id" : "4c8d2cfe-786f-4d9f-bdbe-7bd4040ba601" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ad541a20-71bf-4045-b4fd-2f8369a727a6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fcc1-001e-001f-06e6-64eb66000000", + "Body" : "jtcuploadpagejtcuploadpage0pageblobapitestuploadpage360463769ad463f7Fri, 06 Sep 2019 19:09:19 GMT\"0x8D732FDB825DC57\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "ad541a20-71bf-4045-b4fd-2f8369a727a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage360463769ad463f7?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" : "e05954f2-e488-467d-8d95-81f223180619" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fcdb-001e-001f-1de6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "e05954f2-e488-467d-8d95-81f223180619" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpage0pageblobapitestuploadpage360463769ad463f7", "javablobuploadpage1pageblobapitestuploadpage360798287fa5d", "f39d6f86-3ad9-4d86-bd15-ccdff4cc6c95" ] +} \ 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..e3ee56280d6b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4a8703604adc14?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" : "8567d077-e200-473d-8156-25a225e7bf52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8FE8D14\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ddbb-401e-003a-26e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "8567d077-e200-473d-8156-25a225e7bf52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4a8703604adc14/javablobuploadpageac1pageblobapitestuploadpageac4a8778591a0", + "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" : "870d5c21-4520-4b06-a2d3-e3fe8582ed4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB90B9961\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ddef-401e-003a-56e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "870d5c21-4520-4b06-a2d3-e3fe8582ed4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4a8703604adc14/javablobuploadpageac1pageblobapitestuploadpageac4a8778591a0?comp=page", + "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" : "28184b18-8355-4dd8-9328-2524a644eeda", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "iPPdsrZJNMQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "ETag" : "\"0x8D732FDB91BC9DE\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75de2d-401e-003a-11e6-6473d5000000", + "x-ms-client-request-id" : "28184b18-8355-4dd8-9328-2524a644eeda" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "69b4a804-a06c-429e-99dd-96761f0edc3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75de43-401e-003a-26e6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac4a8703604adc14Fri, 06 Sep 2019 19:09:20 GMT\"0x8D732FDB8FE8D14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "69b4a804-a06c-429e-99dd-96761f0edc3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4a8703604adc14?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" : "296e11a0-aefb-494d-9a99-2bf5cae442d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75de57-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "296e11a0-aefb-494d-9a99-2bf5cae442d6" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac4a8703604adc14", "javablobuploadpageac1pageblobapitestuploadpageac4a8778591a0", "c3fc26c6-a7f6-4b45-97dc-6112c9f8464e" ] +} \ 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..0cd66d0a2a1c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc49073547c40d0?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" : "e0c6807f-eaf0-484b-aee5-e773be1da49b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB92C379C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75de89-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "e0c6807f-eaf0-484b-aee5-e773be1da49b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc49073547c40d0/javablobuploadpageac1pageblobapitestuploadpageacc4948317e28", + "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" : "7c770bc0-9485-43ed-8f3a-0800587c1a15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB9328B98\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75dea6-401e-003a-02e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "7c770bc0-9485-43ed-8f3a-0800587c1a15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc49073547c40d0/javablobuploadpageac1pageblobapitestuploadpageacc4948317e28?comp=page", + "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" : "2e882c39-307b-43e8-b6a0-b30f2642e2ff", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Gzw2To6ARl0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "ETag" : "\"0x8D732FDB9383238\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75deb7-401e-003a-13e6-6473d5000000", + "x-ms-client-request-id" : "2e882c39-307b-43e8-b6a0-b30f2642e2ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4d64bd0e-8089-4d3a-b6c1-3becc511613f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75dedd-401e-003a-35e6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacc49073547c40d0Fri, 06 Sep 2019 19:09:21 GMT\"0x8D732FDB92C379C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "4d64bd0e-8089-4d3a-b6c1-3becc511613f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc49073547c40d0?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" : "c57897b1-71a7-4ccf-8cf8-0ce61fad79bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75def8-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "c57897b1-71a7-4ccf-8cf8-0ce61fad79bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacc49073547c40d0", "javablobuploadpageac1pageblobapitestuploadpageacc4948317e28", "832986df-7b05-47ba-af9e-3e0e365cb702" ] +} \ 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..d635a5657a74 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac02493827704ce3?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" : "45b8968f-cbde-45e9-8963-3fe6837791a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB94DF8A6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75df1d-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "45b8968f-cbde-45e9-8963-3fe6837791a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac02493827704ce3/javablobuploadpageac1pageblobapitestuploadpageac02446311df7", + "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" : "e9e7605f-1541-4eb5-9632-eda34f74b408" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB954E8CE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75df47-401e-003a-16e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "e9e7605f-1541-4eb5-9632-eda34f74b408" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac02493827704ce3/javablobuploadpageac1pageblobapitestuploadpageac02446311df7?comp=page", + "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" : "2e0b8a40-3f0a-4851-897e-5fbf5c0a766f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "SLz/N91N890=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "ETag" : "\"0x8D732FDB969600B\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75dfaf-401e-003a-74e6-6473d5000000", + "x-ms-client-request-id" : "2e0b8a40-3f0a-4851-897e-5fbf5c0a766f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8abb68cc-926f-4330-a8ac-69b993496366" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75dfc3-401e-003a-06e6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac02493827704ce3Fri, 06 Sep 2019 19:09:21 GMT\"0x8D732FDB94DF8A6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "8abb68cc-926f-4330-a8ac-69b993496366", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac02493827704ce3?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" : "bae14e22-16c0-4df6-91ec-c70218eadefe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75dfdc-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "bae14e22-16c0-4df6-91ec-c70218eadefe" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac02493827704ce3", "javablobuploadpageac1pageblobapitestuploadpageac02446311df7", "a95d5a69-5258-46cd-b945-46655445d2ed" ] +} \ 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..66b580a0cc29 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca17656074fc886?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" : "83a42d59-3988-4e78-a4fd-a1883ba9ff8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB97E8A5B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75dff6-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "83a42d59-3988-4e78-a4fd-a1883ba9ff8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca17656074fc886/javablobuploadpageac1pageblobapitestuploadpageaca1755342ec3", + "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" : "3cf67fde-99a6-41f1-89ec-a1b0f7719bfe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB9A873CF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e0c1-401e-003a-70e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "3cf67fde-99a6-41f1-89ec-a1b0f7719bfe" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca17656074fc886/javablobuploadpageac1pageblobapitestuploadpageaca1755342ec3", + "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" : "f61d427c-d35e-4a33-8dc5-1f449dac7c2d" + }, + "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" : "Fri, 06 Sep 2019 19:09:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:21 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" : "\"0x8D732FDB9A873CF\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:21 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f75e0e4-401e-003a-11e6-6473d5000000", + "x-ms-client-request-id" : "f61d427c-d35e-4a33-8dc5-1f449dac7c2d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca17656074fc886/javablobuploadpageac1pageblobapitestuploadpageaca1755342ec3?comp=page", + "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" : "ded887ac-8700-4419-b408-bf272f459b7a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "kRycgPw2epE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "ETag" : "\"0x8D732FDB9B659D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75e0f9-401e-003a-26e6-6473d5000000", + "x-ms-client-request-id" : "ded887ac-8700-4419-b408-bf272f459b7a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4855fa6d-8d6a-4708-ab15-06a440c6b8aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e10d-401e-003a-39e6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageaca17656074fc886Fri, 06 Sep 2019 19:09:21 GMT\"0x8D732FDB97E8A5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "4855fa6d-8d6a-4708-ab15-06a440c6b8aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca17656074fc886?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" : "2fb63154-cc92-4755-947e-e227f355d948" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e126-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "2fb63154-cc92-4755-947e-e227f355d948" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageaca17656074fc886", "javablobuploadpageac1pageblobapitestuploadpageaca1755342ec3", "44c16571-ff59-4e7c-a721-6d719dbeff2c" ] +} \ 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..69b785185678 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac72f990054c224f?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" : "388628f1-ad90-4332-a8b4-567f7694df59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB9E7C60A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e1bc-401e-003a-5be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "388628f1-ad90-4332-a8b4-567f7694df59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac72f990054c224f/javablobuploadpageac1pageblobapitestuploadpageac72f94555d19", + "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" : "76fc89cb-09ac-428c-a9b9-3be03b86bd47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB9EE670B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e1e1-401e-003a-7ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "76fc89cb-09ac-428c-a9b9-3be03b86bd47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac72f990054c224f/javablobuploadpageac1pageblobapitestuploadpageac72f94555d19?comp=page", + "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" : "6355bda1-a449-439f-82c1-63ec1b8dbb5f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "toEnCiyALoU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "ETag" : "\"0x8D732FDB9F3E6A3\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75e201-401e-003a-18e6-6473d5000000", + "x-ms-client-request-id" : "6355bda1-a449-439f-82c1-63ec1b8dbb5f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1fb07593-8c04-4c3f-8aaa-e4da0a81c369" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e217-401e-003a-2de6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac72f990054c224fFri, 06 Sep 2019 19:09:22 GMT\"0x8D732FDB9E7C60A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "1fb07593-8c04-4c3f-8aaa-e4da0a81c369", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac72f990054c224f?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" : "d981e03c-b460-4f10-8dac-e20d98bb074d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e229-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "d981e03c-b460-4f10-8dac-e20d98bb074d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac72f990054c224f", "javablobuploadpageac1pageblobapitestuploadpageac72f94555d19", "5034798f-cf4c-419a-814a-4fedca8636f3" ] +} \ 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..24e0c9b0129e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0?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" : "2bf8a6d0-bf7f-494a-9edb-db8330ec707d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA089C80\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e249-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "2bf8a6d0-bf7f-494a-9edb-db8330ec707d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0/javablobuploadpageac1pageblobapitestuploadpageacad448163147", + "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" : "40493ad1-ca38-4c04-ad94-fa711feffbbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA0EA0F3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e25d-401e-003a-6be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "40493ad1-ca38-4c04-ad94-fa711feffbbe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0/javablobuploadpageac1pageblobapitestuploadpageacad448163147?comp=lease", + "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" : "2be75a1d-b2a0-4e98-acc3-810df47393d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA0EA0F3\"", + "x-ms-lease-id" : "5d443104-abff-4d1a-bbfe-e070491860f2", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e285-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "2be75a1d-b2a0-4e98-acc3-810df47393d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0/javablobuploadpageac1pageblobapitestuploadpageacad448163147?comp=page", + "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" : "ffe6142d-553e-4c6e-a4cc-fd20eebb987a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Y+OTy/EdUac=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "ETag" : "\"0x8D732FDBA19A002\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75e2a1-401e-003a-19e6-6473d5000000", + "x-ms-client-request-id" : "ffe6142d-553e-4c6e-a4cc-fd20eebb987a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6e462659-1130-4c41-acc2-f27bb075ed18" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e2bd-401e-003a-2ae6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0Fri, 06 Sep 2019 19:09:22 GMT\"0x8D732FDBA089C80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "6e462659-1130-4c41-acc2-f27bb075ed18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0?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" : "a2c5f17b-5eea-4741-bafd-ec45f7f09249" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e2d4-401e-003a-3de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "a2c5f17b-5eea-4741-bafd-ec45f7f09249" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacad445909a17cd0", "javablobuploadpageac1pageblobapitestuploadpageacad448163147", "ca1fbb1e-0d4e-4958-b64d-a99a68bb8157" ] +} \ 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..d513798a04b0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace8b54578477129?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" : "60153868-fa69-4179-ab12-59a336879181" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA2F40B7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e300-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:21 GMT", + "x-ms-client-request-id" : "60153868-fa69-4179-ab12-59a336879181" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace8b54578477129/javablobuploadpageac1pageblobapitestuploadpageace8b14402dc8", + "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" : "f10c74a0-b65a-4b26-b3f4-e3c3b20f6d6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA4463BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e350-401e-003a-22e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "f10c74a0-b65a-4b26-b3f4-e3c3b20f6d6f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace8b54578477129/javablobuploadpageac1pageblobapitestuploadpageace8b14402dc8?comp=page", + "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" : "fc870283-878f-4784-bfdf-b0feb9cbd351", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "WoeWpX92gQs=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "ETag" : "\"0x8D732FDBA4A5886\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75e371-401e-003a-39e6-6473d5000000", + "x-ms-client-request-id" : "fc870283-878f-4784-bfdf-b0feb9cbd351" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8535498f-0bf1-4b9a-b39e-80948c364ec7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e388-401e-003a-4de6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageace8b54578477129Fri, 06 Sep 2019 19:09:22 GMT\"0x8D732FDBA2F40B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "8535498f-0bf1-4b9a-b39e-80948c364ec7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace8b54578477129?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" : "04c400d4-ea77-4aea-8d45-beb2f9b2ef34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e39f-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "04c400d4-ea77-4aea-8d45-beb2f9b2ef34" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageace8b54578477129", "javablobuploadpageac1pageblobapitestuploadpageace8b14402dc8", "5a734595-6634-42c7-981e-907e39ba0c1b" ] +} \ 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..4f0c9641bdd6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca0826648369df5?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" : "a73cd97f-e8d9-44e8-a9d4-d27ca5e04276" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA6355B4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e3fa-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "a73cd97f-e8d9-44e8-a9d4-d27ca5e04276" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca0826648369df5/javablobuploadpageac1pageblobapitestuploadpageaca086913995e", + "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" : "f2703f22-fcd6-43b1-be12-5bf0fa00a3ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA72AA9E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e424-401e-003a-46e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "f2703f22-fcd6-43b1-be12-5bf0fa00a3ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca0826648369df5/javablobuploadpageac1pageblobapitestuploadpageaca086913995e?comp=page", + "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" : "27153f28-9cde-4700-9584-3097e4d7ce10", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "jrpVpqViTa8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "ETag" : "\"0x8D732FDBA82DB12\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75e463-401e-003a-79e6-6473d5000000", + "x-ms-client-request-id" : "27153f28-9cde-4700-9584-3097e4d7ce10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cb172899-825a-4009-9f42-c9ae6530ebe5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e478-401e-003a-0ae6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageaca0826648369df5Fri, 06 Sep 2019 19:09:23 GMT\"0x8D732FDBA6355B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "cb172899-825a-4009-9f42-c9ae6530ebe5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageaca0826648369df5?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" : "2fef6b53-ef7e-43d8-a8bd-f8f79253489b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e48c-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "2fef6b53-ef7e-43d8-a8bd-f8f79253489b" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageaca0826648369df5", "javablobuploadpageac1pageblobapitestuploadpageaca086913995e", "257ecfb8-08a8-4bc5-a23d-7128da5dbd4d" ] +} \ 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..9a7f52683501 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac9739383380c14a?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" : "a28dd26f-763e-40b8-8019-70e7a719dbe4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA9483CF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e4aa-401e-003a-32e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "a28dd26f-763e-40b8-8019-70e7a719dbe4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac9739383380c14a/javablobuploadpageac1pageblobapitestuploadpageac973388738c4", + "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" : "13ca1361-fbaa-4ea4-9b35-d10dcf8e9ab8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBA9AD58C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e4c5-401e-003a-4be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "13ca1361-fbaa-4ea4-9b35-d10dcf8e9ab8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac9739383380c14a/javablobuploadpageac1pageblobapitestuploadpageac973388738c4?comp=page", + "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" : "bdb25020-b067-4da7-bf8f-8580ef13e8cf", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "jjwGgz8Hgno=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "ETag" : "\"0x8D732FDBAA44DC3\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75e4e8-401e-003a-6ce6-6473d5000000", + "x-ms-client-request-id" : "bdb25020-b067-4da7-bf8f-8580ef13e8cf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "86589f56-5f91-400e-bb09-5a6e9e5ebd9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e4fb-401e-003a-7ae6-6473d5000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac9739383380c14aFri, 06 Sep 2019 19:09:23 GMT\"0x8D732FDBA9483CF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "86589f56-5f91-400e-bb09-5a6e9e5ebd9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac9739383380c14a?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" : "19425be6-db95-442c-84a1-f0c93405b24b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e505-401e-003a-03e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "19425be6-db95-442c-84a1-f0c93405b24b" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac9739383380c14a", "javablobuploadpageac1pageblobapitestuploadpageac973388738c4", "ee159e65-a23e-4df8-a326-64949d2f0755" ] +} \ 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..a6c07a488a4a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail9fd1022178?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" : "ad750b2a-9409-460c-987a-afdfb57f058d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBAB4488C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e51c-401e-003a-18e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "ad750b2a-9409-460c-987a-afdfb57f058d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail9fd1022178/javablobuploadpageacfail144521d0a8159635fb404b", + "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" : "5374ad96-e5f2-49dd-9d9e-b02f0f2383ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBABA4BE5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e53e-401e-003a-35e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "5374ad96-e5f2-49dd-9d9e-b02f0f2383ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail9fd1022178/javablobuploadpageacfail144521d0a8159635fb404b?comp=page", + "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" : "5b09cc5d-b859-4fc2-948f-e638f17cb8b9", + "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" : "8f75e557-401e-003a-48e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75e557-401e-003a-48e6-6473d5000000\nTime:2019-09-06T19:09:23.7517217Z", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "5b09cc5d-b859-4fc2-948f-e638f17cb8b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "57c09de9-41e4-408d-8194-cd1de31f3b5e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e575-401e-003a-61e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail9fd1022178Fri, 06 Sep 2019 19:09:23 GMT\"0x8D732FDBAB4488C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "57c09de9-41e4-408d-8194-cd1de31f3b5e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail9fd1022178?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" : "efd0e562-6395-4c76-996d-6a9cba4579e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e57f-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:22 GMT", + "x-ms-client-request-id" : "efd0e562-6395-4c76-996d-6a9cba4579e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail9fd1022178", "javablobuploadpageacfail144521d0a8159635fb404b", "08d9d65e-0c38-49a6-bc23-9b167b227382" ] +} \ 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..040013dc7daa --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3432432a3?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" : "dcf93bba-fcf9-4820-99e8-db7c1622c510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBAD60992\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e5a4-401e-003a-05e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "dcf93bba-fcf9-4820-99e8-db7c1622c510" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3432432a3/javablobuploadpageacfail144049a6edf58770574e92", + "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" : "bd1c6d88-5ede-445d-b9e8-67699e52358c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBAE07A9B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e5c9-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "bd1c6d88-5ede-445d-b9e8-67699e52358c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3432432a3/javablobuploadpageacfail144049a6edf58770574e92?comp=page", + "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" : "6066cdd7-4755-4b5b-8b7f-1b47be481c19", + "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" : "8f75e604-401e-003a-56e6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75e604-401e-003a-56e6-6473d5000000\nTime:2019-09-06T19:09:24.0540093Z", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "6066cdd7-4755-4b5b-8b7f-1b47be481c19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2a6e1ff-cbc2-4554-8242-fdbb2266cc63" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e62f-401e-003a-78e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfaile3432432a3Fri, 06 Sep 2019 19:09:23 GMT\"0x8D732FDBAD60992\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "d2a6e1ff-cbc2-4554-8242-fdbb2266cc63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3432432a3?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" : "36cc1c48-3f96-464e-9f2c-5b1b901e5d51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e649-401e-003a-0fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "36cc1c48-3f96-464e-9f2c-5b1b901e5d51" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfaile3432432a3", "javablobuploadpageacfail144049a6edf58770574e92", "3c2360de-36f3-42d9-8213-1bdddeff85ed" ] +} \ 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..82c94f292919 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail82285809e6?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" : "4af6313e-7f6b-466d-ba80-3c2bc89be2be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB005837\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e66b-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "4af6313e-7f6b-466d-ba80-3c2bc89be2be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail82285809e6/javablobuploadpageacfail1008693f5159ed34464e67", + "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" : "ae082a9b-aded-4182-9c52-a8cd05b0a85a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB063403\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e68f-401e-003a-4ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "ae082a9b-aded-4182-9c52-a8cd05b0a85a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail82285809e6/javablobuploadpageacfail1008693f5159ed34464e67?comp=page", + "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" : "7e1045cb-2d6f-4c5b-a637-868765e68d77", + "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" : "8f75e6b6-401e-003a-6ee6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75e6b6-401e-003a-6ee6-6473d5000000\nTime:2019-09-06T19:09:24.2441903Z", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "7e1045cb-2d6f-4c5b-a637-868765e68d77", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b4a84d27-b00e-43d7-9768-8d95eed72754" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e6d0-401e-003a-06e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail82285809e6Fri, 06 Sep 2019 19:09:24 GMT\"0x8D732FDBB005837\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "b4a84d27-b00e-43d7-9768-8d95eed72754", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail82285809e6?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" : "0167a29a-1920-4e0a-b043-1518e45317f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e6ed-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "0167a29a-1920-4e0a-b043-1518e45317f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail82285809e6", "javablobuploadpageacfail1008693f5159ed34464e67", "4824ca94-d2d2-4a0a-b7a7-ed9408ded4da" ] +} \ 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..cf6d2fc68e8f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654?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" : "fcb80457-5bc9-4769-8a6b-e1681c07e3a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB1FF5D8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e70e-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "fcb80457-5bc9-4769-8a6b-e1681c07e3a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654/javablobuploadpageacfail135461d24e950b39ab44b1", + "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" : "120d90b0-0a3a-48ff-a722-3724a66bf571" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB2ED44E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e77e-401e-003a-1fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "120d90b0-0a3a-48ff-a722-3724a66bf571" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654/javablobuploadpageacfail135461d24e950b39ab44b1", + "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" : "4943cc8a-69aa-4780-a81d-86e4371a8ea1" + }, + "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" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19: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" : "\"0x8D732FDBB2ED44E\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:24 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f75e79e-401e-003a-3ae6-6473d5000000", + "x-ms-client-request-id" : "4943cc8a-69aa-4780-a81d-86e4371a8ea1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654/javablobuploadpageacfail135461d24e950b39ab44b1?comp=page", + "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" : "9a572e92-1be4-45b4-8597-3abec4ef1bc9", + "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" : "8f75e7b7-401e-003a-4fe6-6473d5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75e7b7-401e-003a-4fe6-6473d5000000\nTime:2019-09-06T19:09:24.5414729Z", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "9a572e92-1be4-45b4-8597-3abec4ef1bc9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6171a8aa-3dc4-4cfd-a829-f611bd0d2914" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e7d0-401e-003a-62e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654Fri, 06 Sep 2019 19:09:24 GMT\"0x8D732FDBB1FF5D8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "6171a8aa-3dc4-4cfd-a829-f611bd0d2914", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654?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" : "f18b7a7a-ae65-4f66-bed8-fe0d36641c87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e7ec-401e-003a-7ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "f18b7a7a-ae65-4f66-bed8-fe0d36641c87" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail15a4328654", "javablobuploadpageacfail135461d24e950b39ab44b1", "22e2e7c3-74ca-4792-9fd9-e2c2b4399e57" ] +} \ 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..a4fa46f8e00d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174a?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" : "8796ec81-0c7b-4015-a2fb-b27d6fb7a38a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB49F640\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e810-401e-003a-1fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "8796ec81-0c7b-4015-a2fb-b27d6fb7a38a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174a/javablobuploadpageacfail121742ade1742e9d2f4bca", + "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" : "07d229af-421f-4b18-a9a6-69648755d9c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB4F836C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e828-401e-003a-35e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "07d229af-421f-4b18-a9a6-69648755d9c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174a/javablobuploadpageacfail121742ade1742e9d2f4bca?comp=lease", + "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" : "297d5740-4847-46be-b6f2-2caf6b7764a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB4F836C\"", + "x-ms-lease-id" : "8280c416-46f2-4ecb-acc7-49126f73b05b", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e846-401e-003a-4fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "297d5740-4847-46be-b6f2-2caf6b7764a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174a/javablobuploadpageacfail121742ade1742e9d2f4bca?comp=page", + "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" : "46d60f0a-4b49-422c-8e83-d6045496dcf8", + "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" : "8f75e863-401e-003a-6be6-6473d5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:8f75e863-401e-003a-6be6-6473d5000000\nTime:2019-09-06T19:09:24.7596810Z", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "46d60f0a-4b49-422c-8e83-d6045496dcf8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "85904e92-97cf-43de-bf60-e27d8951ff5e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e875-401e-003a-7be6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174aFri, 06 Sep 2019 19:09:24 GMT\"0x8D732FDBB49F640\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "85904e92-97cf-43de-bf60-e27d8951ff5e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174a?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" : "feee5aa7-c5c6-4a5d-b725-86da5cf9fd36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e888-401e-003a-0ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:23 GMT", + "x-ms-client-request-id" : "feee5aa7-c5c6-4a5d-b725-86da5cf9fd36" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail10c614174a", "javablobuploadpageacfail121742ade1742e9d2f4bca", "871a2a98-6f89-46f6-bf7d-f238bab7d931" ] +} \ 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..4f8194dd6368 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila63505979d?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" : "17387d2c-e9a9-4344-b2c3-070b406aadb5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB730C10\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e8a9-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "17387d2c-e9a9-4344-b2c3-070b406aadb5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila63505979d/javablobuploadpageacfail1936096ef52154f2f345d9", + "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" : "194663c3-3380-468e-b15d-ba02507e5ede" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB7D06E2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e8f7-401e-003a-73e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "194663c3-3380-468e-b15d-ba02507e5ede" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila63505979d/javablobuploadpageacfail1936096ef52154f2f345d9?comp=page", + "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" : "e4e17cca-f64e-4b50-971b-c6cedcf2d2e9", + "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" : "8f75e916-401e-003a-0ee6-6473d5000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:8f75e916-401e-003a-0ee6-6473d5000000\nTime:2019-09-06T19:09:25.0279362Z", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "e4e17cca-f64e-4b50-971b-c6cedcf2d2e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d584e04d-b378-434f-90f7-754cc7e23c63" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e92b-401e-003a-22e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfaila63505979dFri, 06 Sep 2019 19:09:24 GMT\"0x8D732FDBB730C10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "d584e04d-b378-434f-90f7-754cc7e23c63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila63505979d?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" : "9895d60d-1989-4dfe-9c0e-4c66e0f321d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e952-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "9895d60d-1989-4dfe-9c0e-4c66e0f321d7" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfaila63505979d", "javablobuploadpageacfail1936096ef52154f2f345d9", "ba8ca961-12c8-4b3b-9497-75b71ae6e35f" ] +} \ 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..a2ecc3c0a8af --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila113842852?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" : "6af6e9f2-9c9a-4052-a828-417f903529ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB96F085\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e973-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "6af6e9f2-9c9a-4052-a828-417f903529ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila113842852/javablobuploadpageacfail120759ef73f57ed71241d7", + "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" : "1d4767af-ef1b-4048-b8b6-817292b7bb20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBB9EEED8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e99a-401e-003a-7ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "1d4767af-ef1b-4048-b8b6-817292b7bb20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila113842852/javablobuploadpageacfail120759ef73f57ed71241d7?comp=page", + "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" : "c8f2de85-9003-46e2-94eb-2e9fd9dc6108", + "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" : "8f75e9ac-401e-003a-08e6-6473d5000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:8f75e9ac-401e-003a-08e6-6473d5000000\nTime:2019-09-06T19:09:25.2501471Z", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "c8f2de85-9003-46e2-94eb-2e9fd9dc6108", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15f7a88a-d7d7-4bbc-8344-1ae2727619ae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75e9b9-401e-003a-15e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfaila113842852Fri, 06 Sep 2019 19:09:25 GMT\"0x8D732FDBB96F085\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "15f7a88a-d7d7-4bbc-8344-1ae2727619ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaila113842852?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" : "33c06345-dc52-4d49-80d2-617ff73eaec3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75e9c9-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "33c06345-dc52-4d49-80d2-617ff73eaec3" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfaila113842852", "javablobuploadpageacfail120759ef73f57ed71241d7", "49f65e1f-a267-42c7-9782-152cae972919" ] +} \ 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..4b46c646c0d6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail30390658d7?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" : "f145624d-193a-4042-b44b-7698711fb9db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBBBC5BF0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75e9e9-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "f145624d-193a-4042-b44b-7698711fb9db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail30390658d7/javablobuploadpageacfail1097392da850e3c3484ba7", + "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" : "8075f7cd-f223-4922-997a-5bef1e45a52b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBBCBAEDD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ea68-401e-003a-29e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "8075f7cd-f223-4922-997a-5bef1e45a52b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail30390658d7/javablobuploadpageacfail1097392da850e3c3484ba7?comp=page", + "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" : "441436f4-7930-4f98-ba7b-4d2a10a023e7", + "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" : "8f75ea86-401e-003a-44e6-6473d5000000", + "Body" : "SequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:8f75ea86-401e-003a-44e6-6473d5000000\nTime:2019-09-06T19:09:25.5454283Z", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "441436f4-7930-4f98-ba7b-4d2a10a023e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "587867cd-9d46-47db-9dda-a101a1ba2a39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ea9c-401e-003a-58e6-6473d5000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail30390658d7Fri, 06 Sep 2019 19:09:25 GMT\"0x8D732FDBBBC5BF0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "587867cd-9d46-47db-9dda-a101a1ba2a39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail30390658d7?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" : "9d9f557e-3f6d-45fe-a6f8-d616cc07385f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75eab4-401e-003a-6fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "9d9f557e-3f6d-45fe-a6f8-d616cc07385f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail30390658d7", "javablobuploadpageacfail1097392da850e3c3484ba7", "0c86d890-c510-4f15-b297-3f563c16b048" ] +} \ 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..1ed497396d61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror127234923be?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" : "4fa2f0d9-fe23-4713-b6b8-6f67af8be1f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBBEB1872\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ead4-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "4fa2f0d9-fe23-4713-b6b8-6f67af8be1f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror127234923be/javablobuploadpageerror1pageblobapitestuploadpageerror12705984", + "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" : "5a28aebc-b671-4bd4-acea-660e72e32f43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBBFA1CF6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75eb31-401e-003a-5de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "5a28aebc-b671-4bd4-acea-660e72e32f43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror127234923be/javablobuploadpageerror2pageblobapitestuploadpageerror12799022?comp=page", + "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" : "fb724e5b-ab50-4c90-ade7-82d3f5f08c34", + "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" : "8f75eb53-401e-003a-79e6-6473d5000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:8f75eb53-401e-003a-79e6-6473d5000000\nTime:2019-09-06T19:09:25.8447128Zx-ms-lease-idid", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "fb724e5b-ab50-4c90-ade7-82d3f5f08c34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "489db46a-8ae2-4feb-bd1b-82eb0f2c9b35" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75eb63-401e-003a-09e6-6473d5000000", + "Body" : "jtcuploadpageerrorjtcuploadpageerror0pageblobapitestuploadpageerror127234923beFri, 06 Sep 2019 19:09:25 GMT\"0x8D732FDBBEB1872\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:24 GMT", + "x-ms-client-request-id" : "489db46a-8ae2-4feb-bd1b-82eb0f2c9b35", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror127234923be?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" : "61dd5a2f-b538-4a64-8669-76a13f35259b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75eb7a-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "61dd5a2f-b538-4a64-8669-76a13f35259b" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageerror0pageblobapitestuploadpageerror127234923be", "javablobuploadpageerror1pageblobapitestuploadpageerror12705984", "javablobuploadpageerror2pageblobapitestuploadpageerror12799022", "add98a4d-7df0-4a9a-b2a6-179608f701b3" ] +} \ 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..6970e3c5547d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37?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" : "423b93c7-0183-48b6-b232-cc3dd9faf219" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBD1D7A71\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f012-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "423b93c7-0183-48b6-b232-cc3dd9faf219" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37/javablobuploadpagefromurldestinationac1791260f7ec166a", + "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" : "3ffb451d-7cae-461d-8ecf-2ae732d8d5b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBD23C896\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f026-401e-003a-36e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "3ffb451d-7cae-461d-8ecf-2ae732d8d5b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "31774e1f-6af7-4c01-b852-e27896d08fdb", + "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" : "\"0x8D732FDBD313FCB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f054-401e-003a-5fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "31774e1f-6af7-4c01-b852-e27896d08fdb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37/javablobuploadpagefromurldestinationac280393942d7203e", + "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" : "ac223fed-8b47-49ad-9b5b-664cc0fb5f5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBD36B8BE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f06a-401e-003a-73e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "ac223fed-8b47-49ad-9b5b-664cc0fb5f5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37/javablobuploadpagefromurldestinationac280393942d7203e?comp=page", + "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" : "90b5cc0f-8ce8-4e52-a82f-d1bf62204f84", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Rajh1VTUtl8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "ETag" : "\"0x8D732FDBD3C5F68\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f07b-401e-003a-04e6-6473d5000000", + "x-ms-client-request-id" : "90b5cc0f-8ce8-4e52-a82f-d1bf62204f84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37/javablobuploadpagefromurldestinationac1791260f7ec166a?comp=page", + "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" : "efdea98f-4be0-45bd-9049-5a78403e5adf" + }, + "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" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "Content-MD5" : "uqn32fbRHSPq2Hm+MTks2A==", + "ETag" : "\"0x8D732FDBD4D2C45\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f0ad-401e-003a-33e6-6473d5000000", + "x-ms-client-request-id" : "efdea98f-4be0-45bd-9049-5a78403e5adf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c9b9a2b4-faeb-42d5-b618-d2ef84afbdc5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f0de-401e-003a-61e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0944784c952d8e0a37Fri, 06 Sep 2019 19:09:27 GMT\"0x8D732FDBD313FCB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "c9b9a2b4-faeb-42d5-b618-d2ef84afbdc5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0944784c952d8e0a37?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" : "94155f89-d574-4b1d-b2f6-41e5b436f712" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f0fc-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "94155f89-d574-4b1d-b2f6-41e5b436f712" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0944784c952d8e0a37", "javablobuploadpagefromurldestinationac1791260f7ec166a", "javablobuploadpagefromurldestinationac280393942d7203e", "15f0d839-d7fd-46a9-b20a-544f4aa341f5" ] +} \ 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..faab6a2de1ee --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735?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" : "c30af18c-9714-4e3a-82fd-12767f43f06f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBD61E717\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f134-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "c30af18c-9714-4e3a-82fd-12767f43f06f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735/javablobuploadpagefromurldestinationac1351932f24675dc", + "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" : "7b6c1be3-69e9-4b2e-9a16-f797703b9f96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBD6A3105\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f15f-401e-003a-54e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "7b6c1be3-69e9-4b2e-9a16-f797703b9f96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c62e7745-1e14-4166-aff4-87967bf8b913", + "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" : "\"0x8D732FDBD6F9057\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f179-401e-003a-6ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "c62e7745-1e14-4166-aff4-87967bf8b913" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735/javablobuploadpagefromurldestinationac220966e701e7f44", + "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" : "0c93e225-818d-4e53-a893-e58e3028fe4f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBD7493BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f18d-401e-003a-7fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "0c93e225-818d-4e53-a893-e58e3028fe4f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735/javablobuploadpagefromurldestinationac220966e701e7f44?comp=page", + "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" : "5495b17a-9be7-4e60-9767-6776eaa56719", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ifv4BiyyxGw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "ETag" : "\"0x8D732FDBD7AD6D4\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f1a9-401e-003a-1ae6-6473d5000000", + "x-ms-client-request-id" : "5495b17a-9be7-4e60-9767-6776eaa56719" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735/javablobuploadpagefromurldestinationac1351932f24675dc?comp=page", + "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" : "cb7fe4e4-aedd-44f2-8afc-7f3e881bc753" + }, + "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" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "Content-MD5" : "ZzJWr1wHUGEIsHwvejprWQ==", + "ETag" : "\"0x8D732FDBD9BAD05\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f1c8-401e-003a-34e6-6473d5000000", + "x-ms-client-request-id" : "cb7fe4e4-aedd-44f2-8afc-7f3e881bc753" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0a62becf-8cb0-4dc3-9b66-c1a7d5a7ecdb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f243-401e-003a-25e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac062076a3790ec4b735Fri, 06 Sep 2019 19:09:28 GMT\"0x8D732FDBD6F9057\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "0a62becf-8cb0-4dc3-9b66-c1a7d5a7ecdb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac062076a3790ec4b735?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" : "0e5da7d9-bb31-4717-9718-8df6a81b65ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f25d-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "0e5da7d9-bb31-4717-9718-8df6a81b65ba" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac062076a3790ec4b735", "javablobuploadpagefromurldestinationac1351932f24675dc", "javablobuploadpagefromurldestinationac220966e701e7f44", "fb18eea7-c426-4bc3-8008-c7a45c1b7085" ] +} \ 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..373f4a5be131 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8?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" : "fed8b123-44ab-485b-b859-de9e246ebfed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBDB54B94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f276-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "fed8b123-44ab-485b-b859-de9e246ebfed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8/javablobuploadpagefromurldestinationac13093548a0af232", + "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" : "93f01460-36ad-4080-9a0a-70a85e9e1e95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBDBEF4D8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f2ca-401e-003a-20e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "93f01460-36ad-4080-9a0a-70a85e9e1e95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "299e3bf1-d788-4d49-9674-d565cc67f588", + "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" : "\"0x8D732FDBDC5B46B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f2dc-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "299e3bf1-d788-4d49-9674-d565cc67f588" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8/javablobuploadpagefromurldestinationac238745e2ce9c245", + "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" : "e0063a0f-908c-4e4d-8355-85442d980ca1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBDCAB776\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f2ef-401e-003a-40e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:27 GMT", + "x-ms-client-request-id" : "e0063a0f-908c-4e4d-8355-85442d980ca1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8/javablobuploadpagefromurldestinationac238745e2ce9c245?comp=page", + "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" : "fdce155d-ef30-4dba-980f-da2370f836f8", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "uVWfFMesimc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "ETag" : "\"0x8D732FDBDD148C1\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f2fa-401e-003a-4be6-6473d5000000", + "x-ms-client-request-id" : "fdce155d-ef30-4dba-980f-da2370f836f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8/javablobuploadpagefromurldestinationac13093548a0af232?comp=page", + "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" : "7ba125d9-15ef-453f-80bc-3a0a0f44162e" + }, + "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" : "Fri, 06 Sep 2019 19:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "Content-MD5" : "JSNUFH5eJ9pkFVAn0mCKqg==", + "ETag" : "\"0x8D732FDBDD8010B\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f311-401e-003a-61e6-6473d5000000", + "x-ms-client-request-id" : "7ba125d9-15ef-453f-80bc-3a0a0f44162e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "365e1e05-e9ee-4991-a101-45e45116d37c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f32f-401e-003a-7ae6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac083332818c8c94dbc8Fri, 06 Sep 2019 19:09:28 GMT\"0x8D732FDBDC5B46B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "365e1e05-e9ee-4991-a101-45e45116d37c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac083332818c8c94dbc8?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" : "33ef6b3a-0b49-43b3-a975-dd0ec8fdaf16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f345-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "33ef6b3a-0b49-43b3-a975-dd0ec8fdaf16" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac083332818c8c94dbc8", "javablobuploadpagefromurldestinationac13093548a0af232", "javablobuploadpagefromurldestinationac238745e2ce9c245", "be8af997-813f-48c4-b7db-dd1e333b7f06" ] +} \ 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..6e2140b4dadb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635?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" : "98a19042-e083-462c-a5cf-daf168cfebbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBDEAE787\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f365-401e-003a-2ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "98a19042-e083-462c-a5cf-daf168cfebbf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635/javablobuploadpagefromurldestinationac191596587c66097", + "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" : "9a210605-a81c-4075-8b98-30592179288c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBDF4424A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f393-401e-003a-4be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "9a210605-a81c-4075-8b98-30592179288c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0dfb93bf-1d0d-4dbb-b9f1-096c766adb98", + "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" : "\"0x8D732FDBDFA65BE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f3ac-401e-003a-61e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "0dfb93bf-1d0d-4dbb-b9f1-096c766adb98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635/javablobuploadpagefromurldestinationac244535e9e110d2e", + "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" : "4232fcde-9d58-4a6d-87c4-e039880057c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBDFFDDD5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f3c1-401e-003a-74e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "4232fcde-9d58-4a6d-87c4-e039880057c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635/javablobuploadpagefromurldestinationac244535e9e110d2e?comp=page", + "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" : "da786c90-1b79-4d4b-b219-e3f8ae57a727", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "eHLHjIFodHI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "ETag" : "\"0x8D732FDBE05D2A8\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f3d4-401e-003a-03e6-6473d5000000", + "x-ms-client-request-id" : "da786c90-1b79-4d4b-b219-e3f8ae57a727" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635/javablobuploadpagefromurldestinationac191596587c66097", + "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" : "652635ca-c954-48de-94cf-efb4bde3bdc0" + }, + "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" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09: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" : "\"0x8D732FDBDF4424A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:29 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f75f3ee-401e-003a-19e6-6473d5000000", + "x-ms-client-request-id" : "652635ca-c954-48de-94cf-efb4bde3bdc0", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635/javablobuploadpagefromurldestinationac191596587c66097?comp=page", + "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" : "6fd8c5af-13b0-460b-b02c-7a0e3b34a252" + }, + "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" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "Content-MD5" : "1nSBMonGgWQkjzPO6H8A3Q==", + "ETag" : "\"0x8D732FDBE20B40F\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f406-401e-003a-2ee6-6473d5000000", + "x-ms-client-request-id" : "6fd8c5af-13b0-460b-b02c-7a0e3b34a252" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0fe6a9a0-a29e-451e-962e-c40056fe76db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f463-401e-003a-80e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac00636424b721fea635Fri, 06 Sep 2019 19:09:29 GMT\"0x8D732FDBDFA65BE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "0fe6a9a0-a29e-451e-962e-c40056fe76db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac00636424b721fea635?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" : "66e340ba-fbe3-48de-aa7c-91c3fa9fb14e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f47a-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "66e340ba-fbe3-48de-aa7c-91c3fa9fb14e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac00636424b721fea635", "javablobuploadpagefromurldestinationac191596587c66097", "javablobuploadpagefromurldestinationac244535e9e110d2e", "8c94fe91-eefc-43fd-932b-05f236f821f3" ] +} \ 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..2f0fe587ba76 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8?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" : "4eab40de-4fea-41a5-8a28-51769ec80e9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE387E2D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f498-401e-003a-30e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "4eab40de-4fea-41a5-8a28-51769ec80e9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8/javablobuploadpagefromurldestinationac1635111f1111359", + "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" : "917962c6-f3c1-42f7-a0b4-1a53edbdb804" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE4B77BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f4d6-401e-003a-62e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "917962c6-f3c1-42f7-a0b4-1a53edbdb804" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7e8910a9-8798-4754-91c9-b0e7753acf90", + "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" : "\"0x8D732FDBE5062AB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f4e4-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "7e8910a9-8798-4754-91c9-b0e7753acf90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8/javablobuploadpagefromurldestinationac2073246954e4ab5", + "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" : "4b5000a4-ab27-42fe-b161-dcae077da343" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE560193\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f4fd-401e-003a-08e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "x-ms-client-request-id" : "4b5000a4-ab27-42fe-b161-dcae077da343" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8/javablobuploadpagefromurldestinationac2073246954e4ab5?comp=page", + "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" : "a48e863e-f312-4650-9e05-d71fb6b95e16", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ksjZt4xWWgk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:28 GMT", + "ETag" : "\"0x8D732FDBE5D2F31\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f518-401e-003a-22e6-6473d5000000", + "x-ms-client-request-id" : "a48e863e-f312-4650-9e05-d71fb6b95e16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8/javablobuploadpagefromurldestinationac1635111f1111359?comp=page", + "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" : "613602cb-f65d-4fa6-91eb-f823880da662" + }, + "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" : "Fri, 06 Sep 2019 19:09:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "Content-MD5" : "ffm2mGQfeigRqsiL2B8m+g==", + "ETag" : "\"0x8D732FDBE6AC6F4\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f52d-401e-003a-34e6-6473d5000000", + "x-ms-client-request-id" : "613602cb-f65d-4fa6-91eb-f823880da662" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "060c7767-76b4-4062-80ae-180189922a3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f575-401e-003a-72e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0856535fe9789762d8Fri, 06 Sep 2019 19:09:29 GMT\"0x8D732FDBE5062AB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "060c7767-76b4-4062-80ae-180189922a3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0856535fe9789762d8?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" : "2f33baac-ae29-4568-bbf5-21984a1c6f6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f585-401e-003a-01e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "2f33baac-ae29-4568-bbf5-21984a1c6f6a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0856535fe9789762d8", "javablobuploadpagefromurldestinationac1635111f1111359", "javablobuploadpagefromurldestinationac2073246954e4ab5", "06472923-7b38-4ef3-8824-2523f3e9fe1f" ] +} \ 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..e0d46a1e9e62 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839?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" : "91ad8f52-fd0e-4d45-8749-6a602c8cde5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE8774B6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f5b8-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "91ad8f52-fd0e-4d45-8749-6a602c8cde5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839/javablobuploadpagefromurldestinationac133247a634f8bd9", + "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" : "00cb9cae-21bf-4497-bc43-516072379062" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE8DE7AC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f5d9-401e-003a-4be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "00cb9cae-21bf-4497-bc43-516072379062" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "53c3c9d1-8c3b-45a9-8c74-8578ad7d88e1", + "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" : "\"0x8D732FDBE93BD69\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f5f4-401e-003a-60e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "53c3c9d1-8c3b-45a9-8c74-8578ad7d88e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839/javablobuploadpagefromurldestinationac2054626a4b54c67", + "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" : "cb8f70c4-0c4a-41ab-91b3-3bcedd5e91da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE9AE318\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f612-401e-003a-7be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "cb8f70c4-0c4a-41ab-91b3-3bcedd5e91da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839/javablobuploadpagefromurldestinationac2054626a4b54c67?comp=page", + "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" : "e1f052b0-9ce0-426b-8b1e-1f7a81042e59", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AHp57jqy/6w=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "ETag" : "\"0x8D732FDBEA3E5EE\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f621-401e-003a-0ae6-6473d5000000", + "x-ms-client-request-id" : "e1f052b0-9ce0-426b-8b1e-1f7a81042e59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839/javablobuploadpagefromurldestinationac133247a634f8bd9?comp=lease", + "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" : "0d747d9e-3860-4b7a-b5c5-f7fa371acc99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBE8DE7AC\"", + "x-ms-lease-id" : "4189f07c-7f75-46ec-92eb-72d07291ce4c", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f645-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "0d747d9e-3860-4b7a-b5c5-f7fa371acc99" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839/javablobuploadpagefromurldestinationac133247a634f8bd9?comp=page", + "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" : "527f73c6-e1ac-4ef1-a6aa-4b6c0aa4ba44" + }, + "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" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "Content-MD5" : "/TQhCu88yBO2CO1MM/8iuw==", + "ETag" : "\"0x8D732FDBEB947BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f65b-401e-003a-40e6-6473d5000000", + "x-ms-client-request-id" : "527f73c6-e1ac-4ef1-a6aa-4b6c0aa4ba44" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "96cd6777-999b-4ce8-aa9b-ed939181fa48" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f69f-401e-003a-7ce6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac006036eaf92ef29839Fri, 06 Sep 2019 19:09:30 GMT\"0x8D732FDBE93BD69\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "96cd6777-999b-4ce8-aa9b-ed939181fa48", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac006036eaf92ef29839?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" : "ee431d3c-5ec7-4f92-b691-6bb91c5fe979" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f6ae-401e-003a-0be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "ee431d3c-5ec7-4f92-b691-6bb91c5fe979" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac006036eaf92ef29839", "javablobuploadpagefromurldestinationac133247a634f8bd9", "javablobuploadpagefromurldestinationac2054626a4b54c67", "46a360e7-13d0-494e-91d8-7a6420f15b51" ] +} \ 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..dbdc98d3a68e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6?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" : "541317d8-ec25-4cdb-b71f-a9b349183446" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBED6B977\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f6cc-401e-003a-26e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "541317d8-ec25-4cdb-b71f-a9b349183446" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6/javablobuploadpagefromurldestinationac157014fa9e23620", + "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" : "9c0caeca-0d4c-4d05-8610-fed7ea8f0f6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBEE8522A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f722-401e-003a-74e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "9c0caeca-0d4c-4d05-8610-fed7ea8f0f6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2c19a825-17d1-441b-8001-347a957e670e", + "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" : "\"0x8D732FDBEED1670\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f738-401e-003a-0ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "2c19a825-17d1-441b-8001-347a957e670e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6/javablobuploadpagefromurldestinationac268289d5dca39e8", + "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" : "4ca9ab2a-f8f0-404e-baa2-95d075a3dee0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBEF6FBA5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f75b-401e-003a-26e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "x-ms-client-request-id" : "4ca9ab2a-f8f0-404e-baa2-95d075a3dee0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6/javablobuploadpagefromurldestinationac268289d5dca39e8?comp=page", + "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" : "fc0c9d52-5346-458a-9ed7-6fc9c6c89a02", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "SpshsBvag5c=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:29 GMT", + "ETag" : "\"0x8D732FDBEFC541C\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f770-401e-003a-38e6-6473d5000000", + "x-ms-client-request-id" : "fc0c9d52-5346-458a-9ed7-6fc9c6c89a02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6/javablobuploadpagefromurldestinationac157014fa9e23620?comp=page", + "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" : "ec5d205d-e512-46d3-a4e8-3a17652e3066" + }, + "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" : "Fri, 06 Sep 2019 19:09:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "Content-MD5" : "OGFGHHuLm56lhu/yoAL3Bg==", + "ETag" : "\"0x8D732FDBF030C75\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f787-401e-003a-4fe6-6473d5000000", + "x-ms-client-request-id" : "ec5d205d-e512-46d3-a4e8-3a17652e3066" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8d1d5f9b-3259-4986-9707-7000ab6dbb87" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f7a2-401e-003a-68e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac05871563606ec600a6Fri, 06 Sep 2019 19:09:30 GMT\"0x8D732FDBEED1670\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "8d1d5f9b-3259-4986-9707-7000ab6dbb87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac05871563606ec600a6?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" : "e6103565-b11e-4ab9-979e-00b5cf5b6f95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f7ac-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "e6103565-b11e-4ab9-979e-00b5cf5b6f95" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac05871563606ec600a6", "javablobuploadpagefromurldestinationac157014fa9e23620", "javablobuploadpagefromurldestinationac268289d5dca39e8", "30e42d37-d286-4c4c-bf25-85193c22361e" ] +} \ 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..0cedb802ed82 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7?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" : "4426a62d-a217-4705-b494-9a425a743459" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF141F8B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f7c3-401e-003a-02e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "4426a62d-a217-4705-b494-9a425a743459" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7/javablobuploadpagefromurldestinationac19991947fae7a9f", + "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" : "69c0d3f5-7f90-4899-b94f-d5f0618f3478" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF1A6A94\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f7e5-401e-003a-20e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "69c0d3f5-7f90-4899-b94f-d5f0618f3478" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d7609967-7aab-4b78-bc1b-9c6ddc5b4371", + "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" : "\"0x8D732FDBF210430\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f817-401e-003a-49e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "d7609967-7aab-4b78-bc1b-9c6ddc5b4371" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7/javablobuploadpagefromurldestinationac279900f8d7c9305", + "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" : "883db9b0-1e73-40ab-873f-7285fb0b8bf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF28ECEA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f83a-401e-003a-68e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "883db9b0-1e73-40ab-873f-7285fb0b8bf0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7/javablobuploadpagefromurldestinationac279900f8d7c9305?comp=page", + "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" : "00f44bf2-82db-410f-a3d0-2104d13ce700", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "zXzHy7Yt4+k=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "ETag" : "\"0x8D732FDBF2FF37A\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f85d-401e-003a-06e6-6473d5000000", + "x-ms-client-request-id" : "00f44bf2-82db-410f-a3d0-2104d13ce700" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7/javablobuploadpagefromurldestinationac19991947fae7a9f?comp=page", + "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" : "bcbf969d-8607-49a7-862a-e0300829421a" + }, + "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" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "Content-MD5" : "T/V48AmDOi43RJv2Db+NiQ==", + "ETag" : "\"0x8D732FDBF3BB613\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f886-401e-003a-29e6-6473d5000000", + "x-ms-client-request-id" : "bcbf969d-8607-49a7-862a-e0300829421a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ad730f0c-960a-4432-8db9-67e5464965a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f8b4-401e-003a-52e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac039507ebf16ba983d7Fri, 06 Sep 2019 19:09:31 GMT\"0x8D732FDBF210430\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "ad730f0c-960a-4432-8db9-67e5464965a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac039507ebf16ba983d7?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" : "378a9d23-3242-4367-a7ef-c8c66e12789d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f8cd-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "378a9d23-3242-4367-a7ef-c8c66e12789d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac039507ebf16ba983d7", "javablobuploadpagefromurldestinationac19991947fae7a9f", "javablobuploadpagefromurldestinationac279900f8d7c9305", "f176e88b-4eea-4321-adbe-16c48a87b8fa" ] +} \ 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..57cf6d4e35c7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436?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" : "b70a8fc0-0513-436a-9a24-a7049541fa83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF58B34D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f8d9-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "b70a8fc0-0513-436a-9a24-a7049541fa83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436/javablobuploadpagefromurldestinationac185198c967b603f", + "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" : "fd84ccec-ab2a-4427-9d7e-536d53739a52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF64A495\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f91a-401e-003a-2ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "fd84ccec-ab2a-4427-9d7e-536d53739a52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b9e32ffe-8d92-40c9-8468-9c9bc36e8e82", + "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" : "\"0x8D732FDBF6A0597\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f92b-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "b9e32ffe-8d92-40c9-8468-9c9bc36e8e82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436/javablobuploadpagefromurldestinationac264744467bd6ea1", + "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" : "cf1139ef-c980-4527-850b-edb2c5eac4ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF7018F6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f942-401e-003a-47e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "cf1139ef-c980-4527-850b-edb2c5eac4ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436/javablobuploadpagefromurldestinationac264744467bd6ea1?comp=page", + "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" : "81ae5e98-502a-43ab-bd8d-693395dfa8d5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "C3SHOEpzbzY=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "ETag" : "\"0x8D732FDBF76D153\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f955-401e-003a-55e6-6473d5000000", + "x-ms-client-request-id" : "81ae5e98-502a-43ab-bd8d-693395dfa8d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436/javablobuploadpagefromurldestinationac185198c967b603f?comp=page", + "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" : "27a423dd-32e5-4f89-9aca-603cf4a6a23a" + }, + "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" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "Content-MD5" : "sFjMxuEnGuGfeNU/EqaY6g==", + "ETag" : "\"0x8D732FDBF7F5EDB\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f969-401e-003a-67e6-6473d5000000", + "x-ms-client-request-id" : "27a423dd-32e5-4f89-9aca-603cf4a6a23a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9ea08163-1e33-42bc-bc40-3da9bf25451f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f981-401e-003a-7ce6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac033160a88c7f44e436Fri, 06 Sep 2019 19:09:31 GMT\"0x8D732FDBF6A0597\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "9ea08163-1e33-42bc-bc40-3da9bf25451f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac033160a88c7f44e436?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" : "b33774e8-89c2-4883-b72a-c5a8dea48405" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f995-401e-003a-0ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "b33774e8-89c2-4883-b72a-c5a8dea48405" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac033160a88c7f44e436", "javablobuploadpagefromurldestinationac185198c967b603f", "javablobuploadpagefromurldestinationac264744467bd6ea1", "13b872a6-fe75-4742-bb26-c0a2a24c58b7" ] +} \ 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..6f6b3415d647 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6?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" : "377c3ea7-691a-47c2-9fd7-c58cf641b2bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF9247E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f9a4-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "377c3ea7-691a-47c2-9fd7-c58cf641b2bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6/javablobuploadpagefromurldestinationacfail1218225b11106", + "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" : "a0e6df39-e732-4de5-ad3c-48943185bb6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBF997CB8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f9ca-401e-003a-38e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:30 GMT", + "x-ms-client-request-id" : "a0e6df39-e732-4de5-ad3c-48943185bb6b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "312df070-1ddc-46c2-9623-f7d74e6847dc", + "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" : "\"0x8D732FDBF9EDDF4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75f9e1-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "312df070-1ddc-46c2-9623-f7d74e6847dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6/javablobuploadpagefromurldestinationacfail2116264002215", + "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" : "3a32014e-63f8-479d-8557-53a2d28b5c6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBFA3B859\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75f9ef-401e-003a-5be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "3a32014e-63f8-479d-8557-53a2d28b5c6b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6/javablobuploadpagefromurldestinationacfail2116264002215?comp=page", + "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" : "fd345dec-3a9d-4407-8409-99595760bbab", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "YuWtbW4MhR0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "ETag" : "\"0x8D732FDBFA8E9C2\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75f9fe-401e-003a-6ae6-6473d5000000", + "x-ms-client-request-id" : "fd345dec-3a9d-4407-8409-99595760bbab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6/javablobuploadpagefromurldestinationacfail1218225b11106?comp=page", + "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" : "28630e1e-762a-4da4-bafc-17e85ac542f9" + }, + "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" : "8f75fa13-401e-003a-7fe6-6473d5000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75fa13-401e-003a-7fe6-6473d5000000\nTime:2019-09-06T19:09:32.1006652Z", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "28630e1e-762a-4da4-bafc-17e85ac542f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b385b61d-fd1d-41db-8448-26fd93ecdf74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fa5d-401e-003a-41e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail0045045bd9f172c6Fri, 06 Sep 2019 19:09:31 GMT\"0x8D732FDBF9EDDF4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "b385b61d-fd1d-41db-8448-26fd93ecdf74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0045045bd9f172c6?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" : "3966f7e4-6ed5-4e95-ae39-0f7dfa6fceca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75fa73-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "3966f7e4-6ed5-4e95-ae39-0f7dfa6fceca" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail0045045bd9f172c6", "javablobuploadpagefromurldestinationacfail1218225b11106", "javablobuploadpagefromurldestinationacfail2116264002215", "5fc914f5-1a4f-4578-bf12-2d349f0e7e06" ] +} \ 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..a0a2aae15ef6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97?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" : "269ba57d-2f68-4bd2-971e-7e4a3920ebe6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBFCD3C61\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fa8b-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "269ba57d-2f68-4bd2-971e-7e4a3920ebe6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97/javablobuploadpagefromurldestinationacfail15762424db7ae", + "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" : "19f122fb-98b6-4d96-af65-c92b820f2a0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBFD38641\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75faa0-401e-003a-7ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "19f122fb-98b6-4d96-af65-c92b820f2a0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8d90bc55-86ff-438f-b5f7-3f90c2c8c8c2", + "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" : "\"0x8D732FDBFD935D5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fab4-401e-003a-0ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "8d90bc55-86ff-438f-b5f7-3f90c2c8c8c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97/javablobuploadpagefromurldestinationacfail2808243a02e5f", + "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" : "fc2580bc-0a66-4d0e-8a4c-59d10600df82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBFDF48DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75facb-401e-003a-1fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "fc2580bc-0a66-4d0e-8a4c-59d10600df82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97/javablobuploadpagefromurldestinationacfail2808243a02e5f?comp=page", + "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" : "81713c21-377f-4c21-85d1-9b8f7d0cc711", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "UHBRtk30IOc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "ETag" : "\"0x8D732FDBFE5B30D\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75fade-401e-003a-2fe6-6473d5000000", + "x-ms-client-request-id" : "81713c21-377f-4c21-85d1-9b8f7d0cc711" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97/javablobuploadpagefromurldestinationacfail15762424db7ae?comp=page", + "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" : "b7f7651c-6bf6-4f17-9302-5b62cbfca7c4" + }, + "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" : "8f75fae9-401e-003a-3ae6-6473d5000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75fae9-401e-003a-3ae6-6473d5000000\nTime:2019-09-06T19:09:32.4750214Z", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "b7f7651c-6bf6-4f17-9302-5b62cbfca7c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "68111d7b-45c1-4b47-8ecd-1687da5dfc91" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fb18-401e-003a-5fe6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail08788295d668bf97Fri, 06 Sep 2019 19:09:32 GMT\"0x8D732FDBFD935D5\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "68111d7b-45c1-4b47-8ecd-1687da5dfc91", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08788295d668bf97?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" : "ce92c83e-7f13-4bb6-8e8f-fc841a0a5ff1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75fb26-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "ce92c83e-7f13-4bb6-8e8f-fc841a0a5ff1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail08788295d668bf97", "javablobuploadpagefromurldestinationacfail15762424db7ae", "javablobuploadpagefromurldestinationacfail2808243a02e5f", "8bc3340f-7dee-4f13-860f-d03ce358d4a2" ] +} \ 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..70d9e4968696 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50?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" : "1545f7d5-13b3-4ed5-a2ed-f2b40656a780" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC00B8D0F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fb36-401e-003a-77e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "1545f7d5-13b3-4ed5-a2ed-f2b40656a780" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50/javablobuploadpagefromurldestinationacfail133416173ef75", + "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" : "cb4a84d0-8f8d-45ae-bd9c-a49598bddbcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC011D68D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fb43-401e-003a-02e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "cb4a84d0-8f8d-45ae-bd9c-a49598bddbcb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4f11e3cc-ab84-456f-b295-8dd8d218f73c", + "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" : "\"0x8D732FDC017864F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fb5a-401e-003a-12e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "4f11e3cc-ab84-456f-b295-8dd8d218f73c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50/javablobuploadpagefromurldestinationacfail211698dd0709e", + "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" : "ed92b46d-0853-404b-906f-6234f32a4211" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC01E0E74\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fb64-401e-003a-1be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "x-ms-client-request-id" : "ed92b46d-0853-404b-906f-6234f32a4211" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50/javablobuploadpagefromurldestinationacfail211698dd0709e?comp=page", + "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" : "7575ae20-f5f1-4ea2-b716-d01bb943ad4c", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "uKuQhhsJeJg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:31 GMT", + "ETag" : "\"0x8D732FDC0256332\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75fb80-401e-003a-33e6-6473d5000000", + "x-ms-client-request-id" : "7575ae20-f5f1-4ea2-b716-d01bb943ad4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50/javablobuploadpagefromurldestinationacfail133416173ef75?comp=page", + "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" : "a0c1e2ea-b554-4c23-bfbc-5ae849d412f5" + }, + "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" : "8f75fb8b-401e-003a-3ce6-6473d5000000", + "Body" : "\nTargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75fb8b-401e-003a-3ce6-6473d5000000\nTime:2019-09-06T19:09:32.9875090Z", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "a0c1e2ea-b554-4c23-bfbc-5ae849d412f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "92c6fd54-b0f3-4ec7-954e-99b7733a5fc8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fbe5-401e-003a-08e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail043933409582bd50Fri, 06 Sep 2019 19:09:32 GMT\"0x8D732FDC017864F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "92c6fd54-b0f3-4ec7-954e-99b7733a5fc8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail043933409582bd50?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" : "a17436af-b0ab-44e3-9b70-9335e83018f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75fbfa-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "a17436af-b0ab-44e3-9b70-9335e83018f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail043933409582bd50", "javablobuploadpagefromurldestinationacfail133416173ef75", "javablobuploadpagefromurldestinationacfail211698dd0709e", "47988c2a-f416-4ea3-8a3b-c4689cdb4cab" ] +} \ 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..c40184b5d77b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9?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" : "af700a19-1a36-4ffe-93c6-fffb0b21950f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC05F66C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fc0b-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "af700a19-1a36-4ffe-93c6-fffb0b21950f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9/javablobuploadpagefromurldestinationacfail1880477981f11", + "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" : "e67f9188-6110-41be-ae0f-9d01adc53844" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC07E1F97\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fc71-401e-003a-80e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "e67f9188-6110-41be-ae0f-9d01adc53844" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7315ae0d-cf28-4906-90be-e3d3a4c44094", + "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" : "\"0x8D732FDC083CFA4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fc79-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "7315ae0d-cf28-4906-90be-e3d3a4c44094" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9/javablobuploadpagefromurldestinationacfail2058336c37eda", + "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" : "07246571-31f3-4db7-96de-0055afa017f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC08945D4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fc84-401e-003a-11e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "07246571-31f3-4db7-96de-0055afa017f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9/javablobuploadpagefromurldestinationacfail2058336c37eda?comp=page", + "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" : "f6e70290-afa6-4b2b-bc6e-75ec5d8df257", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6MP2lOuX93k=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "ETag" : "\"0x8D732FDC08F3AB0\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75fc9c-401e-003a-26e6-6473d5000000", + "x-ms-client-request-id" : "f6e70290-afa6-4b2b-bc6e-75ec5d8df257" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9/javablobuploadpagefromurldestinationacfail1880477981f11", + "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" : "f3137de0-6f92-4c74-9ac4-4055453c4da5" + }, + "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" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19: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" : "\"0x8D732FDC07E1F97\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:33 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f75fca8-401e-003a-32e6-6473d5000000", + "x-ms-client-request-id" : "f3137de0-6f92-4c74-9ac4-4055453c4da5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9/javablobuploadpagefromurldestinationacfail1880477981f11?comp=page", + "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" : "93a3aae6-4084-463d-aca0-46e5f7bf2dda" + }, + "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" : "8f75fcb2-401e-003a-3be6-6473d5000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:8f75fcb2-401e-003a-3be6-6473d5000000\nTime:2019-09-06T19:09:33.5720647Z", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "93a3aae6-4084-463d-aca0-46e5f7bf2dda", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2c0890a2-a3ad-447a-8664-6a0efa38b1c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fcc5-401e-003a-4ae6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail0121631a4e22a3f9Fri, 06 Sep 2019 19:09:33 GMT\"0x8D732FDC083CFA4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "2c0890a2-a3ad-447a-8664-6a0efa38b1c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0121631a4e22a3f9?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" : "7d70ec9e-93f3-48be-8bff-2760d8f7d738" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75fcd1-401e-003a-56e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "7d70ec9e-93f3-48be-8bff-2760d8f7d738" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail0121631a4e22a3f9", "javablobuploadpagefromurldestinationacfail1880477981f11", "javablobuploadpagefromurldestinationacfail2058336c37eda", "75b8d27a-bbd8-4464-94a5-2b20ddbacc73" ] +} \ 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..4622a30ebba1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6?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" : "daa6f6c7-080f-4f3b-b9be-e40cac4f2713" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC0BF5165\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fd04-401e-003a-80e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "daa6f6c7-080f-4f3b-b9be-e40cac4f2713" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6/javablobuploadpagefromurldestinationacfail191964bd19a8d", + "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" : "950acf37-d582-4556-832a-1edef93265aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC0C5E803\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fd10-401e-003a-0be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "950acf37-d582-4556-832a-1edef93265aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "445886ba-0671-4307-b401-0c93a31529b4", + "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" : "\"0x8D732FDC0CB7129\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fd1c-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:32 GMT", + "x-ms-client-request-id" : "445886ba-0671-4307-b401-0c93a31529b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6/javablobuploadpagefromurldestinationacfail25310286510e2", + "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" : "e41bc02e-9ebe-4051-9daf-022a191d684e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC0D1AAAA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fd2f-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "e41bc02e-9ebe-4051-9daf-022a191d684e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6/javablobuploadpagefromurldestinationacfail25310286510e2?comp=page", + "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" : "81b48f36-48f6-4109-b1ed-023dd96daedd", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "u2ZGw8lvm4Q=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "ETag" : "\"0x8D732FDC0D7030E\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75fd3e-401e-003a-30e6-6473d5000000", + "x-ms-client-request-id" : "81b48f36-48f6-4109-b1ed-023dd96daedd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6/javablobuploadpagefromurldestinationacfail191964bd19a8d?comp=page", + "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" : "9abcbbed-65a3-42d3-9d4d-c0c012f7f1ee" + }, + "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" : "8f75fd4c-401e-003a-3be6-6473d5000000", + "Body" : "\nLeaseNotPresentWithBlobOperationThere is currently no lease on the blob.\nRequestId:8f75fd4c-401e-003a-3be6-6473d5000000\nTime:2019-09-06T19:09:34.0385089Z", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "9abcbbed-65a3-42d3-9d4d-c0c012f7f1ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9dc48ca3-1f22-479d-bfcd-57428a78b217" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fd6b-401e-003a-56e6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail05771253bd32e5e6Fri, 06 Sep 2019 19:09:33 GMT\"0x8D732FDC0CB7129\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "9dc48ca3-1f22-479d-bfcd-57428a78b217", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail05771253bd32e5e6?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" : "195894f7-f76d-4ad5-a18e-f3350fe2e45a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75fd80-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "195894f7-f76d-4ad5-a18e-f3350fe2e45a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail05771253bd32e5e6", "javablobuploadpagefromurldestinationacfail191964bd19a8d", "javablobuploadpagefromurldestinationacfail25310286510e2", "91b3a29c-a168-459d-92ec-3c064ea15cc0" ] +} \ 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..664fe76f9747 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96?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" : "a845b275-4e57-4840-8ed2-65408d99566b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC0F737E7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fd92-401e-003a-79e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "a845b275-4e57-4840-8ed2-65408d99566b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96/javablobuploadpagefromurldestinationacfail151632a00f732", + "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" : "0e15ddae-2dc3-45ae-9754-ba9605b2f609" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC0FDF555\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fda6-401e-003a-09e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "0e15ddae-2dc3-45ae-9754-ba9605b2f609" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8b3e6e2d-fdbb-4448-8396-1ed9d6c6501b", + "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" : "\"0x8D732FDC103CCD0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fdb1-401e-003a-11e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "8b3e6e2d-fdbb-4448-8396-1ed9d6c6501b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96/javablobuploadpagefromurldestinationacfail256828383105b", + "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" : "6b0ab9c7-2959-4834-b321-ca728b7d6c62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC109B7F2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fdc2-401e-003a-1fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "6b0ab9c7-2959-4834-b321-ca728b7d6c62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96/javablobuploadpagefromurldestinationacfail256828383105b?comp=page", + "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" : "a035b993-009c-4bec-900e-f6b1bc86e737", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LQsJVMVOU7g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "ETag" : "\"0x8D732FDC10FFB0D\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75fddd-401e-003a-35e6-6473d5000000", + "x-ms-client-request-id" : "a035b993-009c-4bec-900e-f6b1bc86e737" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96/javablobuploadpagefromurldestinationacfail151632a00f732?comp=page", + "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" : "0d07d329-705b-49c2-9e18-6e35e6f9705c" + }, + "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" : "8f75fdea-401e-003a-42e6-6473d5000000", + "Body" : "\nInvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:8f75fdea-401e-003a-42e6-6473d5000000\nTime:2019-09-06T19:09:34.3818367Zx-ms-if-sequence-number-lt-1", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "0d07d329-705b-49c2-9e18-6e35e6f9705c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b39ce4a9-977a-4245-8fc2-c9bbf515e261" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75fdf5-401e-003a-4be6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail00078018dc0d0f96Fri, 06 Sep 2019 19:09:34 GMT\"0x8D732FDC103CCD0\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "b39ce4a9-977a-4245-8fc2-c9bbf515e261", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail00078018dc0d0f96?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" : "aac4400c-f8ce-41d2-83bc-c471dc2a92ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75fe05-401e-003a-57e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "aac4400c-f8ce-41d2-83bc-c471dc2a92ee" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail00078018dc0d0f96", "javablobuploadpagefromurldestinationacfail151632a00f732", "javablobuploadpagefromurldestinationacfail256828383105b", "07f29a6e-5c4a-4207-bf6b-690462a846d3" ] +} \ 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..ee3510277c4d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a?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" : "24343fd3-26ae-4892-a554-1d9929789ed3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC1318FFD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fe1b-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "24343fd3-26ae-4892-a554-1d9929789ed3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a/javablobuploadpagefromurldestinationacfail143751eb7cf5f", + "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" : "322df6d2-5580-426c-9cf4-220fe76ddece" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC14AC829\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fe60-401e-003a-24e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:33 GMT", + "x-ms-client-request-id" : "322df6d2-5580-426c-9cf4-220fe76ddece" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5d703aa0-2638-4c13-a0ca-cdd9d8def0aa", + "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" : "\"0x8D732FDC1684C0E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75feb9-401e-003a-71e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "5d703aa0-2638-4c13-a0ca-cdd9d8def0aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a/javablobuploadpagefromurldestinationacfail2335361d7f1ab", + "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" : "7d2021d0-ad48-44b6-99a3-e51847ce731f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC16F21AB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75fec8-401e-003a-7ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "7d2021d0-ad48-44b6-99a3-e51847ce731f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a/javablobuploadpagefromurldestinationacfail2335361d7f1ab?comp=page", + "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" : "c8d71567-2f49-4586-8f67-ab5b0b81c64e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AFtSUQq2EMU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "ETag" : "\"0x8D732FDC175B2ED\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75fed7-401e-003a-0ae6-6473d5000000", + "x-ms-client-request-id" : "c8d71567-2f49-4586-8f67-ab5b0b81c64e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a/javablobuploadpagefromurldestinationacfail143751eb7cf5f?comp=page", + "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" : "996ed531-e333-4d23-8981-1064b1ea3b27" + }, + "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" : "8f75fef5-401e-003a-25e6-6473d5000000", + "Body" : "\nInvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:8f75fef5-401e-003a-25e6-6473d5000000\nTime:2019-09-06T19:09:35.0504715Zx-ms-if-sequence-number-le-1", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "996ed531-e333-4d23-8981-1064b1ea3b27", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7ced8ee7-afc7-49fe-ae59-259a22cf32bb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ff0c-401e-003a-3ce6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail0624470c769cdd1aFri, 06 Sep 2019 19:09:34 GMT\"0x8D732FDC1684C0E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "7ced8ee7-afc7-49fe-ae59-259a22cf32bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0624470c769cdd1a?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" : "940c2a3e-13f5-4564-a203-9b277f4478ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75ff21-401e-003a-4ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "940c2a3e-13f5-4564-a203-9b277f4478ff" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail0624470c769cdd1a", "javablobuploadpagefromurldestinationacfail143751eb7cf5f", "javablobuploadpagefromurldestinationacfail2335361d7f1ab", "31632f38-e496-4532-83d2-f414a0d1913e" ] +} \ 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..4399eb180f37 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0?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" : "d21ea66e-d331-4c21-823b-1db518bf84f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC18EE1E5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ff3c-401e-003a-66e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "d21ea66e-d331-4c21-823b-1db518bf84f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0/javablobuploadpagefromurldestinationacfail1683872a33ca8", + "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" : "1b5860d2-8819-4a71-aa9a-90aa0f4c0d3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC197C1F1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ff5d-401e-003a-7de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "1b5860d2-8819-4a71-aa9a-90aa0f4c0d3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc7fba83-1f5d-45e2-96e8-fea796e484a7", + "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" : "\"0x8D732FDC19ED277\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ff6b-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "bc7fba83-1f5d-45e2-96e8-fea796e484a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0/javablobuploadpagefromurldestinationacfail2617694d0742f", + "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" : "2cf17458-a8b4-49f4-9b95-f1449ceba8d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC1A66B6D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ff7b-401e-003a-18e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "2cf17458-a8b4-49f4-9b95-f1449ceba8d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0/javablobuploadpagefromurldestinationacfail2617694d0742f?comp=page", + "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" : "574485d8-58dd-4976-8433-deb093d3b90f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "SZ8sd9cwEO8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "ETag" : "\"0x8D732FDC1ACD5A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75ff9c-401e-003a-35e6-6473d5000000", + "x-ms-client-request-id" : "574485d8-58dd-4976-8433-deb093d3b90f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0/javablobuploadpagefromurldestinationacfail1683872a33ca8?comp=page", + "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" : "bea1d1fa-7b17-41c1-8aa0-e4e938d521b3" + }, + "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" : "8f75ffbd-401e-003a-56e6-6473d5000000", + "Body" : "\nSequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:8f75ffbd-401e-003a-56e6-6473d5000000\nTime:2019-09-06T19:09:35.4528543Z", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "bea1d1fa-7b17-41c1-8aa0-e4e938d521b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6231a9c1-e1be-4ef9-9c18-1843d656b338" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ffff-401e-003a-0fe6-6473d5000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail072868323a7d85d0Fri, 06 Sep 2019 19:09:35 GMT\"0x8D732FDC19ED277\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "6231a9c1-e1be-4ef9-9c18-1843d656b338", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail072868323a7d85d0?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" : "ff6d3245-4010-4e7a-9ab9-f2182d4311e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760011-401e-003a-21e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "ff6d3245-4010-4e7a-9ab9-f2182d4311e2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail072868323a7d85d0", "javablobuploadpagefromurldestinationacfail1683872a33ca8", "javablobuploadpagefromurldestinationacfail2617694d0742f", "e274e69c-133a-44f0-b560-76a38695d161" ] +} \ 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..82420a3a7cae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlia065582eb69630b4eea4d388?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" : "6e409059-2208-4b51-ab8f-e1b6c27bbcda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC9C441D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ee03-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "6e409059-2208-4b51-ab8f-e1b6c27bbcda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlia065582eb69630b4eea4d388/javablobuploadpagefromurlia181782104191083cdb41a", + "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" : "cf115994-ee17-43de-9a03-5e0a933b5e01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCA32F4F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ee27-401e-003a-71e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "cf115994-ee17-43de-9a03-5e0a933b5e01" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c81bac3a-3821-4965-9c08-875d1c4a651d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ee43-401e-003a-0be6-6473d5000000", + "Body" : "jtcuploadpagefromurliajtcuploadpagefromurlia065582eb69630b4eea4d388Fri, 06 Sep 2019 19:09:26 GMT\"0x8D732FDBC9C441D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "c81bac3a-3821-4965-9c08-875d1c4a651d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlia065582eb69630b4eea4d388?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" : "bed9848a-89e3-48ae-aa23-064175769b73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75ee57-401e-003a-1de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "bed9848a-89e3-48ae-aa23-064175769b73" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlia065582eb69630b4eea4d388", "javablobuploadpagefromurlia181782104191083cdb41a" ] +} \ 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..5ab48dc33efe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8?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" : "a4cb77b4-660e-4478-a5eb-ea024b895913" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCB417A1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ee71-401e-003a-36e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "a4cb77b4-660e-4478-a5eb-ea024b895913" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8/javablobuploadpagefromurlmd5150103329f7fe410ec42", + "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" : "85d36f0a-88bb-4279-a150-35c2095ccb48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCBA3F40\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ee87-401e-003a-49e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "85d36f0a-88bb-4279-a150-35c2095ccb48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "eee2135e-35b4-4c4b-9b4d-09e45ffc32d0", + "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" : "\"0x8D732FDBCBF4F9F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75eea5-401e-003a-61e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "eee2135e-35b4-4c4b-9b4d-09e45ffc32d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8/javablobuploadpagefromurlmd5247518c69b3d39cc5949", + "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" : "df99d21c-f6d3-4420-8124-540d41b8edfb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCC47ADC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75eeb9-401e-003a-73e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "df99d21c-f6d3-4420-8124-540d41b8edfb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8/javablobuploadpagefromurlmd5150103329f7fe410ec42?comp=page", + "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" : "ef09b524-85d6-41fc-8df4-df72d0bb08bc", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Noz9IkQUGD4=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "ETag" : "\"0x8D732FDBCCB3335\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75eede-401e-003a-12e6-6473d5000000", + "x-ms-client-request-id" : "ef09b524-85d6-41fc-8df4-df72d0bb08bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8/javablobuploadpagefromurlmd5247518c69b3d39cc5949?comp=page", + "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" : "c62884d9-818a-4349-98b0-7839815bf676" + }, + "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" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "Content-MD5" : "v5PB+6ht1wLFVxdZqiwBWw==", + "ETag" : "\"0x8D732FDBCD34B81\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75eef6-401e-003a-26e6-6473d5000000", + "x-ms-client-request-id" : "c62884d9-818a-4349-98b0-7839815bf676" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c8c05d29-130d-480b-8b83-441292fe666f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ef1e-401e-003a-4de6-6473d5000000", + "Body" : "jtcuploadpagefromurlmd5jtcuploadpagefromurlmd5087669454dcda476aa483d8Fri, 06 Sep 2019 19:09:27 GMT\"0x8D732FDBCBF4F9F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "c8c05d29-130d-480b-8b83-441292fe666f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5087669454dcda476aa483d8?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" : "29710b73-74df-4786-a857-4f21d819eeeb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75ef36-401e-003a-65e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "29710b73-74df-4786-a857-4f21d819eeeb" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmd5087669454dcda476aa483d8", "javablobuploadpagefromurlmd5150103329f7fe410ec42", "javablobuploadpagefromurlmd5247518c69b3d39cc5949", "dcc910c8-ca30-46b3-8839-02a7e412464b" ] +} \ 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..daf746e3f4e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496?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" : "eb93bbbc-0d7c-4c7d-9d7a-36f5a397d62c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCE5BB0B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ef53-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "eb93bbbc-0d7c-4c7d-9d7a-36f5a397d62c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496/javablobuploadpagefromurlmd5fail189911eaf2d70f52e2", + "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" : "06d5dbb0-147a-49c8-af99-76a02fddb482" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCEC0973\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ef73-401e-003a-1be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "06d5dbb0-147a-49c8-af99-76a02fddb482" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ccbfb059-7902-4b80-9318-fe87dd6c1f98", + "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" : "\"0x8D732FDBCF1B66B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ef86-401e-003a-2ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "ccbfb059-7902-4b80-9318-fe87dd6c1f98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496/javablobuploadpagefromurlmd5fail2484037c6bb49cce5c", + "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" : "92c634ee-d044-4232-a23e-b6fcee05df87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBCF7088B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ef97-401e-003a-3ae6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "92c634ee-d044-4232-a23e-b6fcee05df87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496/javablobuploadpagefromurlmd5fail189911eaf2d70f52e2?comp=page", + "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" : "b9efaa88-a388-4bd8-a463-62e9863eb491", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "EthczuHPXhk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "ETag" : "\"0x8D732FDBD04EE8B\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75efbf-401e-003a-5ee6-6473d5000000", + "x-ms-client-request-id" : "b9efaa88-a388-4bd8-a463-62e9863eb491" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496/javablobuploadpagefromurlmd5fail2484037c6bb49cce5c?comp=page", + "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" : "8c212a9f-4d71-4410-93f2-1430bd6a55d8" + }, + "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" : "8f75efd6-401e-003a-72e6-6473d5000000", + "Body" : "\nMd5MismatchThe MD5 value specified in the request did not match with the MD5 value calculated by the server.\nRequestId:8f75efd6-401e-003a-72e6-6473d5000000\nTime:2019-09-06T19:09:27.5993824Z", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "8c212a9f-4d71-4410-93f2-1430bd6a55d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "be663e9e-bcc5-4f5c-9fef-5c21197bdefe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75efe6-401e-003a-02e6-6473d5000000", + "Body" : "jtcuploadpagefromurlmd5failjtcuploadpagefromurlmd5fail058171de5b9f3d197b496Fri, 06 Sep 2019 19:09:27 GMT\"0x8D732FDBCF1B66B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "be663e9e-bcc5-4f5c-9fef-5c21197bdefe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail058171de5b9f3d197b496?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" : "bcc9b079-3180-42c4-929a-b684df3b26a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75f000-401e-003a-15e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:26 GMT", + "x-ms-client-request-id" : "bcc9b079-3180-42c4-929a-b684df3b26a9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmd5fail058171de5b9f3d197b496", "javablobuploadpagefromurlmd5fail189911eaf2d70f52e2", "javablobuploadpagefromurlmd5fail2484037c6bb49cce5c", "74a99d39-7f0e-4eda-a87c-7e8e5706dffa" ] +} \ 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..e00e575dd4de --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a?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" : "17e7c883-4187-4466-943a-5083d0360a92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC1391E9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ebaf-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "17e7c883-4187-4466-943a-5083d0360a92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a/javablobuploadpagefromurlmin170072b8ddbad8a45040", + "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" : "7116dedb-9872-4115-b8dd-e359a5138698" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC1A08A6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ebdd-401e-003a-73e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "7116dedb-9872-4115-b8dd-e359a5138698" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d3960091-5ff8-487e-994c-e17c2b27df5e", + "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" : "\"0x8D732FDBC1FB4DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ec04-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "d3960091-5ff8-487e-994c-e17c2b27df5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a/javablobuploadpagefromurlmin2931317606f69eede54a", + "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" : "f5169fd6-03de-4ef5-a34a-083e3015178d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC264092\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ec34-401e-003a-3ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "f5169fd6-03de-4ef5-a34a-083e3015178d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a/javablobuploadpagefromurlmin2931317606f69eede54a?comp=page", + "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" : "d9251070-d7fc-401c-b769-a01a67d18996", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6U0httXy3TM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "ETag" : "\"0x8D732FDBC389463\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75ec9f-401e-003a-1ce6-6473d5000000", + "x-ms-client-request-id" : "d9251070-d7fc-401c-b769-a01a67d18996" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a/javablobuploadpagefromurlmin170072b8ddbad8a45040?comp=page", + "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" : "e6837592-43c5-4c48-9443-d0759aefb3fe" + }, + "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" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "Content-MD5" : "dh3j4pcrb/4CphvojkCtfg==", + "ETag" : "\"0x8D732FDBC4BD2D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75ecbe-401e-003a-3be6-6473d5000000", + "x-ms-client-request-id" : "e6837592-43c5-4c48-9443-d0759aefb3fe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f11c1cfb-9aac-48f3-9025-88c7837f70bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ed3e-401e-003a-28e6-6473d5000000", + "Body" : "jtcuploadpagefromurlminjtcuploadpagefromurlmin0424923eced09856624749aFri, 06 Sep 2019 19:09:26 GMT\"0x8D732FDBC1FB4DE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "f11c1cfb-9aac-48f3-9025-88c7837f70bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin0424923eced09856624749a?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" : "904f868a-414e-4836-a4fe-dd5a0982a888" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75ed4b-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "904f868a-414e-4836-a4fe-dd5a0982a888" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmin0424923eced09856624749a", "javablobuploadpagefromurlmin170072b8ddbad8a45040", "javablobuploadpagefromurlmin2931317606f69eede54a", "57a0cac7-54b7-41a2-9c56-f228f813db8b" ] +} \ 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..95a348ebdade --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json @@ -0,0 +1,233 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9?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" : "b5977ad6-4d4b-4bd6-b5b4-898b9c4dedf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC626148\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ed63-401e-003a-49e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "b5977ad6-4d4b-4bd6-b5b4-898b9c4dedf3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9/javablobuploadpagefromurlrange156721e00ec349303b4", + "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" : "6ce58ebe-a969-4fdf-bbdf-d845150955e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC68624F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ed72-401e-003a-56e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "6ce58ebe-a969-4fdf-bbdf-d845150955e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "10e358e7-4285-4784-b5df-035778c0ab7f", + "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" : "\"0x8D732FDBC6D7272\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ed88-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "10e358e7-4285-4784-b5df-035778c0ab7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9/javablobuploadpagefromurlrange26470507bcc329cc4f4", + "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" : "e74789db-e454-47f5-add2-151b227372ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC731339\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75ed96-401e-003a-75e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "e74789db-e454-47f5-add2-151b227372ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9/javablobuploadpagefromurlrange26470507bcc329cc4f4?comp=page", + "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" : "2a688988-1fe1-4505-a20a-ac3fc9723335", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "N3bw3gWU8NQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "ETag" : "\"0x8D732FDBC79F2A4\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75eda3-401e-003a-01e6-6473d5000000", + "x-ms-client-request-id" : "2a688988-1fe1-4505-a20a-ac3fc9723335" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9/javablobuploadpagefromurlrange3736944048957a93c24", + "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" : "00add7c3-fd90-4e6b-a929-722029da6582" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDBC8035B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f75edb2-401e-003a-0ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "00add7c3-fd90-4e6b-a929-722029da6582" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9/javablobuploadpagefromurlrange3736944048957a93c24?comp=page", + "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" : "2fcd58e7-2466-4451-a0fd-73af2834730a" + }, + "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" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "Content-MD5" : "eW5LxYs7QU+jdAsATlCyHw==", + "ETag" : "\"0x8D732FDBC87635A\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f75edc0-401e-003a-19e6-6473d5000000", + "x-ms-client-request-id" : "2fcd58e7-2466-4451-a0fd-73af2834730a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9/javablobuploadpagefromurlrange3736944048957a93c24", + "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" : "4d6f628a-23c8-4b51-b04e-d0349749b5de" + }, + "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" : "Fri, 06 Sep 2019 19:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDBC87635A\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:26 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "8f75edd5-401e-003a-2ae6-6473d5000000", + "Body" : "[-26, 101, -38, 104, 97, -12, 55, 61, 85, -36, -51, -21, 6, -70, -29, 109, 18, 10, 30, 25, 17, -114, 79, 2, 90, 115, 127, -18, -7, -31, 68, 28, -45, 51, -51, 45, 114, 120, 79, -58, -39, 7, -98, 90, -80, 127, -54, -75, -5, 47, -66, 84, 122, -104, -110, 25, -104, -68, 108, -125, -26, -91, 125, 64, -73, -123, 47, -96, -61, 90, -88, -69, -121, 83, -114, 37, -9, 84, -73, 105, 56, -106, -25, 18, 90, 4, 105, 17, 1, 16, -70, 73, -41, -23, 29, 31, -107, 18, -68, 86, -42, -68, -67, -10, 82, -7, 101, -14, 68, 8, -106, 65, -17, 107, -128, 95, -84, -91, 22, -16, 121, 65, 116, -99, 63, 116, 27, 91, -43, -95, -88, -70, -62, -110, 90, 84, 46, -44, -119, -1, -73, -114, -55, 118, -22, 18, -32, 56, 65, 56, -63, -112, 37, 82, -112, 4, -121, 105, -94, -70, -59, 51, -86, 64, -81, -31, -63, 13, -108, -4, 69, -32, -93, -90, 30, 88, 24, 80, 29, 90, 60, 6, 78, -68, -13, 84, -30, 102, -115, -106, 127, 114, 19, -70, 37, -78, 91, 78, 48, -66, 2, 117, -2, -104, 12, 74, -128, 11, 10, 12, -62, 97, -108, -34, -35, -104, 16, 99, 92, 35, 32, -117, -103, 39, 84, 96, -113, 9, -104, -5, -112, -88, 121, -26, 24, -21, 48, -15, -41, -91, 118, -93, 6, -58, -107, 91, 97, 39, 111, -96, -121, -67, -123, -124, -126, -85, -127, 100, 58, 3, -53, -72, 127, -78, -3, 108, -79, 8, -5, -92, -61, -92, -72, -57, -10, 73, 95, 121, -1, 59, 73, 80, 105, -118, -11, 39, 109, 80, 117, 127, 27, -86, 111, -128, -14, 82, 25, 116, 108, 24, -111, -31, 11, -31, 76, -17, 33, -15, 102, 124, 72, 123, -105, -7, 69, -72, 28, 13, 14, 48, 112, -35, 63, -42, -112, 70, 36, 100, 88, -93, -9, -23, -56, 72, 3, 68, 85, 86, -71, -63, -16, 39, 111, 107, -102, -101, -12, 72, -100, 24, 52, -24, -105, -90, -6, -56, 81, 23, -101, 97, -51, -38, 11, -4, -85, 36, 58, -27, 26, -113, 61, -1, -102, 68, 2, -106, 84, -14, -77, 26, -120, -90, 33, 31, 113, 23, 11, -47, 102, -123, 99, 28, -116, 63, 2, 125, -8, -71, 47, -71, -125, -94, 29, -22, -44, 118, -32, 11, 12, -53, -77, -25, -23, -124, -16, -104, 107, 41, 61, 39, -102, 104, -37, 88, 46, 88, 78, 63, -93, 106, -21, -92, -96, -64, -23, 122, 96, 101, 96, 90, -50, 104, -60, 56, 61, -66, -118, -58, 85, -53, 70, 2, 75, -20, -91, 26, 81, 57, 111, -77, 81, -88, -89, -99, 34, -127, -5, 1, -41, 47, -25, 37, -23, -8, -35, -93, -14, 51, 2, 126, -28, -87, -29, 54, -23, -19, -94, -100, 22, -62, 41, -39, -34, -74, -8, 118, -32, -77, -75, 14, 36, 53, 103, 43, 111, 23, 114, 83, -16, 8, 81, -5, 46, -120, 113, -105, 123, -85, 3, 20, -94, -24, 29, -62, -41, 62, 25, 37, 84, -63, -67, -125, 6, 42, -127, 95, -72, 99, -71, -65, 12, -36, -52, 95, 48, 40, -113, -84, 25, -62, -42, 102, -99, 22, 9, -80, 1, -80, 70, -124, 27, -101, -48, 71, -110, 127, 65, 63, -33, 36, 111, -73, -106, -46, -42, -91, 75, -61, 127, 78, 115, 124, -91, -17, -74, -107, 71, 17, -48, 115, 87, 41, 121, 60, 21, -107, -80, 25, -76, 43, 67, -2, -84, 81, -52, 114, -110, 101, -61, 18, 85, 29, 72, 113, -4, 64, 28, 12, 103, -98, -15, -17, -12, 90, -45, -70, 14, -125, -103, 85, -56, -42, 8, -76, -40, 38, 100, 78, -83, -42, 63, -24, 33, -44, -16, 113, -7, -100, 6, 9, -36, -93, -64, 88, 35, 22, 50, -26, -113, 9, 95, 96, 63, 93, -108, -1, -43, 58, 6, 125, -127, 50, 76, 86, -73, -7, -45, -56, 56, 126, 45, -95, 44, 19, -46, 83, 1, -20, -57, 121, 82, 101, 101, -35, -98, -90, 18, 116, -18, 86, -48, -26, 28, -7, -38, 104, -82, 127, -16, -57, -69, 32, 77, 27, 34, 79, 109, 106, -23, -103, 97, -36, 19, 121, -29, -36, 97, 9, -14, 114, 33, 46, -47, 94, -9, -94, -67, 109, -64, 118, 87, -89, -94, 114, -88, -84, -45, -58, 11, 76, 95, 120, -8, 112, 89, -128, 99, 34, -30, -2, 103, 48, -50, -118, -114, -115, 97, -8, 45, -51, -81, 29, -81, -77, -45, 53, -126, 69, -100, 91, -37, -32, 114, 64, 38, 119, 62, 43, 71, -69, -77, -25, -24, -57, -23, -16, 127, -85, -10, -98, 70, 114, 67, 54, -79, -52, -23, 100, -90, 109, 77, 62, 64, 44, -125, 50, -87, 123, -19, 4, 65, -27, 108, 126, -81, 96, 51, -108, -109, 11, -101, 108, -119, -61, 22, -70, -86, 51, 4, 31, -33, 48, 49, 104, 80, -1, -118, 92, -29, 88, -89, -40, -40, 68, 20, -100, 61, 98, 24, 62, -88, 117, -47, -74, 90, 43, 64, -65, -3, -87, 81, 119, -128, 27, -83, 20, 86, 123, 97, -103, 90, -57, 121, -93, -22, 107, -81, 94, -44, -72, 58, -61, 20, 81, 113, 36, -128, 48, 16, -101, -97, -33, 112, -122, -35, 70, -104, -88, 80, 100, -104, -27, 56, 126, 7, -125, 36, -80, -85, -105, -5, 41, -53, -12, 31, -97, 7, 127, -89, 30, 107, 23, -102, 49, 0, 5, -48, 117, -106, 68, 113, 67, -30, -47, -53, -29, 3, -4, -116, 81, 27, -91, -2, -72, 41, -114, -122, -59, 108, -96, -31, 62, 127, -35, -118, -72, -10, -121, 53, 65, 10, -40, -96, 89, 42, 46, 6, 78, 68, -27, -8, -16, 0, 126, 108, 27, 126, 123, -6, 40, 89, -32, 33, -96, -39, 14, 35, -89, -96, 48, 109, 84, 112, -22, -8, 97, -56, -125, -1, -46, -120, 62, -108, 86, 35, -57, -105, 61, 58, -6, -97, -105, 2, 85]", + "x-ms-client-request-id" : "4d6f628a-23c8-4b51-b04e-d0349749b5de", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "990a2cec-f672-4a9e-9f15-7d446e183d55" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75ede2-401e-003a-37e6-6473d5000000", + "Body" : "jtcuploadpagefromurlrangejtcuploadpagefromurlrange081806d99cf7e9d37d44b9Fri, 06 Sep 2019 19:09:26 GMT\"0x8D732FDBC6D7272\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "990a2cec-f672-4a9e-9f15-7d446e183d55", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange081806d99cf7e9d37d44b9?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" : "7d543c51-01c8-4431-8eb1-0762c4340d18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75edf2-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:25 GMT", + "x-ms-client-request-id" : "7d543c51-01c8-4431-8eb1-0762c4340d18" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlrange081806d99cf7e9d37d44b9", "javablobuploadpagefromurlrange156721e00ec349303b4", "eeb43bd2-e75c-4cc6-a7b9-9aa7991c183d", "javablobuploadpagefromurlrange26470507bcc329cc4f4", "javablobuploadpagefromurlrange3736944048957a93c24" ] +} \ 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..b1fc68b2babc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e?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" : "6c5f6837-b7e1-4453-a7f0-cd42a4a3d6f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC1DD14FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76002b-401e-003a-39e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "6c5f6837-b7e1-4453-a7f0-cd42a4a3d6f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e/javablobuploadpagefromurlsourceac1430695ce93fad8551", + "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" : "0559c44c-d581-4233-bfce-75a640308358" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC1E77B80\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76007a-401e-003a-7de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "0559c44c-d581-4233-bfce-75a640308358" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "012bfe1b-ff75-4228-8c1d-d934b0c1c0a4", + "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" : "\"0x8D732FDC1ED2C5E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76008e-401e-003a-10e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "012bfe1b-ff75-4228-8c1d-d934b0c1c0a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e/javablobuploadpagefromurlsourceac270082944a4b37fa6b", + "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" : "f98481f0-7674-4b8d-ad46-3694b6e0fed7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC1F3B36C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7600a0-401e-003a-1fe6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "x-ms-client-request-id" : "f98481f0-7674-4b8d-ad46-3694b6e0fed7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e/javablobuploadpagefromurlsourceac270082944a4b37fa6b?comp=page", + "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" : "ac5de129-a052-406f-ac67-3779aac8dfd4", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ZXCz/HD/xlE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:34 GMT", + "ETag" : "\"0x8D732FDC1FA6BCE\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7600b9-401e-003a-36e6-6473d5000000", + "x-ms-client-request-id" : "ac5de129-a052-406f-ac67-3779aac8dfd4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e/javablobuploadpagefromurlsourceac1430695ce93fad8551?comp=page", + "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" : "844aba1e-5792-43bd-a701-4c0c1f9feea7" + }, + "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" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "Content-MD5" : "j/4hUvP1yFYxbxVFiJ9OcQ==", + "ETag" : "\"0x8D732FDC210DF47\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7600cc-401e-003a-49e6-6473d5000000", + "x-ms-client-request-id" : "844aba1e-5792-43bd-a701-4c0c1f9feea7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d5651ce2-53b0-47e7-8714-97d0a0f0207c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760137-401e-003a-26e6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac0900272d9a7ec6c4e64eFri, 06 Sep 2019 19:09:35 GMT\"0x8D732FDC1ED2C5E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "d5651ce2-53b0-47e7-8714-97d0a0f0207c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e?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" : "45c2064c-2e21-47de-bc08-2cd5b2c042dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760145-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "45c2064c-2e21-47de-bc08-2cd5b2c042dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac0900272d9a7ec6c4e64e", "javablobuploadpagefromurlsourceac1430695ce93fad8551", "javablobuploadpagefromurlsourceac270082944a4b37fa6b", "1b964c99-ab37-4501-844b-ea5f09e4d738" ] +} \ 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..8c1c79c427cb --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e?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" : "6033a890-4bf1-4909-bda2-5aa0291139cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC22EA438\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760159-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "6033a890-4bf1-4909-bda2-5aa0291139cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e/javablobuploadpagefromurlsourceac14165827574df134a4", + "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" : "9b8b025a-e93d-489d-b2e3-1bd7a02b609d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC234EA9B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76016c-401e-003a-53e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "9b8b025a-e93d-489d-b2e3-1bd7a02b609d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "af23d855-fe3b-476d-9dc9-1f043fe7cca7", + "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" : "\"0x8D732FDC239D830\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760174-401e-003a-59e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "af23d855-fe3b-476d-9dc9-1f043fe7cca7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e/javablobuploadpagefromurlsourceac217813ab4ef43d9824", + "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" : "b3651d8e-2cf0-4f4b-9980-c9238a9095fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC23F9B80\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76018d-401e-003a-6ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "b3651d8e-2cf0-4f4b-9980-c9238a9095fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e/javablobuploadpagefromurlsourceac217813ab4ef43d9824?comp=page", + "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" : "3cb36b1e-3c01-44ce-8bea-5b9ce1fd63b7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LrWycDbb7kQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "ETag" : "\"0x8D732FDC245DE9D\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76019f-401e-003a-7de6-6473d5000000", + "x-ms-client-request-id" : "3cb36b1e-3c01-44ce-8bea-5b9ce1fd63b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e/javablobuploadpagefromurlsourceac14165827574df134a4?comp=page", + "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" : "a0d6c0e3-8160-4b36-b68b-be18d3236c69" + }, + "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" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "Content-MD5" : "qnL8LdQ0d9Gwba2sK//xMw==", + "ETag" : "\"0x8D732FDC2560F08\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7601af-401e-003a-0ce6-6473d5000000", + "x-ms-client-request-id" : "a0d6c0e3-8160-4b36-b68b-be18d3236c69" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4bb4c2fb-eb0c-48ad-ae8e-3701caeedddf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7601e1-401e-003a-34e6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac088621bd2f705da8dd4eFri, 06 Sep 2019 19:09:36 GMT\"0x8D732FDC239D830\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "4bb4c2fb-eb0c-48ad-ae8e-3701caeedddf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac088621bd2f705da8dd4e?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" : "2b0a0c9d-d037-435c-b027-48850758d759" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7601f2-401e-003a-43e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "2b0a0c9d-d037-435c-b027-48850758d759" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac088621bd2f705da8dd4e", "javablobuploadpagefromurlsourceac14165827574df134a4", "javablobuploadpagefromurlsourceac217813ab4ef43d9824", "7ec6bc14-eb3f-4b01-96db-add0de01d418" ] +} \ 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..79344cbd6779 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45?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" : "2c78e273-120f-4eda-aa94-c82073dc2e73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC26C315F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76020c-401e-003a-59e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "2c78e273-120f-4eda-aa94-c82073dc2e73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45/javablobuploadpagefromurlsourceac1571921d19a12e5fd5", + "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" : "094db101-80f2-4962-82fc-2304896a4982" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2744C96\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76021b-401e-003a-64e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "094db101-80f2-4962-82fc-2304896a4982" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "55d976cb-2b40-4f4b-8c06-38ec6290f9f2", + "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" : "\"0x8D732FDC279889F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76022d-401e-003a-71e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "55d976cb-2b40-4f4b-8c06-38ec6290f9f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45/javablobuploadpagefromurlsourceac21631466d066591c4a", + "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" : "b78223e1-9445-484d-a589-66d183b183d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC27EFD8A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76023b-401e-003a-7de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "b78223e1-9445-484d-a589-66d183b183d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45/javablobuploadpagefromurlsourceac21631466d066591c4a?comp=page", + "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" : "4ab50967-340f-4af2-9936-41aa2016013f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6TO8ks6SdtY=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "ETag" : "\"0x8D732FDC284A42A\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760259-401e-003a-16e6-6473d5000000", + "x-ms-client-request-id" : "4ab50967-340f-4af2-9936-41aa2016013f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45/javablobuploadpagefromurlsourceac1571921d19a12e5fd5?comp=page", + "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" : "7ffe3ce3-93f4-4f04-8005-794d2a64f645" + }, + "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" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "Content-MD5" : "XORtS+WkSFEN7jkBTMNPeA==", + "ETag" : "\"0x8D732FDC28B839E\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760267-401e-003a-24e6-6473d5000000", + "x-ms-client-request-id" : "7ffe3ce3-93f4-4f04-8005-794d2a64f645" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "161e2dcb-249a-4490-be38-d63eaa908236" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760276-401e-003a-32e6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac0965115f1888280cfc45Fri, 06 Sep 2019 19:09:36 GMT\"0x8D732FDC279889F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "161e2dcb-249a-4490-be38-d63eaa908236", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0965115f1888280cfc45?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" : "3c04f3bd-caae-47b3-92bf-d7d4dc82aa87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760282-401e-003a-3de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:35 GMT", + "x-ms-client-request-id" : "3c04f3bd-caae-47b3-92bf-d7d4dc82aa87" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac0965115f1888280cfc45", "javablobuploadpagefromurlsourceac1571921d19a12e5fd5", "javablobuploadpagefromurlsourceac21631466d066591c4a", "ee1ee01e-79d7-41d4-9a98-d685451d2393" ] +} \ 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..3196d5cbe8a1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049?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" : "9edb219f-b061-41bf-9f38-594fec9c742e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2A0BBA6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76029c-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "9edb219f-b061-41bf-9f38-594fec9c742e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049/javablobuploadpagefromurlsourceac17879741f0cb4e120b", + "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" : "f7d98aad-de62-4f26-b29a-181512fb5697" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2B0EED4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7602da-401e-003a-0be6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "f7d98aad-de62-4f26-b29a-181512fb5697" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dabc2a57-6884-4b1f-86f7-41d7d8298661", + "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" : "\"0x8D732FDC2B67929\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7602fa-401e-003a-27e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "dabc2a57-6884-4b1f-86f7-41d7d8298661" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049/javablobuploadpagefromurlsourceac2993289935a1a4baf9", + "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" : "2807412c-19ae-4cf3-9938-3516963ac5a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2BC6335\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760304-401e-003a-31e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "2807412c-19ae-4cf3-9938-3516963ac5a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049/javablobuploadpagefromurlsourceac2993289935a1a4baf9?comp=page", + "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" : "6216819a-0949-4bde-88f5-121bf37066b5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "/mWBnOU1VpU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "ETag" : "\"0x8D732FDC2C1E2CD\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760317-401e-003a-41e6-6473d5000000", + "x-ms-client-request-id" : "6216819a-0949-4bde-88f5-121bf37066b5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049/javablobuploadpagefromurlsourceac2993289935a1a4baf9", + "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" : "bf2cde4e-741d-4d17-be0e-86604eced9b7" + }, + "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" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19: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" : "\"0x8D732FDC2C1E2CD\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:37 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f760320-401e-003a-4ae6-6473d5000000", + "x-ms-client-request-id" : "bf2cde4e-741d-4d17-be0e-86604eced9b7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049/javablobuploadpagefromurlsourceac17879741f0cb4e120b?comp=page", + "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" : "fea12359-6bd8-4095-aca8-597ad077acc7" + }, + "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" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "Content-MD5" : "UnWQy+6Xs4CDrbCGK0IuwA==", + "ETag" : "\"0x8D732FDC2CC6C96\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760330-401e-003a-57e6-6473d5000000", + "x-ms-client-request-id" : "fea12359-6bd8-4095-aca8-597ad077acc7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a98e9695-269b-4839-9321-dddf0fd5f664" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760344-401e-003a-66e6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac06620202c9bf6ad2e049Fri, 06 Sep 2019 19:09:37 GMT\"0x8D732FDC2B67929\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "a98e9695-269b-4839-9321-dddf0fd5f664", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac06620202c9bf6ad2e049?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" : "5aa56cc1-15e6-45d0-8cd1-3e665e60f7c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76034a-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "5aa56cc1-15e6-45d0-8cd1-3e665e60f7c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac06620202c9bf6ad2e049", "javablobuploadpagefromurlsourceac17879741f0cb4e120b", "javablobuploadpagefromurlsourceac2993289935a1a4baf9", "e15c0075-9057-4ec2-83c4-f7dad9146abd" ] +} \ 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..b253daf43843 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48?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" : "b166358a-5c0d-43dc-90ad-1bb28d509c92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2DDAC70\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760362-401e-003a-02e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "b166358a-5c0d-43dc-90ad-1bb28d509c92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48/javablobuploadpagefromurlsourceac18923907b3addb0a9c", + "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" : "5b66568c-c018-49ef-91d3-5ece67c1525d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2E35567\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760372-401e-003a-11e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "5b66568c-c018-49ef-91d3-5ece67c1525d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "029608e4-8745-4093-a325-9b1c34a10403", + "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" : "\"0x8D732FDC2E86A8E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76037b-401e-003a-1ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "029608e4-8745-4093-a325-9b1c34a10403" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48/javablobuploadpagefromurlsourceac263443335022bce0d6", + "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" : "0a43be4b-00cf-40a4-929d-412c28ba3aa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC2EE2D68\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760392-401e-003a-2ce6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "0a43be4b-00cf-40a4-929d-412c28ba3aa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48/javablobuploadpagefromurlsourceac263443335022bce0d6?comp=page", + "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" : "e66d3ba9-842a-4122-9e2a-a70d77b4fdb3", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "W1yVVdd0+Wk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "ETag" : "\"0x8D732FDC2F4E5CA\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76039f-401e-003a-39e6-6473d5000000", + "x-ms-client-request-id" : "e66d3ba9-842a-4122-9e2a-a70d77b4fdb3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48/javablobuploadpagefromurlsourceac18923907b3addb0a9c?comp=page", + "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" : "962f037e-0e4c-4ddc-bd00-8a4df17cb71b" + }, + "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" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "Content-MD5" : "CxNO4MDW+0c/Basz8FLgNw==", + "ETag" : "\"0x8D732FDC30EB579\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7603b8-401e-003a-4fe6-6473d5000000", + "x-ms-client-request-id" : "962f037e-0e4c-4ddc-bd00-8a4df17cb71b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f9dbbe3-6906-48fc-b6ed-69a40800cbf4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760421-401e-003a-13e6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac0907683b3e1892f0eb48Fri, 06 Sep 2019 19:09:37 GMT\"0x8D732FDC2E86A8E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "8f9dbbe3-6906-48fc-b6ed-69a40800cbf4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0907683b3e1892f0eb48?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" : "3ceb4cd2-f71b-4235-8005-0e3c187e9ba4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760439-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "3ceb4cd2-f71b-4235-8005-0e3c187e9ba4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac0907683b3e1892f0eb48", "javablobuploadpagefromurlsourceac18923907b3addb0a9c", "javablobuploadpagefromurlsourceac263443335022bce0d6", "becd3b23-d8bd-4e36-9443-8a24e04bc8b6" ] +} \ 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..b25e18faceb8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec?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" : "b64340dc-1ddc-4fd1-8ddd-ba4b73dbbe29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC328AA66\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760452-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "b64340dc-1ddc-4fd1-8ddd-ba4b73dbbe29" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec/javablobuploadpagefromurlsourceacfail1792356ef95ba297", + "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" : "620e4035-7c40-4e67-8acc-a15fdeca7026" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC32E52E9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760477-401e-003a-52e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:36 GMT", + "x-ms-client-request-id" : "620e4035-7c40-4e67-8acc-a15fdeca7026" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0104c548-4c0c-4102-a5c2-0ba994ea85a7", + "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" : "\"0x8D732FDC333B67E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76048f-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "0104c548-4c0c-4102-a5c2-0ba994ea85a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec/javablobuploadpagefromurlsourceacfail2744314f61ee2f4d", + "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" : "c094b7c8-5194-4cec-8b37-df21c9257f64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC338DCB2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760499-401e-003a-6ee6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "c094b7c8-5194-4cec-8b37-df21c9257f64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec/javablobuploadpagefromurlsourceacfail2744314f61ee2f4d?comp=page", + "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" : "7fe763e2-02ad-4df6-b8fb-0cecffa6a9f4", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "PXe5C261Lfc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "ETag" : "\"0x8D732FDC33F1FC1\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7604ac-401e-003a-7ce6-6473d5000000", + "x-ms-client-request-id" : "7fe763e2-02ad-4df6-b8fb-0cecffa6a9f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec/javablobuploadpagefromurlsourceacfail1792356ef95ba297?comp=page", + "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" : "87667006-955f-4ad2-91be-0e4a43927367" + }, + "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" : "8f7604cb-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "87667006-955f-4ad2-91be-0e4a43927367" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2965b848-2f62-483f-941e-68b411b8b290" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760507-401e-003a-3de6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail063498ef6957b43fecFri, 06 Sep 2019 19:09:37 GMT\"0x8D732FDC333B67E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "2965b848-2f62-483f-941e-68b411b8b290", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail063498ef6957b43fec?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" : "26f6ce15-ed13-4a79-a6df-45d5faa4b396" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76051e-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "26f6ce15-ed13-4a79-a6df-45d5faa4b396" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail063498ef6957b43fec", "javablobuploadpagefromurlsourceacfail1792356ef95ba297", "javablobuploadpagefromurlsourceacfail2744314f61ee2f4d", "2383ffb5-5205-4c72-a2c4-be1dc0f173ff" ] +} \ 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..44124fbb189c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01?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" : "07434c60-9fc2-4b15-b5ac-35e1395084d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC366FB0F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760531-401e-003a-57e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "07434c60-9fc2-4b15-b5ac-35e1395084d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01/javablobuploadpagefromurlsourceacfail102330f8fe1daa72", + "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" : "13a4bbce-bdc2-4acd-89db-2f354a5c0469" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC36D187A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760544-401e-003a-67e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "13a4bbce-bdc2-4acd-89db-2f354a5c0469" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "359e4374-4a13-4e88-b5cd-e4bcfa0b705d", + "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" : "\"0x8D732FDC372CA7A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760555-401e-003a-75e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "359e4374-4a13-4e88-b5cd-e4bcfa0b705d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01/javablobuploadpagefromurlsourceacfail2760824988c74f48", + "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" : "31bbaf44-1ac0-4095-9a67-d4df06dfebec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC37A3AF9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760574-401e-003a-10e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "31bbaf44-1ac0-4095-9a67-d4df06dfebec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01/javablobuploadpagefromurlsourceacfail2760824988c74f48?comp=page", + "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" : "7c9204b4-f822-464d-afab-8d83c41815d7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "TbHxeBGygO8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "ETag" : "\"0x8D732FDC38008BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76057e-401e-003a-1ae6-6473d5000000", + "x-ms-client-request-id" : "7c9204b4-f822-464d-afab-8d83c41815d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01/javablobuploadpagefromurlsourceacfail102330f8fe1daa72?comp=page", + "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" : "fb1857e2-cc33-462e-8665-8054a7f261dd" + }, + "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" : "8f760593-401e-003a-27e6-6473d5000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:8f760593-401e-003a-27e6-6473d5000000\nTime:2019-09-06T19:09:38.5067596Z", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "fb1857e2-cc33-462e-8665-8054a7f261dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b431ce1c-50b5-4fbd-9c1d-f67cb236acf3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7605c4-401e-003a-4de6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail03113508f68856ac01Fri, 06 Sep 2019 19:09:38 GMT\"0x8D732FDC372CA7A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "b431ce1c-50b5-4fbd-9c1d-f67cb236acf3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail03113508f68856ac01?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" : "aa4ad9eb-2d5d-41b8-aed8-ae4628d8fa07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7605d2-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "aa4ad9eb-2d5d-41b8-aed8-ae4628d8fa07" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail03113508f68856ac01", "javablobuploadpagefromurlsourceacfail102330f8fe1daa72", "javablobuploadpagefromurlsourceacfail2760824988c74f48", "1b9571d3-bc70-4eab-8960-56e189dfa2a0" ] +} \ 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..a1103d00beed --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e?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" : "8f30185a-cf23-4f63-9a33-f491726e6bad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC3A60F3E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7605e7-401e-003a-6ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "8f30185a-cf23-4f63-9a33-f491726e6bad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e/javablobuploadpagefromurlsourceacfail179772c2df81f7ff", + "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" : "d1e82375-d324-4dc5-b470-e3f052266564" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC3AC052C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7605f7-401e-003a-76e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "d1e82375-d324-4dc5-b470-e3f052266564" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cf923082-cb48-40d7-bb90-30285de1a478", + "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" : "\"0x8D732FDC3B14206\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76060a-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "cf923082-cb48-40d7-bb90-30285de1a478" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e/javablobuploadpagefromurlsourceacfail290877bd534b0fcf", + "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" : "18c9fd03-5ba1-494a-af9d-d4783575dba5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC3B619B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76061d-401e-003a-19e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "18c9fd03-5ba1-494a-af9d-d4783575dba5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e/javablobuploadpagefromurlsourceacfail290877bd534b0fcf?comp=page", + "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" : "40d6c1f8-06ce-4dc6-900f-bccbd88abbab", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LlX7CZE/kec=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "ETag" : "\"0x8D732FDC3BC83E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f760633-401e-003a-2ee6-6473d5000000", + "x-ms-client-request-id" : "40d6c1f8-06ce-4dc6-900f-bccbd88abbab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e/javablobuploadpagefromurlsourceacfail179772c2df81f7ff?comp=page", + "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" : "9d011dac-fec5-4d0b-b094-da6d5b325e06" + }, + "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" : "8f760645-401e-003a-3fe6-6473d5000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:8f760645-401e-003a-3fe6-6473d5000000\nTime:2019-09-06T19:09:38.8610967Z", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "9d011dac-fec5-4d0b-b094-da6d5b325e06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "62f2246b-7bad-439b-bb91-337041550aff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760657-401e-003a-50e6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail011061a56ff04ae62eFri, 06 Sep 2019 19:09:38 GMT\"0x8D732FDC3B14206\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:37 GMT", + "x-ms-client-request-id" : "62f2246b-7bad-439b-bb91-337041550aff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011061a56ff04ae62e?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" : "e6e2bbd3-32e3-4b59-84db-aa95e1bde02c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760666-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "e6e2bbd3-32e3-4b59-84db-aa95e1bde02c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail011061a56ff04ae62e", "javablobuploadpagefromurlsourceacfail179772c2df81f7ff", "javablobuploadpagefromurlsourceacfail290877bd534b0fcf", "47d51bd3-3fa1-4396-98e6-cce1ff5de87c" ] +} \ 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..ada87f572886 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1?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" : "2962238e-c94e-4a9d-9309-7c448aedd0e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC3D1E4DE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760675-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "2962238e-c94e-4a9d-9309-7c448aedd0e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1/javablobuploadpagefromurlsourceacfail154237b47eadbd46", + "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" : "2a5adf38-965a-4ac6-a2d2-182dbccf5946" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC3D828C8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f760681-401e-003a-73e6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "2a5adf38-965a-4ac6-a2d2-182dbccf5946" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dd0705e5-d1f9-45ad-b6d0-5c7e4dd59c6f", + "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" : "\"0x8D732FDC3DDDAFE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760695-401e-003a-03e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "dd0705e5-d1f9-45ad-b6d0-5c7e4dd59c6f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1/javablobuploadpagefromurlsourceacfail2454192fcb7ce8d1", + "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" : "1cff5241-5dec-4754-9f31-d22769c8eff6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDC3E3EB52\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7606b7-401e-003a-1de6-6473d5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "1cff5241-5dec-4754-9f31-d22769c8eff6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1/javablobuploadpagefromurlsourceacfail2454192fcb7ce8d1?comp=page", + "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" : "e9902d7e-b634-4db5-a7a2-5045b9890ef1", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "NyGTeIgBnn0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "ETag" : "\"0x8D732FDC3EA7C94\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f7606d6-401e-003a-36e6-6473d5000000", + "x-ms-client-request-id" : "e9902d7e-b634-4db5-a7a2-5045b9890ef1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1/javablobuploadpagefromurlsourceacfail2454192fcb7ce8d1", + "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" : "f71cbd63-745c-4e00-8ec6-9637bacbe429" + }, + "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" : "Fri, 06 Sep 2019 19:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:09: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" : "\"0x8D732FDC3EA7C94\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:09:39 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "8f7606ee-401e-003a-4be6-6473d5000000", + "x-ms-client-request-id" : "f71cbd63-745c-4e00-8ec6-9637bacbe429", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1/javablobuploadpagefromurlsourceacfail154237b47eadbd46?comp=page", + "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" : "b2483452-2043-4864-94a3-687645f07bf8" + }, + "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" : "8f7606fb-401e-003a-56e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "b2483452-2043-4864-94a3-687645f07bf8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3d7ca5b9-4d24-40d0-bb54-8f9b1466a807" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f760726-401e-003a-7ee6-6473d5000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail047746f0748e5322c1Fri, 06 Sep 2019 19:09:39 GMT\"0x8D732FDC3DDDAFE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "3d7ca5b9-4d24-40d0-bb54-8f9b1466a807", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail047746f0748e5322c1?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" : "14eb0dee-56c0-4f61-963a-f848af60711b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f760734-401e-003a-07e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:38 GMT", + "x-ms-client-request-id" : "14eb0dee-56c0-4f61-963a-f848af60711b" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail047746f0748e5322c1", "javablobuploadpagefromurlsourceacfail154237b47eadbd46", "javablobuploadpagefromurlsourceacfail2454192fcb7ce8d1", "b7dc0e4e-53c8-4ba3-96ae-5a3767795372" ] +} \ 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..bd6a24892488 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia43f57490862974?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" : "c2d5ffca-506f-49fe-aab5-79788eff8d8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB86761EF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fd5b-001e-001f-10e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "c2d5ffca-506f-49fe-aab5-79788eff8d8c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia43f57490862974/javablobuploadpageia1pageblobapitestuploadpageia43f67136c8c", + "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" : "52fcc98e-c029-44f1-b333-d4685dedf89b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB86D8629\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fd69-001e-001f-1de6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "52fcc98e-c029-44f1-b333-d4685dedf89b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bae8b456-31e2-42cc-a4ef-4ee275974df3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fd75-001e-001f-27e6-64eb66000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia43f57490862974Fri, 06 Sep 2019 19:09:19 GMT\"0x8D732FDB86761EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "bae8b456-31e2-42cc-a4ef-4ee275974df3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia43f57490862974?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" : "47103b8d-e51e-4b1a-b81c-63eaf7a874e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fd97-001e-001f-47e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "47103b8d-e51e-4b1a-b81c-63eaf7a874e9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia43f57490862974", "javablobuploadpageia1pageblobapitestuploadpageia43f67136c8c" ] +} \ 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..f5f32caf7337 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageiadcb96232752a18?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" : "bf58302c-f9d4-4969-8666-b34414786604" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8B9DB84\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fe70-001e-001f-08e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "bf58302c-f9d4-4969-8666-b34414786604" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageiadcb96232752a18/javablobuploadpageia1pageblobapitestuploadpageiadcb1927139c", + "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" : "24d09465-f4a2-4ca1-adda-3213715b2cbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8BFB14C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fe98-001e-001f-2ce6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "24d09465-f4a2-4ca1-adda-3213715b2cbe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageiadcb96232752a18/javablobuploadpageia1pageblobapitestuploadpageiadcb1927139c?comp=page", + "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" : "28f3e34e-06c7-47f8-91b6-aef63e4de30c", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "efda9d69-4e54-4419-ac73-70b262d4bf00" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "adada219-f01e-00ef-7ce6-643b08000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageiadcb96232752a18Fri, 06 Sep 2019 19:09:20 GMT\"0x8D732FDB8B9DB84\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "efda9d69-4e54-4419-ac73-70b262d4bf00", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageiadcb96232752a18?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" : "f14e82db-5faf-4371-aa02-c7e15fe979e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "adada226-f01e-00ef-08e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "f14e82db-5faf-4371-aa02-c7e15fe979e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageiadcb96232752a18", "javablobuploadpageia1pageblobapitestuploadpageiadcb1927139c", "32e165fb-0ea1-4155-810b-33934a7bb727" ] +} \ 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..410a9007d936 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2e463614b56ee2?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" : "7a50dee8-a59f-4ffd-bf58-d4f15b8ac37f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8D3A0FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adada24a-f01e-00ef-28e6-643b08000000", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "7a50dee8-a59f-4ffd-bf58-d4f15b8ac37f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2e463614b56ee2/javablobuploadpageia1pageblobapitestuploadpageia2e499968d77", + "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" : "9458076b-a073-4a0b-a05f-50f6e77e29c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8DA448A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "adada25f-f01e-00ef-39e6-643b08000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:20 GMT", + "x-ms-client-request-id" : "9458076b-a073-4a0b-a05f-50f6e77e29c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2e463614b56ee2/javablobuploadpageia1pageblobapitestuploadpageia2e499968d77?comp=page", + "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" : "5fe15b59-6305-4afc-9541-f43c1e1d47f1", + "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://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f90a6a5b-523f-4352-b59f-0c22d00632c9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f75dd9b-401e-003a-0de6-6473d5000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia2e463614b56ee2Fri, 06 Sep 2019 19:09:20 GMT\"0x8D732FDB8D3A0FF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "f90a6a5b-523f-4352-b59f-0c22d00632c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2e463614b56ee2?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" : "3e103b41-d881-4a73-a832-cd8710dd3b66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f75dda6-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "3e103b41-d881-4a73-a832-cd8710dd3b66" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia2e463614b56ee2", "javablobuploadpageia1pageblobapitestuploadpageia2e499968d77", "769e56bc-ec27-46c4-8a4c-46a53a94839e" ] +} \ 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..8185f2cd0866 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemina908544360feb?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" : "18d7aa8c-dc66-4794-80cc-a6738b958a55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB8499998\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fcf8-001e-001f-37e6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "18d7aa8c-dc66-4794-80cc-a6738b958a55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemina908544360feb/javablobuploadpagemin1pageblobapitestuploadpagemina906649148", + "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" : "62f2ad27-b995-47fa-bef0-aa8d42fbb5c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDB84FE4FF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec65fd0e-001e-001f-4be6-64eb66000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "62f2ad27-b995-47fa-bef0-aa8d42fbb5c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemina908544360feb/javablobuploadpagemin1pageblobapitestuploadpagemina906649148?comp=page", + "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" : "77006988-64e1-45fd-8b34-9fd75bf2d1bb", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6bvk/ZrWT70=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 06 Sep 2019 19:09:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "ETag" : "\"0x8D732FDB855648D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec65fd23-001e-001f-5de6-64eb66000000", + "x-ms-client-request-id" : "77006988-64e1-45fd-8b34-9fd75bf2d1bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "37bceff5-faab-42f0-b1d3-57c8f3935dd6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec65fd32-001e-001f-69e6-64eb66000000", + "Body" : "jtcuploadpageminjtcuploadpagemin0pageblobapitestuploadpagemina908544360febFri, 06 Sep 2019 19:09:19 GMT\"0x8D732FDB8499998\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "37bceff5-faab-42f0-b1d3-57c8f3935dd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemina908544360feb?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" : "18ae92f9-71f5-4db0-b952-54a13d24bda2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec65fd43-001e-001f-7ae6-64eb66000000", + "Date" : "Fri, 06 Sep 2019 19:09:19 GMT", + "x-ms-client-request-id" : "18ae92f9-71f5-4db0-b952-54a13d24bda2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagemin0pageblobapitestuploadpagemina908544360feb", "javablobuploadpagemin1pageblobapitestuploadpagemina906649148", "0d332fa1-aa41-4903-b164-329e96a84596" ] +} \ 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..f256ccfb8b21 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogressparallel042496d6002c6b0e2c4d1d?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" : "f534978a-b264-4aa7-8231-1960dcdc5b38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDB730BA1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764ca8-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "f534978a-b264-4aa7-8231-1960dcdc5b38" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f17a55b-3498-4aea-b171-ff0050b3d35b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f765236-401e-003a-5be6-6473d5000000", + "Body" : "jtcreportprogressparalleljtcreportprogressparallel042496d6002c6b0e2c4d1dFri, 06 Sep 2019 19:10:18 GMT\"0x8D732FDDB730BA1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:20 GMT", + "x-ms-client-request-id" : "8f17a55b-3498-4aea-b171-ff0050b3d35b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogressparallel042496d6002c6b0e2c4d1d?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" : "3dec5c07-36ae-4b80-a12c-619d60431cc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76524d-401e-003a-6fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:20 GMT", + "x-ms-client-request-id" : "3dec5c07-36ae-4b80-a12c-619d60431cc7" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogressparallel042496d6002c6b0e2c4d1d", "32124fb2-8733-489e-bee6-d1da062856a5", "715d4e7d-411c-45f2-a011-d9ec5b4efd78", "09e9e1f2-6728-4855-94fa-c5f405862061" ] +} \ 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..d64823b7899c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequential083056322f7b031ff24bd?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" : "a353c3d3-a77f-426c-889a-da85392b8436" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDB223FE1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f764bcd-401e-003a-50e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "a353c3d3-a77f-426c-889a-da85392b8436" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bbdae609-f581-46f8-9c71-fc0213976ba7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f764c00-401e-003a-7de6-6473d5000000", + "Body" : "jtcreportprogresssequentialjtcreportprogresssequential083056322f7b031ff24bdFri, 06 Sep 2019 19:10:18 GMT\"0x8D732FDDB223FE1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "bbdae609-f581-46f8-9c71-fc0213976ba7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequential083056322f7b031ff24bd?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" : "08de057a-39fa-46ab-8899-859b86ceccd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f764c09-401e-003a-05e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:17 GMT", + "x-ms-client-request-id" : "08de057a-39fa-46ab-8899-859b86ceccd3" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogresssequential083056322f7b031ff24bd", "74eb8cf5-fb4e-4e0f-a111-25a6be564af7", "580c0289-29ae-44cb-8c08-189499f6af46", "ec4e1ade-1eb9-4f71-aad6-eb0fe0ed7449" ] +} \ 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..a542eeeb4325 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcreportprogresssequentialnetworktest0819069a41433b4", "c3a59ca8-48ff-4c26-a62b-99bc69704447", "javablobreportprogresssequentialnetworktest1476375f1156e" ] +} \ 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..b62411ee2759 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesexponentialdelay069052efee9258c806468?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" : "8070c0ac-26ab-408a-8be3-dfa821dedcec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDEE77E374\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f768bfb-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:49 GMT", + "x-ms-client-request-id" : "8070c0ac-26ab-408a-8be3-dfa821dedcec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "44294a04-1bde-4582-8a13-1351ee3a9a9f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76a54d-401e-003a-03e6-6473d5000000", + "Body" : "jtcretriesexponentialdelayjtcretriesexponentialdelay069052efee9258c806468Fri, 06 Sep 2019 19:10:50 GMT\"0x8D732FDEE77E374\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:03 GMT", + "x-ms-client-request-id" : "44294a04-1bde-4582-8a13-1351ee3a9a9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesexponentialdelay069052efee9258c806468?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" : "7785898f-eb83-47f8-9553-9c1be07f8b13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76a560-401e-003a-12e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:03 GMT", + "x-ms-client-request-id" : "7785898f-eb83-47f8-9553-9c1be07f8b13" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesexponentialdelay069052efee9258c806468" ] +} \ 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..7b4bc1665e0e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesfixeddelay0retrytestretriesfixeddelay9b5720605d27?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" : "24aa08d7-217a-440b-a0dd-e348ae6d3a4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF643D0EE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76a575-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:03 GMT", + "x-ms-client-request-id" : "24aa08d7-217a-440b-a0dd-e348ae6d3a4d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c0683a18-9432-4e60-885b-bf46493eef31" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76abf9-401e-003a-78e6-6473d5000000", + "Body" : "jtcretriesfixeddelayjtcretriesfixeddelay0retrytestretriesfixeddelay9b5720605d27Fri, 06 Sep 2019 19:11:03 GMT\"0x8D732FDF643D0EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:06 GMT", + "x-ms-client-request-id" : "c0683a18-9432-4e60-885b-bf46493eef31", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesfixeddelay0retrytestretriesfixeddelay9b5720605d27?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" : "cb59af5c-9014-4aec-bdcb-381b9f6b49a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ac10-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:06 GMT", + "x-ms-client-request-id" : "cb59af5c-9014-4aec-bdcb-381b9f6b49a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesfixeddelay0retrytestretriesfixeddelay9b5720605d27" ] +} \ 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..bb723120773e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnetworkerror0retrytestretriesnetworkerror7be47493d6?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" : "06854ed5-33b9-4d2d-b6fd-25a0e9eb9e50" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDE8D577E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f767a67-401e-003a-1fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:40 GMT", + "x-ms-client-request-id" : "06854ed5-33b9-4d2d-b6fd-25a0e9eb9e50" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2a7c0fdd-b038-44d8-aa95-c45252ae7485" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f767e67-401e-003a-07e6-6473d5000000", + "Body" : "jtcretriesnetworkerrorjtcretriesnetworkerror0retrytestretriesnetworkerror7be47493d6Fri, 06 Sep 2019 19:10:41 GMT\"0x8D732FDE8D577E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:42 GMT", + "x-ms-client-request-id" : "2a7c0fdd-b038-44d8-aa95-c45252ae7485", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnetworkerror0retrytestretriesnetworkerror7be47493d6?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" : "f873bbe7-15bf-4918-9a72-d389148aef8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f767e72-401e-003a-12e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:42 GMT", + "x-ms-client-request-id" : "f873bbe7-15bf-4918-9a72-d389148aef8b" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnetworkerror0retrytestretriesnetworkerror7be47493d6" ] +} \ 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..e6d3c32f062e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonreplyableflux02208528752b4a6a664c8?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" : "2913ecee-602c-4ab2-85f9-5804151af317" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF858662F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ad79-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:07 GMT", + "x-ms-client-request-id" : "2913ecee-602c-4ab2-85f9-5804151af317" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "94e55418-944c-4722-8ee5-7fbc1ea7c975" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76afe7-401e-003a-41e6-6473d5000000", + "Body" : "jtcretriesnonreplyablefluxjtcretriesnonreplyableflux02208528752b4a6a664c8Fri, 06 Sep 2019 19:11:07 GMT\"0x8D732FDF858662F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "94e55418-944c-4722-8ee5-7fbc1ea7c975", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonreplyableflux02208528752b4a6a664c8?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" : "af3a635e-c42f-46b4-901f-0346c421edcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b004-401e-003a-56e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "af3a635e-c42f-46b4-901f-0346c421edcb" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonreplyableflux02208528752b4a6a664c8" ] +} \ 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..41405d2e477a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryable0retrytestretriesnonretryablec8003142b2?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" : "87d99c17-d89a-4d2f-85f0-075ca91080e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDE80438FB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76782c-401e-003a-46e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:38 GMT", + "x-ms-client-request-id" : "87d99c17-d89a-4d2f-85f0-075ca91080e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9120691f-2e1b-4df9-845a-8d88dbc4e09b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f767896-401e-003a-27e6-6473d5000000", + "Body" : "jtcretriesnonretryablejtcretriesnonretryable0retrytestretriesnonretryablec8003142b2Fri, 06 Sep 2019 19:10:39 GMT\"0x8D732FDE80438FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:38 GMT", + "x-ms-client-request-id" : "9120691f-2e1b-4df9-845a-8d88dbc4e09b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryable0retrytestretriesnonretryablec8003142b2?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" : "bb9c50c7-529d-4605-acd5-a29001e8e761" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f7678a5-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:38 GMT", + "x-ms-client-request-id" : "bb9c50c7-529d-4605-acd5-a29001e8e761" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonretryable0retrytestretriesnonretryablec8003142b2" ] +} \ 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..43236e0a1605 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryablesecondary0224535f9d50a29f054?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" : "16fec7fe-9690-49f9-a437-273100f91c36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDE8269679\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f7678bb-401e-003a-45e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:38 GMT", + "x-ms-client-request-id" : "16fec7fe-9690-49f9-a437-273100f91c36" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8b0181f2-de6d-43fe-94e5-a635849f8201" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f767a33-401e-003a-71e6-6473d5000000", + "Body" : "jtcretriesnonretryablesecondaryjtcretriesnonretryablesecondary0224535f9d50a29f054Fri, 06 Sep 2019 19:10:39 GMT\"0x8D732FDE8269679\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:39 GMT", + "x-ms-client-request-id" : "8b0181f2-de6d-43fe-94e5-a635849f8201", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryablesecondary0224535f9d50a29f054?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" : "33065e68-4b4d-412f-b22f-f3b2cfd2f60a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f767a45-401e-003a-03e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:40 GMT", + "x-ms-client-request-id" : "33065e68-4b4d-412f-b22f-f3b2cfd2f60a" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonretryablesecondary0224535f9d50a29f054" ] +} \ 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..8db89825dbe0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0336218f6ef1ba2f064ea0?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" : "d089100c-50b9-4080-a336-f34cfc9a3d8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF90460B1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b01f-401e-003a-69e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "d089100c-50b9-4080-a336-f34cfc9a3d8d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b94dcc08-696e-4d8c-b429-662c5c602b4b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b034-401e-003a-7be6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid0336218f6ef1ba2f064ea0Fri, 06 Sep 2019 19:11:08 GMT\"0x8D732FDF90460B1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "b94dcc08-696e-4d8c-b429-662c5c602b4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0336218f6ef1ba2f064ea0?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" : "ba8b1603-a549-443e-a785-0379a08316dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b04f-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "ba8b1603-a549-443e-a785-0379a08316dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid0336218f6ef1ba2f064ea0" ] +} \ 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..92112708ae96 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid07218011de8d734d7e44ad?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" : "82e1f139-d102-4dbd-8b2f-72528fa7f154" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF916DBCB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b066-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "82e1f139-d102-4dbd-8b2f-72528fa7f154" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d6f8cbe3-4c2a-46cd-9ea9-263491ec53c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b07c-401e-003a-2fe6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid07218011de8d734d7e44adFri, 06 Sep 2019 19:11:08 GMT\"0x8D732FDF916DBCB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "d6f8cbe3-4c2a-46cd-9ea9-263491ec53c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid07218011de8d734d7e44ad?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" : "33ed918d-b104-40f6-b4ff-e9d19838fb24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b08f-401e-003a-41e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "33ed918d-b104-40f6-b4ff-e9d19838fb24" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid07218011de8d734d7e44ad" ] +} \ 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..33270b1ea7dc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid088028ae12cd0d3bac4e44?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" : "7a6fc1a2-0ce2-46fd-97ec-1d05c88fa726" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF9308499\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b09c-401e-003a-4ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "7a6fc1a2-0ce2-46fd-97ec-1d05c88fa726" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2c2c0c5c-6803-4227-8e3d-70c90a1c873a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b0c5-401e-003a-6de6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid088028ae12cd0d3bac4e44Fri, 06 Sep 2019 19:11:08 GMT\"0x8D732FDF9308499\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "2c2c0c5c-6803-4227-8e3d-70c90a1c873a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid088028ae12cd0d3bac4e44?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" : "cef9e563-d42a-4493-a60f-3c8d76edbf97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b0d5-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "cef9e563-d42a-4493-a60f-3c8d76edbf97" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid088028ae12cd0d3bac4e44" ] +} \ 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..29ea6c298a59 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid06767738de69b44f5347cb?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" : "672d07e6-ff37-464a-a965-c9d38d115b1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF9439C10\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b0f3-401e-003a-11e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "672d07e6-ff37-464a-a965-c9d38d115b1a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0ba2e4ae-081a-4e2e-89b6-a024d2a66245" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b10a-401e-003a-24e6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid06767738de69b44f5347cbFri, 06 Sep 2019 19:11:08 GMT\"0x8D732FDF9439C10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "0ba2e4ae-081a-4e2e-89b6-a024d2a66245", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid06767738de69b44f5347cb?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" : "3b1dbd24-5002-4392-a59e-51785a44fa4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b117-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "3b1dbd24-5002-4392-a59e-51785a44fa4c" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid06767738de69b44f5347cb" ] +} \ 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..17f088f4fc52 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid004981dfdf0cbb8fce4862?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" : "02257796-0265-4319-933e-77cab7acecbb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF95D6BF2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b13f-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "02257796-0265-4319-933e-77cab7acecbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5aa018f7-3a3a-4713-8400-e81b4283ac47" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b196-401e-003a-1fe6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid004981dfdf0cbb8fce4862Fri, 06 Sep 2019 19:11:08 GMT\"0x8D732FDF95D6BF2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "5aa018f7-3a3a-4713-8400-e81b4283ac47", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid004981dfdf0cbb8fce4862?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" : "c5daaeda-8044-4703-b99f-fc410e451627" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b1ae-401e-003a-33e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:08 GMT", + "x-ms-client-request-id" : "c5daaeda-8044-4703-b99f-fc410e451627" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid004981dfdf0cbb8fce4862" ] +} \ 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..5b88eb1bec2e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid02912897400d29da664514?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" : "fe1ec28a-679c-4a43-94be-394aa78f2053" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF97E6988\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b1cf-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "fe1ec28a-679c-4a43-94be-394aa78f2053" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2702dce2-52ce-488f-978b-3beba48e177d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b22a-401e-003a-0ee6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid02912897400d29da664514Fri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDF97E6988\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "2702dce2-52ce-488f-978b-3beba48e177d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid02912897400d29da664514?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" : "8eb9df39-d6e7-4368-a8b9-409de06c82d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b242-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "8eb9df39-d6e7-4368-a8b9-409de06c82d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid02912897400d29da664514" ] +} \ 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..1fb1ccae7514 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid01322175778978505d4c2e?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" : "063c4cb4-7bd6-4aac-910f-859bd6de885c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF99ECABC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b268-401e-003a-40e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "063c4cb4-7bd6-4aac-910f-859bd6de885c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "41f0d8dd-0bf6-47e5-8319-9132b6234701" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b27a-401e-003a-4ee6-6473d5000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid01322175778978505d4c2eFri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDF99ECABC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "41f0d8dd-0bf6-47e5-8319-9132b6234701", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid01322175778978505d4c2e?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" : "2bc5071f-b8a8-4508-aaf7-effd5a322fcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b28e-401e-003a-5fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "2bc5071f-b8a8-4508-aaf7-effd5a322fcb" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid01322175778978505d4c2e" ] +} \ 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..3a8a6f42ffb0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriestrytimeout0retrytestretriestrytimeoutea9190696f24?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" : "c77352a3-8960-4c26-9cb2-2ac3793ef41b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDEA3D0129\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f767e9d-401e-003a-37e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:42 GMT", + "x-ms-client-request-id" : "c77352a3-8960-4c26-9cb2-2ac3793ef41b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2ea9667d-f1b5-4bfd-81e7-32fa01790c1c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f768bc7-401e-003a-29e6-6473d5000000", + "Body" : "jtcretriestrytimeoutjtcretriestrytimeout0retrytestretriestrytimeoutea9190696f24Fri, 06 Sep 2019 19:10:43 GMT\"0x8D732FDEA3D0129\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:49 GMT", + "x-ms-client-request-id" : "2ea9667d-f1b5-4bfd-81e7-32fa01790c1c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriestrytimeout0retrytestretriestrytimeoutea9190696f24?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" : "fd080edb-5784-412b-bdae-426683d91b4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f768bd7-401e-003a-37e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:49 GMT", + "x-ms-client-request-id" : "fd080edb-5784-412b-bdae-426683d91b4c" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriestrytimeout0retrytestretriestrytimeoutea9190696f24" ] +} \ 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..5f0126d9c01b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilmaxretries014663169d10a20af64d73?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" : "6b282519-d53d-4dac-8159-83466dbbdc01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDE38B7B72\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76692f-401e-003a-47e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:31 GMT", + "x-ms-client-request-id" : "6b282519-d53d-4dac-8159-83466dbbdc01" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "725c2032-5923-40f5-bcc8-021723f8e53c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f767806-401e-003a-25e6-6473d5000000", + "Body" : "jtcretriesuntilmaxretriesjtcretriesuntilmaxretries014663169d10a20af64d73Fri, 06 Sep 2019 19:10:32 GMT\"0x8D732FDE38B7B72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:38 GMT", + "x-ms-client-request-id" : "725c2032-5923-40f5-bcc8-021723f8e53c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilmaxretries014663169d10a20af64d73?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" : "ce80ea3f-2c2d-4c6b-9a48-dabf0d2d69b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f767819-401e-003a-36e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:38 GMT", + "x-ms-client-request-id" : "ce80ea3f-2c2d-4c6b-9a48-dabf0d2d69b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesuntilmaxretries014663169d10a20af64d73" ] +} \ 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..9751556e181a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilsuccess0retrytestretriesuntilsuccess04a036538c?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" : "a01eabfe-12b8-4cc0-97cf-e020f21d96bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDDD662D60\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:10:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f765268-401e-003a-07e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:20 GMT", + "x-ms-client-request-id" : "a01eabfe-12b8-4cc0-97cf-e020f21d96bf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1c4ddb4f-a728-433b-b031-d242653580f9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f7668fe-401e-003a-1de6-6473d5000000", + "Body" : "jtcretriesuntilsuccessjtcretriesuntilsuccess0retrytestretriesuntilsuccess04a036538cFri, 06 Sep 2019 19:10:21 GMT\"0x8D732FDDD662D60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:10:31 GMT", + "x-ms-client-request-id" : "1c4ddb4f-a728-433b-b031-d242653580f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilsuccess0retrytestretriesuntilsuccess04a036538c?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" : "dbf8b5fc-30a5-4bfe-af45-53d956964b15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76690c-401e-003a-29e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:10:31 GMT", + "x-ms-client-request-id" : "dbf8b5fc-30a5-4bfe-af45-53d956964b15" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesuntilsuccess0retrytestretriesuntilsuccess04a036538c" ] +} \ 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..b73fc7d0dc75 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails005205c00ba29b?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" : "95683521-4882-425d-804a-957f009d7066" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFBE1A77E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bae6-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "95683521-4882-425d-804a-957f009d7066" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails15232092efa946?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-09-07T19%3A11%3A13Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8fd2cbed-d43d-4ea8-b54d-3e09aef6cac3" + }, + "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" : "8f76baf2-401e-003a-6ae6-6473d5000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:8f76baf2-401e-003a-6ae6-6473d5000000\nTime:2019-09-06T19:11:13.0599289Z", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "8fd2cbed-d43d-4ea8-b54d-3e09aef6cac3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainerfails&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "41971250-785a-43a0-834e-b8a7d832567e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bb12-401e-003a-06e6-6473d5000000", + "Body" : "jtcaccountsasnetworkcreatecontainerfailsjtcaccountsasnetworkcreatecontainerfails005205c00ba29bFri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFBE1A77E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "41971250-785a-43a0-834e-b8a7d832567e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails005205c00ba29b?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" : "a5b20606-00be-4236-9fab-01a2623dd283" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bb22-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "a5b20606-00be-4236-9fab-01a2623dd283" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainerfails005205c00ba29b", "2019-09-06T19:11:13.041Z", "jtcaccountsasnetworkcreatecontainerfails15232092efa946" ] +} \ 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..19c2a42f18af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds04318726c9eb6?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" : "3196816f-6021-4418-9b7d-27364e06e24b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC03417C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bb53-401e-003a-41e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "3196816f-6021-4418-9b7d-27364e06e24b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds180976f620eb2?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-09-07T19%3A11%3A13Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3dec5a16-7905-439b-aa0c-271c6707b8d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC09F9DA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bb6f-401e-003a-59e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "3dec5a16-7905-439b-aa0c-271c6707b8d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainersucceeds&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "1602dd93-39ce-4e4f-b9c0-191ebde36a94" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bb83-401e-003a-69e6-6473d5000000", + "Body" : "jtcaccountsasnetworkcreatecontainersucceedsjtcaccountsasnetworkcreatecontainersucceeds04318726c9eb6Fri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC03417C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcaccountsasnetworkcreatecontainersucceeds180976f620eb2Fri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC09F9DA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "1602dd93-39ce-4e4f-b9c0-191ebde36a94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds04318726c9eb6?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" : "ccf40383-225f-40f3-9972-4d7bf00ef480" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bb9a-401e-003a-7ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "ccf40383-225f-40f3-9972-4d7bf00ef480" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds180976f620eb2?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" : "a9ff256e-b032-48a9-a64d-556f5192323e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bba8-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "a9ff256e-b032-48a9-a64d-556f5192323e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainersucceeds04318726c9eb6", "2019-09-06T19:11:13.274Z", "jtcaccountsasnetworkcreatecontainersucceeds180976f620eb2" ] +} \ 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..1114ff18a778 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails013266054dc1204?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" : "6295fc69-7460-4187-8383-416f115e52ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFBB36034\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ba55-401e-003a-63e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "6295fc69-7460-4187-8383-416f115e52ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails013266054dc1204/javablobaccountsasnetworktestblobdeletefails102863f33f3e", + "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" : "46e369c8-eb5a-446d-ab4f-c0176dc73d11", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D732FDFBB99586\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76ba6a-401e-003a-73e6-6473d5000000", + "x-ms-client-request-id" : "46e369c8-eb5a-446d-ab4f-c0176dc73d11" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails013266054dc1204/javablobaccountsasnetworktestblobdeletefails102863f33f3e?sv=2019-02-02&ss=b&srt=sco&se=2019-09-07T19%3A11%3A12Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a1f40a54-4988-4327-89bd-ad59a2f20092" + }, + "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" : "8f76ba7c-401e-003a-03e6-6473d5000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:8f76ba7c-401e-003a-03e6-6473d5000000\nTime:2019-09-06T19:11:12.7896701Z", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "a1f40a54-4988-4327-89bd-ad59a2f20092", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobdeletefails&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "052d84f7-4be9-4d69-a408-276db474c4d8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ba8f-401e-003a-11e6-6473d5000000", + "Body" : "jtcaccountsasnetworktestblobdeletefailsjtcaccountsasnetworktestblobdeletefails013266054dc1204Fri, 06 Sep 2019 19:11:12 GMT\"0x8D732FDFBB36034\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "052d84f7-4be9-4d69-a408-276db474c4d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails013266054dc1204?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" : "1a8941f9-cab9-45db-b59d-662d44eb7da1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76baa5-401e-003a-26e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "1a8941f9-cab9-45db-b59d-662d44eb7da1" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobdeletefails013266054dc1204", "javablobaccountsasnetworktestblobdeletefails102863f33f3e", "2019-09-06T19:11:12.788Z" ] +} \ 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..20225fd47dfc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread078199630bf0525824?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" : "fdf28103-6a18-43fc-99e4-468fedbace0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFB934D3C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b9e8-401e-003a-04e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "fdf28103-6a18-43fc-99e4-468fedbace0a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread078199630bf0525824/javablobaccountsasnetworktestblobread1674976f292cb146", + "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" : "a58b3e0c-f1ec-414d-88f6-c4f42b03c4cf", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D732FDFB9A947B\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76b9fd-401e-003a-17e6-6473d5000000", + "x-ms-client-request-id" : "a58b3e0c-f1ec-414d-88f6-c4f42b03c4cf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread078199630bf0525824/javablobaccountsasnetworktestblobread1674976f292cb146?sv=2019-02-02&ss=b&srt=sco&se=2019-09-07T19%3A11%3A12Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dbfcf139-7995-43c2-b647-f53284513f3e" + }, + "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" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D732FDFB9A947B\"", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "8f76ba15-401e-003a-2ae6-6473d5000000", + "Body" : "[116, 101, 115, 116]", + "x-ms-client-request-id" : "dbfcf139-7995-43c2-b647-f53284513f3e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobread&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "764efed1-37c3-436d-851f-e47a8f44185d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ba2a-401e-003a-3be6-6473d5000000", + "Body" : "jtcaccountsasnetworktestblobreadjtcaccountsasnetworktestblobread078199630bf0525824Fri, 06 Sep 2019 19:11:12 GMT\"0x8D732FDFB934D3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "764efed1-37c3-436d-851f-e47a8f44185d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread078199630bf0525824?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" : "85e0e953-1a01-4e11-b7cb-c9d361ff3f4f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ba3b-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "85e0e953-1a01-4e11-b7cb-c9d361ff3f4f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobread078199630bf0525824", "javablobaccountsasnetworktestblobread1674976f292cb146", "2019-09-06T19:11:12.586Z" ] +} \ 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..3ab15184f805 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0277083c008df0b7be44?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" : "15d5432c-2600-463c-bf64-d9c7081d1495" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE04D93EDB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d936-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "15d5432c-2600-463c-bf64-d9c7081d1495" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "26c0d73e-0622-4746-aa4f-71e78de6399c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d98c-401e-003a-28e6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0277083c008df0b7be44Fri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE04D93EDB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "26c0d73e-0622-4746-aa4f-71e78de6399c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0277083c008df0b7be44?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" : "1e8ba8c9-afc0-4f94-bd8e-172af988b491" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d99d-401e-003a-37e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "1e8ba8c9-afc0-4f94-bd8e-172af988b491" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0277083c008df0b7be44" ] +} \ 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..5aab1c36254a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse031468f9f211bd0dc541?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" : "f49eff67-88f8-4d4e-a0b5-06fccc8e6bfe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE04F5804E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d9b9-401e-003a-4fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "f49eff67-88f8-4d4e-a0b5-06fccc8e6bfe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f21cefd7-bc19-4532-8c02-9fe08059a896" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d9ca-401e-003a-5fe6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse031468f9f211bd0dc541Fri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE04F5804E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "f21cefd7-bc19-4532-8c02-9fe08059a896", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse031468f9f211bd0dc541?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" : "64eb2f45-1dc6-476a-98a0-70626d89d0a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d9d9-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "64eb2f45-1dc6-476a-98a0-70626d89d0a5" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse031468f9f211bd0dc541" ] +} \ 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..c07e1a2981b7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse079232c00c7828d4b345?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" : "e0a6f3ab-6d81-43d8-a613-2dcc5cc79b39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE05090D19\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d9e9-401e-003a-79e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "e0a6f3ab-6d81-43d8-a613-2dcc5cc79b39" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "55c3823a-20de-4982-a8f9-98a3a92dfb50" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76da05-401e-003a-11e6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse079232c00c7828d4b345Fri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE05090D19\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "55c3823a-20de-4982-a8f9-98a3a92dfb50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse079232c00c7828d4b345?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" : "8dcf558f-070e-4ddd-a64f-b7b47b214fa0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76da10-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "8dcf558f-070e-4ddd-a64f-b7b47b214fa0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse079232c00c7828d4b345" ] +} \ 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..5e65e13e725e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse08005790cfeab39dff41?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" : "db473185-fe26-4c90-b430-8493e11bfd73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE052883B4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76da22-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "db473185-fe26-4c90-b430-8493e11bfd73" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "940c25b5-7f6c-408f-a60e-d351a6bbb434" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76da53-401e-003a-55e6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse08005790cfeab39dff41Fri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE052883B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "940c25b5-7f6c-408f-a60e-d351a6bbb434", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse08005790cfeab39dff41?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" : "6b4582f3-8c85-4e63-8a1f-f2fdae64c828" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76da60-401e-003a-60e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "6b4582f3-8c85-4e63-8a1f-f2fdae64c828" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse08005790cfeab39dff41" ] +} \ 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..7082518c4ed1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse018022691a0fe7833340?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" : "6d72aacb-9349-4bce-842a-28a82ff95664" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0544C533\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76da73-401e-003a-71e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "6d72aacb-9349-4bce-842a-28a82ff95664" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f632a88d-d1c8-47ac-a9bb-95facb8223c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76da88-401e-003a-02e6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse018022691a0fe7833340Fri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE0544C533\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "f632a88d-d1c8-47ac-a9bb-95facb8223c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse018022691a0fe7833340?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" : "d7e84e9e-70db-41a9-9d2f-4564eead2372" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76da95-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "d7e84e9e-70db-41a9-9d2f-4564eead2372" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse018022691a0fe7833340" ] +} \ 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..a5d3e4b69d30 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse060791e48f717c63ea4b?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" : "9e2bd1b7-a725-4487-9cde-7dcd2c520408" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0556077C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76daa7-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "9e2bd1b7-a725-4487-9cde-7dcd2c520408" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1acb8701-707d-4d0c-89ff-47b3941c7c70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dab9-401e-003a-2de6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse060791e48f717c63ea4bFri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE0556077C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "1acb8701-707d-4d0c-89ff-47b3941c7c70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse060791e48f717c63ea4b?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" : "a9e74ccc-f524-4111-b259-e6aa185be184" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dac6-401e-003a-39e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "a9e74ccc-f524-4111-b259-e6aa185be184" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse060791e48f717c63ea4b" ] +} \ 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..72d71050a3b6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse051054cc1d1a681f5d4b?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" : "57e21c23-b999-4424-acbc-88befd33638f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0567E62F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76dad6-401e-003a-46e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:28 GMT", + "x-ms-client-request-id" : "57e21c23-b999-4424-acbc-88befd33638f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fb32a8fe-cf44-41fc-b759-9d1e86729a05" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dae1-401e-003a-4fe6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse051054cc1d1a681f5d4bFri, 06 Sep 2019 19:11:28 GMT\"0x8D732FE0567E62F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "fb32a8fe-cf44-41fc-b759-9d1e86729a05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse051054cc1d1a681f5d4b?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" : "db6a84eb-c34c-4fa2-8b97-1bf316e70eee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76daef-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "db6a84eb-c34c-4fa2-8b97-1bf316e70eee" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse051054cc1d1a681f5d4b" ] +} \ 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..037b43387b5d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse039692941f60c86a814a?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" : "3d7a4360-4382-4b07-8731-6f2d8799840d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0580CB73\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76db16-401e-003a-79e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "3d7a4360-4382-4b07-8731-6f2d8799840d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "559caeba-592e-4a81-b76f-91bd491dbbf6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76db57-401e-003a-2fe6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse039692941f60c86a814aFri, 06 Sep 2019 19:11:29 GMT\"0x8D732FE0580CB73\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "559caeba-592e-4a81-b76f-91bd491dbbf6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse039692941f60c86a814a?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" : "11178479-217c-4d89-a846-87d50a877b6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76db6c-401e-003a-3de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "11178479-217c-4d89-a846-87d50a877b6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse039692941f60c86a814a" ] +} \ 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..1550eb532e66 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0063445b84f71fc1f248?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" : "285dff8b-00b0-4cc8-9f43-d1b19c504135" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE05A6AC3B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76db84-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "285dff8b-00b0-4cc8-9f43-d1b19c504135" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e55fdc6-4672-4409-9feb-dc9781146235" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dbcb-401e-003a-0fe6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0063445b84f71fc1f248Fri, 06 Sep 2019 19:11:29 GMT\"0x8D732FE05A6AC3B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "3e55fdc6-4672-4409-9feb-dc9781146235", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0063445b84f71fc1f248?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" : "31c11b96-c69f-4cff-836b-189bcf50be12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dbe5-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "31c11b96-c69f-4cff-836b-189bcf50be12" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0063445b84f71fc1f248" ] +} \ 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..6dce2b108a37 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse038373d760fcd4745c4c?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" : "21870c82-dbd2-40fb-ada1-84a8f278d302" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE05C11883\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76dc05-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "21870c82-dbd2-40fb-ada1-84a8f278d302" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e6f263c2-58de-4bb7-953f-2e8cf469b909" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dc16-401e-003a-4ce6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse038373d760fcd4745c4cFri, 06 Sep 2019 19:11:29 GMT\"0x8D732FE05C11883\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "e6f263c2-58de-4bb7-953f-2e8cf469b909", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse038373d760fcd4745c4c?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" : "5ed6d4f5-9a9a-4e10-9cdf-20d954fad4fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dc29-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "5ed6d4f5-9a9a-4e10-9cdf-20d954fad4fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse038373d760fcd4745c4c" ] +} \ 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..7dbb8987f4ec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia070267f21f153d7ea94?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" : "140f37a2-c984-4818-9a6b-e42dd1df2f23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE05D3BAB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76dc52-401e-003a-7be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "140f37a2-c984-4818-9a6b-e42dd1df2f23" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6854f3e5-e388-4d33-b8bc-22cc1e6db4e5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dc6b-401e-003a-0fe6-6473d5000000", + "Body" : "jtcaccountsaspermissionsparseiajtcaccountsaspermissionsparseia070267f21f153d7ea94Fri, 06 Sep 2019 19:11:29 GMT\"0x8D732FE05D3BAB4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "6854f3e5-e388-4d33-b8bc-22cc1e6db4e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia070267f21f153d7ea94?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" : "c69ef948-4625-49f0-ad6b-a2bfab61f738" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dc76-401e-003a-18e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "c69ef948-4625-49f0-ad6b-a2bfab61f738" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparseia070267f21f153d7ea94" ] +} \ 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..50e3ee6b9389 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring094589ae60065c6396?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" : "c29ac90c-ce1e-4319-b531-7996363a03b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0411EDA3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d6a4-401e-003a-32e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "c29ac90c-ce1e-4319-b531-7996363a03b2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b762b538-78d8-4dd9-8b3b-83fc666dd96b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d6bd-401e-003a-48e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring094589ae60065c6396Fri, 06 Sep 2019 19:11:26 GMT\"0x8D732FE0411EDA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "b762b538-78d8-4dd9-8b3b-83fc666dd96b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring094589ae60065c6396?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" : "f1fe9c1d-95af-41ce-921c-da88dbb509da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d6d6-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "f1fe9c1d-95af-41ce-921c-da88dbb509da" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring094589ae60065c6396" ] +} \ 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..b34a9a71baba --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring03063184b60b12700b?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" : "57136e9c-2354-4ca9-9798-d108dbc1d398" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE04248FD9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d6f0-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "57136e9c-2354-4ca9-9798-d108dbc1d398" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "84edd78c-9317-4a6f-b916-303a7000b274" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d704-401e-003a-05e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring03063184b60b12700bFri, 06 Sep 2019 19:11:26 GMT\"0x8D732FE04248FD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "84edd78c-9317-4a6f-b916-303a7000b274", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring03063184b60b12700b?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" : "65fcb748-c6d4-426c-bc32-613130c2363a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d719-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "65fcb748-c6d4-426c-bc32-613130c2363a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring03063184b60b12700b" ] +} \ 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..4165788f452e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0370315a71286af305?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" : "185cd17d-ff79-4a61-8107-e8aca6f4e5a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE043E86D6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d740-401e-003a-33e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "185cd17d-ff79-4a61-8107-e8aca6f4e5a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ef7687b1-2afd-47c3-8a17-76ff31897ce1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d775-401e-003a-5ae6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0370315a71286af305Fri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE043E86D6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "ef7687b1-2afd-47c3-8a17-76ff31897ce1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0370315a71286af305?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" : "693a5482-a6a8-4143-9122-ea3b6abeab94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d786-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "693a5482-a6a8-4143-9122-ea3b6abeab94" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0370315a71286af305" ] +} \ 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..8ba651cb3502 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring011777817007ff9d7e?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" : "9b2f1007-71ac-4063-ac40-ffca8298a6f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0452B003\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d799-401e-003a-7ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "9b2f1007-71ac-4063-ac40-ffca8298a6f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "43dbe63f-dc09-4364-9925-2fe96c2292f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d7ac-401e-003a-0be6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring011777817007ff9d7eFri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE0452B003\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "43dbe63f-dc09-4364-9925-2fe96c2292f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring011777817007ff9d7e?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" : "37da2891-b087-44a1-88c3-b0be1cb8e791" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d7b8-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "37da2891-b087-44a1-88c3-b0be1cb8e791" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring011777817007ff9d7e" ] +} \ 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..b306388fa49d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0595153dbdb6823fdb?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" : "854b522c-5000-4e64-acc5-5feac9029f6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE04657944\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d7db-401e-003a-33e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "854b522c-5000-4e64-acc5-5feac9029f6a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3a7a5763-76cb-4909-b346-169af8e002e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d7f4-401e-003a-46e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0595153dbdb6823fdbFri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE04657944\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "3a7a5763-76cb-4909-b346-169af8e002e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0595153dbdb6823fdb?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" : "46c05c65-96df-4a34-b959-2907800676b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d801-401e-003a-51e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "46c05c65-96df-4a34-b959-2907800676b2" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0595153dbdb6823fdb" ] +} \ 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..01f74b53b9f4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring041028ba5a3f592b5a?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" : "bd91eb7e-77bf-4ed3-abe7-a33dbbbef4b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0477A624\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d80f-401e-003a-5ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "bd91eb7e-77bf-4ed3-abe7-a33dbbbef4b2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "13025e80-1a14-40f5-82bd-838eed1e1933" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d828-401e-003a-72e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring041028ba5a3f592b5aFri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE0477A624\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "13025e80-1a14-40f5-82bd-838eed1e1933", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring041028ba5a3f592b5a?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" : "18ab1d65-6d16-4df8-bc23-2cf125ac3e2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d835-401e-003a-7fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "18ab1d65-6d16-4df8-bc23-2cf125ac3e2b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring041028ba5a3f592b5a" ] +} \ 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..bfb95944f8f6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring08806863da0065a078?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" : "6b231a74-4e32-4bc9-9302-0853dbe94f54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE048A2132\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d84f-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "6b231a74-4e32-4bc9-9302-0853dbe94f54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "993e5a45-89d5-4c72-a6c4-3c446744eaee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d864-401e-003a-27e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring08806863da0065a078Fri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE048A2132\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "993e5a45-89d5-4c72-a6c4-3c446744eaee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring08806863da0065a078?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" : "937b370e-5e9d-429f-a040-ddf3f5c47603" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d877-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "937b370e-5e9d-429f-a040-ddf3f5c47603" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring08806863da0065a078" ] +} \ 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..1984a36c0d85 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring03372055f8af00b80e?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" : "37d971fb-83ee-4403-a6fd-2af9afc67a17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE049E4A5B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d88a-401e-003a-47e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "37d971fb-83ee-4403-a6fd-2af9afc67a17" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "405fc014-fc67-451d-857b-14c1757dde2b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d89a-401e-003a-55e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring03372055f8af00b80eFri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE049E4A5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "405fc014-fc67-451d-857b-14c1757dde2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring03372055f8af00b80e?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" : "b167a2ec-2074-44aa-80b3-a05ac168ea87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d8a4-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "b167a2ec-2074-44aa-80b3-a05ac168ea87" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring03372055f8af00b80e" ] +} \ 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..40832640f350 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring03389215f0d2c53a0a?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" : "39f76ea2-03af-49d2-9615-d4f3babac306" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE04B92BEB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d8b3-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "39f76ea2-03af-49d2-9615-d4f3babac306" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dd4e4b1b-aa23-488d-bfc1-608edac12596" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d904-401e-003a-32e6-6473d5000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring03389215f0d2c53a0aFri, 06 Sep 2019 19:11:27 GMT\"0x8D732FE04B92BEB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "dd4e4b1b-aa23-488d-bfc1-608edac12596", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring03389215f0d2c53a0a?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" : "28536c59-3943-4305-a41c-42fed7b7c94c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d915-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:27 GMT", + "x-ms-client-request-id" : "28536c59-3943-4305-a41c-42fed7b7c94c" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring03389215f0d2c53a0a" ] +} \ 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..62742a81f145 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia08097641d68117fbae478?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" : "d32f1857-a1fe-46bb-a1c5-d46579d9f919" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE06FA5A7D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76dfc8-401e-003a-63e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "d32f1857-a1fe-46bb-a1c5-d46579d9f919" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2cd32ec0-573b-4542-9bc2-9e9519775a44" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dfe5-401e-003a-76e6-6473d5000000", + "Body" : "jtcaccountsasresourcetypeiajtcaccountsasresourcetypeia08097641d68117fbae478Fri, 06 Sep 2019 19:11:31 GMT\"0x8D732FE06FA5A7D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "2cd32ec0-573b-4542-9bc2-9e9519775a44", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia08097641d68117fbae478?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" : "6a739ebd-d4c0-4c44-8676-255485d74d62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dff5-401e-003a-02e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "6a739ebd-d4c0-4c44-8676-255485d74d62" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeia08097641d68117fbae478" ] +} \ 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..d455555edba1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0602442689c297c8024?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" : "2f7809ae-9dd2-4f09-9caf-676632a79e25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE068694C2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76de7b-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "2f7809ae-9dd2-4f09-9caf-676632a79e25" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "71ecd907-708a-4f47-a30e-44f8acd7e728" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76de8d-401e-003a-59e6-6473d5000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0602442689c297c8024Fri, 06 Sep 2019 19:11:30 GMT\"0x8D732FE068694C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "71ecd907-708a-4f47-a30e-44f8acd7e728", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0602442689c297c8024?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" : "38e2b269-07a3-4d96-8bba-aafcd7117783" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76de9c-401e-003a-66e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "38e2b269-07a3-4d96-8bba-aafcd7117783" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0602442689c297c8024" ] +} \ 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..255a11e5b2c5 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse073262987a591813ad4?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" : "e2f2e91d-e83c-4979-96de-315111915660" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE06AF5C69\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76deeb-401e-003a-28e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "e2f2e91d-e83c-4979-96de-315111915660" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8afa3f76-c5c9-492b-96f3-92bf539aa2cc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76df02-401e-003a-3be6-6473d5000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse073262987a591813ad4Fri, 06 Sep 2019 19:11:31 GMT\"0x8D732FE06AF5C69\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "8afa3f76-c5c9-492b-96f3-92bf539aa2cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse073262987a591813ad4?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" : "19231c20-d94c-4550-9541-43f67ccf122f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76df0f-401e-003a-48e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "19231c20-d94c-4550-9541-43f67ccf122f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse073262987a591813ad4" ] +} \ 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..2486c44b2932 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse06532056dd6c28f8344?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" : "ee40c9c4-4796-4121-8f3e-2d41117bca0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE06C1D783\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76df26-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "ee40c9c4-4796-4121-8f3e-2d41117bca0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1eb383ed-2369-48e2-a831-10d701a39c5d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76df3c-401e-003a-6de6-6473d5000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse06532056dd6c28f8344Fri, 06 Sep 2019 19:11:31 GMT\"0x8D732FE06C1D783\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "1eb383ed-2369-48e2-a831-10d701a39c5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse06532056dd6c28f8344?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" : "f62e0258-c926-42cc-a23d-34dd511e272b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76df45-401e-003a-76e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "f62e0258-c926-42cc-a23d-34dd511e272b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse06532056dd6c28f8344" ] +} \ 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..3d82003da20f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0136172492caf4038c4?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" : "99f2d66c-cbc8-49ae-80a4-0615181c7781" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE06DAE3EC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76df5a-401e-003a-07e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "99f2d66c-cbc8-49ae-80a4-0615181c7781" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bc632eec-386d-4cfc-9cef-2ebfe58d9cf9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dfa6-401e-003a-49e6-6473d5000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0136172492caf4038c4Fri, 06 Sep 2019 19:11:31 GMT\"0x8D732FE06DAE3EC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "bc632eec-386d-4cfc-9cef-2ebfe58d9cf9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0136172492caf4038c4?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" : "dedade35-e888-4c3e-a7c3-fda4fb370e3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dfae-401e-003a-50e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "dedade35-e888-4c3e-a7c3-fda4fb370e3f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0136172492caf4038c4" ] +} \ 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..eef59db43c65 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring042676febc99b23416?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" : "87fd1177-6a6b-4479-be99-bdb23c736c89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE05ED8A9F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76dc88-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "87fd1177-6a6b-4479-be99-bdb23c736c89" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "85d7e314-5789-4eb8-9276-fb618f23222e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dcda-401e-003a-6ce6-6473d5000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring042676febc99b23416Fri, 06 Sep 2019 19:11:29 GMT\"0x8D732FE05ED8A9F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:29 GMT", + "x-ms-client-request-id" : "85d7e314-5789-4eb8-9276-fb618f23222e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring042676febc99b23416?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" : "6a1d3d5d-da23-4fe2-a491-5a1cf7a4f89a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dce2-401e-003a-74e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "6a1d3d5d-da23-4fe2-a491-5a1cf7a4f89a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring042676febc99b23416" ] +} \ 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..c6d6294d1695 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring03616784044eada3ea?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" : "d5001494-8665-4e71-a6e7-3749d15b93e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE062F1077\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76dd46-401e-003a-48e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "d5001494-8665-4e71-a6e7-3749d15b93e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3c348fc5-c93a-4ff4-94bc-76ed0b10022a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76dd99-401e-003a-07e6-6473d5000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring03616784044eada3eaFri, 06 Sep 2019 19:11:30 GMT\"0x8D732FE062F1077\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "3c348fc5-c93a-4ff4-94bc-76ed0b10022a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring03616784044eada3ea?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" : "bcc9995c-b2c0-4834-b88c-68d341a7c94f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76dda6-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "bcc9995c-b2c0-4834-b88c-68d341a7c94f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring03616784044eada3ea" ] +} \ 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..708e6068e6aa --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0754814bd498ef5bfa?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" : "c123c72e-b9f8-4271-adc6-9450d06eabb4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE066373C5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76de05-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "c123c72e-b9f8-4271-adc6-9450d06eabb4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e2362898-ce90-4de8-9ba3-c22a443df341" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76de21-401e-003a-7fe6-6473d5000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0754814bd498ef5bfaFri, 06 Sep 2019 19:11:30 GMT\"0x8D732FE066373C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "e2362898-ce90-4de8-9ba3-c22a443df341", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0754814bd498ef5bfa?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" : "71d23456-5646-4ebc-b0f8-0f7cd10e0c82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76de33-401e-003a-10e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "71d23456-5646-4ebc-b0f8-0f7cd10e0c82" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0754814bd498ef5bfa" ] +} \ 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..0e8f13a58c2e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0374636052cb66f714?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" : "0dba2b70-2073-48ac-8281-c199e81807a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0675EEDF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76de47-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "0dba2b70-2073-48ac-8281-c199e81807a3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2b0575a-6615-4b7b-a464-bce78b7eb4fb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76de57-401e-003a-2be6-6473d5000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0374636052cb66f714Fri, 06 Sep 2019 19:11:30 GMT\"0x8D732FE0675EEDF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "d2b0575a-6615-4b7b-a464-bce78b7eb4fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0374636052cb66f714?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" : "7725f71b-7537-475d-b070-e3d299590c0e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76de5f-401e-003a-32e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:30 GMT", + "x-ms-client-request-id" : "7725f71b-7537-475d-b070-e3d299590c0e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0374636052cb66f714" ] +} \ 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..e49309f728a3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign006779b34488472e3?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" : "23e170fe-9df4-4f58-99b3-b4fce2d5c031" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0308C82A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d2b7-401e-003a-7be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "23e170fe-9df4-4f58-99b3-b4fce2d5c031" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a557a49e-7aec-438a-819f-62633feda693" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d301-401e-003a-34e6-6473d5000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign006779b34488472e3Fri, 06 Sep 2019 19:11:25 GMT\"0x8D732FE0308C82A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "a557a49e-7aec-438a-819f-62633feda693", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign006779b34488472e3?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" : "37008186-6f2c-4418-847b-2a381543b848" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d31a-401e-003a-47e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "37008186-6f2c-4418-847b-2a381543b848" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign006779b34488472e3" ] +} \ 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..af3d522ff6d0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign072623999c60ff97f?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" : "b70e7775-5989-4e44-b711-30a79437ad57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE031F14BD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d335-401e-003a-5fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "b70e7775-5989-4e44-b711-30a79437ad57" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "687d0abd-ff5c-4573-be6b-30c147e0dac1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d352-401e-003a-78e6-6473d5000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign072623999c60ff97fFri, 06 Sep 2019 19:11:25 GMT\"0x8D732FE031F14BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "687d0abd-ff5c-4573-be6b-30c147e0dac1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign072623999c60ff97f?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" : "a8299f83-ab1f-42ea-998b-7eccff57670c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d368-401e-003a-0ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "a8299f83-ab1f-42ea-998b-7eccff57670c" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign072623999c60ff97f" ] +} \ 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..bf785340e986 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign0585632713c79c9b4?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" : "a3ce527e-6dcd-4bd9-bdc3-bd02a4038125" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0337D2EE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d386-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "a3ce527e-6dcd-4bd9-bdc3-bd02a4038125" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1bd127ea-c843-4fcd-b31e-07d1a8f62aac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d3e0-401e-003a-6de6-6473d5000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign0585632713c79c9b4Fri, 06 Sep 2019 19:11:25 GMT\"0x8D732FE0337D2EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "1bd127ea-c843-4fcd-b31e-07d1a8f62aac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign0585632713c79c9b4?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" : "f65e95a4-9f75-4b25-83fb-3688737df1b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d3f0-401e-003a-79e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "f65e95a4-9f75-4b25-83fb-3688737df1b0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign0585632713c79c9b4" ] +} \ 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..460ae41b781b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0385415d0911dad6c24?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" : "9bdf6662-abf2-45a7-83c4-170790e64364" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE035A5783\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d401-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "9bdf6662-abf2-45a7-83c4-170790e64364" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "de01297e-3468-4310-b041-69b3e56eb97b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d424-401e-003a-27e6-6473d5000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0385415d0911dad6c24Fri, 06 Sep 2019 19:11:25 GMT\"0x8D732FE035A5783\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "de01297e-3468-4310-b041-69b3e56eb97b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0385415d0911dad6c24?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" : "cbe5a6f0-0d4b-4659-86b9-663983aeb900" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d439-401e-003a-39e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "cbe5a6f0-0d4b-4659-86b9-663983aeb900" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0385415d0911dad6c24" ] +} \ 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..94ee486dd49a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia09880886aa37d3efd14?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" : "ac0f3064-7d25-488d-9e2f-295bf806728c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0370F24E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d44c-401e-003a-49e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:25 GMT", + "x-ms-client-request-id" : "ac0f3064-7d25-488d-9e2f-295bf806728c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e830085b-491d-4fb5-b980-04f08b83ca9f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d4fc-401e-003a-5ae6-6473d5000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia09880886aa37d3efd14Fri, 06 Sep 2019 19:11:25 GMT\"0x8D732FE0370F24E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "e830085b-491d-4fb5-b980-04f08b83ca9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia09880886aa37d3efd14?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" : "969e8b7d-8d91-4201-beee-5a43cb5dcaec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d50f-401e-003a-69e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "969e8b7d-8d91-4201-beee-5a43cb5dcaec" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia09880886aa37d3efd14" ] +} \ 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..39fa7681348e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0328933beaf4c703734?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" : "9de77eb8-7e8f-427c-87d2-58f7cf95cb1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE03BC8CC8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d52e-401e-003a-7fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "9de77eb8-7e8f-427c-87d2-58f7cf95cb1a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b4509b44-14bb-4636-a9ad-039370d645ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d548-401e-003a-15e6-6473d5000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0328933beaf4c703734Fri, 06 Sep 2019 19:11:26 GMT\"0x8D732FE03BC8CC8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "b4509b44-14bb-4636-a9ad-039370d645ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0328933beaf4c703734?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" : "1347e40b-4d2f-44b1-a5a5-e1a0da4cf79a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d550-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "1347e40b-4d2f-44b1-a5a5-e1a0da4cf79a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0328933beaf4c703734" ] +} \ 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..6f190b07861e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0427597d6f62636e924?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" : "5e2ed639-1b31-4469-8ed0-a656e21633b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE03D57215\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d573-401e-003a-39e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "5e2ed639-1b31-4469-8ed0-a656e21633b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0762838c-c8ab-4645-acd1-e40dbbfc59ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d5b2-401e-003a-69e6-6473d5000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0427597d6f62636e924Fri, 06 Sep 2019 19:11:26 GMT\"0x8D732FE03D57215\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "0762838c-c8ab-4645-acd1-e40dbbfc59ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0427597d6f62636e924?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" : "6e9dff8e-164c-43ae-a4ea-2a70d49f7932" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d5c8-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "6e9dff8e-164c-43ae-a4ea-2a70d49f7932" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0427597d6f62636e924" ] +} \ 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..6b2332254c6c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia098809a9c6cd3a93004?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" : "f960f6a4-96f2-4dc3-9a7f-62c7cd950577" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE03EFDE5C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d5ee-401e-003a-1ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "f960f6a4-96f2-4dc3-9a7f-62c7cd950577" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a8e91408-bf93-4d0c-8f1d-b33e2abe69c1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d610-401e-003a-34e6-6473d5000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia098809a9c6cd3a93004Fri, 06 Sep 2019 19:11:26 GMT\"0x8D732FE03EFDE5C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "a8e91408-bf93-4d0c-8f1d-b33e2abe69c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia098809a9c6cd3a93004?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" : "a3c6f483-3570-4e8f-bdc9-68e0f8437bfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d62d-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "a3c6f483-3570-4e8f-bdc9-68e0f8437bfa" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia098809a9c6cd3a93004" ] +} \ 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..9b2132244d54 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia083217bf0335a2b7214?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" : "18936784-efd4-4980-9e9b-19fef1b02f78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE04016EDD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d651-401e-003a-6de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "18936784-efd4-4980-9e9b-19fef1b02f78" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "65480a2f-c219-4fec-b3ae-80ac021476e6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d66a-401e-003a-02e6-6473d5000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia083217bf0335a2b7214Fri, 06 Sep 2019 19:11:26 GMT\"0x8D732FE04016EDD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "65480a2f-c219-4fec-b3ae-80ac021476e6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia083217bf0335a2b7214?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" : "cbb1416f-da3b-46c8-b0d8-1bfad65b7c88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d681-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:26 GMT", + "x-ms-client-request-id" : "cbb1416f-da3b-46c8-b0d8-1bfad65b7c88" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia083217bf0335a2b7214" ] +} \ 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..2a0a1aab61fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot41539879c?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" : "152e3579-cee0-4697-9d02-bb2dd1ab04af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFA1AA8C6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b44f-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "152e3579-cee0-4697-9d02-bb2dd1ab04af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot41539879c/javablobblobclientgetsnapshot1184009cbebc988fe145", + "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" : "24707595-3e1b-435c-a24b-66dc49ed11d7", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D732FDFA21A4B6\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76b487-401e-003a-7fe6-6473d5000000", + "x-ms-client-request-id" : "24707595-3e1b-435c-a24b-66dc49ed11d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot41539879c/javablobblobclientgetsnapshot1184009cbebc988fe145?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", + "x-ms-client-request-id" : "a374feed-2c83-4207-af21-7709c7b7d246" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:11:10.1568751Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFA21A4B6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b4cf-401e-003a-36e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "a374feed-2c83-4207-af21-7709c7b7d246" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f91b48eb-0420-478b-959b-e8e7b761d079" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b58d-401e-003a-4ee6-6473d5000000", + "Body" : "jtcblobclientgetsnapshotjtcblobclientgetsnapshot0sastestblobclientgetsnapshot41539879cFri, 06 Sep 2019 19:11:10 GMT\"0x8D732FDFA1AA8C6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "f91b48eb-0420-478b-959b-e8e7b761d079", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot41539879c?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" : "543092dd-b57d-488c-9b93-cd28393ad389" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b59d-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "543092dd-b57d-488c-9b93-cd28393ad389" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobclientgetsnapshot0sastestblobclientgetsnapshot41539879c", "javablobblobclientgetsnapshot1184009cbebc988fe145" ] +} \ 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..cd19101d5d44 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshote309742862?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" : "1df9d5d3-a60e-449c-887e-87acfc23a830" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFA795ABC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b5bd-401e-003a-77e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "1df9d5d3-a60e-449c-887e-87acfc23a830" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshote309742862/javablobblobclientissnapshot1450095842eb7d1f7a4d", + "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" : "be5acb12-9111-453c-adb5-a19be4a20f5a", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D732FDFA7FE0AA\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76b5d1-401e-003a-07e6-6473d5000000", + "x-ms-client-request-id" : "be5acb12-9111-453c-adb5-a19be4a20f5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshote309742862/javablobblobclientissnapshot1450095842eb7d1f7a4d?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", + "x-ms-client-request-id" : "42e08e59-2ff5-4c2c-9e29-3c7f629b3bf6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:11:10.7554303Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFA7FE0AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b609-401e-003a-35e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "42e08e59-2ff5-4c2c-9e29-3c7f629b3bf6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "32af3d7a-4043-48d8-9bda-755f195e56d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b645-401e-003a-67e6-6473d5000000", + "Body" : "jtcblobclientissnapshotjtcblobclientissnapshot0sastestblobclientissnapshote309742862Fri, 06 Sep 2019 19:11:10 GMT\"0x8D732FDFA795ABC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "32af3d7a-4043-48d8-9bda-755f195e56d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshote309742862?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" : "c7d8b52c-0aea-405d-a935-c0d1ba422797" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b655-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "c7d8b52c-0aea-405d-a935-c0d1ba422797" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobclientissnapshot0sastestblobclientissnapshote309742862", "javablobblobclientissnapshot1450095842eb7d1f7a4d" ] +} \ 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..6b759b6cd81c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrangee8f20389d2436d42c47e4?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" : "0ba0214d-db41-46bb-901e-1f76ad17c1ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF9B0F79E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b2a7-401e-003a-76e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "0ba0214d-db41-46bb-901e-1f76ad17c1ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "12f85c37-3a36-4505-98e8-4ff383cd05f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b2c6-401e-003a-0ee6-6473d5000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrangee8f20389d2436d42c47e4Fri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDF9B0F79E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "12f85c37-3a36-4505-98e8-4ff383cd05f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrangee8f20389d2436d42c47e4?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" : "20f5a9f3-7721-45d3-88bc-8fd1995bc0a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b2d5-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "20f5a9f3-7721-45d3-88bc-8fd1995bc0a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrangee8f20389d2436d42c47e4" ] +} \ 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..751e2d54abaf --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange4f6329199e7475c9b4724?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" : "0597b11d-4117-4a76-b744-5c307b72e889" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF9C5BD3A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b2fd-401e-003a-3ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "0597b11d-4117-4a76-b744-5c307b72e889" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "65b1721c-07fc-4474-9f16-73af008dd303" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b318-401e-003a-53e6-6473d5000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrange4f6329199e7475c9b4724Fri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDF9C5BD3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "65b1721c-07fc-4474-9f16-73af008dd303", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange4f6329199e7475c9b4724?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" : "196cc897-9d53-44af-b3a5-6c640186494e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b335-401e-003a-69e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "196cc897-9d53-44af-b3a5-6c640186494e" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrange4f6329199e7475c9b4724" ] +} \ 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..5faa622cf2d6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange631702608b8394a77e6b4?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" : "3b37ae91-8341-44a6-9833-9650c486d533" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF9DE2D38\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b358-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "3b37ae91-8341-44a6-9833-9650c486d533" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5054605c-dcb6-49d8-b032-5104dfa0039a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b3a5-401e-003a-44e6-6473d5000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrange631702608b8394a77e6b4Fri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDF9DE2D38\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "5054605c-dcb6-49d8-b032-5104dfa0039a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange631702608b8394a77e6b4?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" : "e16a573e-5bad-46b0-8062-f58f0112f4b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b3b6-401e-003a-50e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "e16a573e-5bad-46b0-8062-f58f0112f4b9" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrange631702608b8394a77e6b4" ] +} \ 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..358cea106be9 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeiac589116922dc581ef51?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" : "3ed504c1-04e6-4206-b04a-a1130eb11029" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDF9F7D606\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b3cd-401e-003a-64e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "3ed504c1-04e6-4206-b04a-a1130eb11029" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e948dfac-ea86-42e0-b16a-80e62e52c96e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b3e2-401e-003a-76e6-6473d5000000", + "Body" : "jtcblobrangeiajtcblobrangeia0sastestblobrangeiac589116922dc581ef51Fri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDF9F7D606\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "e948dfac-ea86-42e0-b16a-80e62e52c96e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeiac589116922dc581ef51?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" : "9d01860f-c3d1-4277-88ee-77f24f9a015c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b3f2-401e-003a-04e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "9d01860f-c3d1-4277-88ee-77f24f9a015c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0sastestblobrangeiac589116922dc581ef51" ] +} \ 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..246f8fb3d2ed --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeia36f87416baf6fbe3bce?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" : "9bee89b9-ac64-409c-96b2-98035a271e6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFA098D95\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b410-401e-003a-1fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "9bee89b9-ac64-409c-96b2-98035a271e6d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "97e1e34a-d5c8-4945-9ee4-d2ff43426986" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b42b-401e-003a-34e6-6473d5000000", + "Body" : "jtcblobrangeiajtcblobrangeia0sastestblobrangeia36f87416baf6fbe3bceFri, 06 Sep 2019 19:11:09 GMT\"0x8D732FDFA098D95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "97e1e34a-d5c8-4945-9ee4-d2ff43426986", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeia36f87416baf6fbe3bce?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" : "fca47d8c-62b4-4590-930b-2e96e1b2a7ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b436-401e-003a-3fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:09 GMT", + "x-ms-client-request-id" : "fca47d8c-62b4-4590-930b-2e96e1b2a7ff" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0sastestblobrangeia36f87416baf6fbe3bce" ] +} \ 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..0fb35f222dd8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse051372129e39a6f4844bb?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" : "9c990ee3-f057-4b7e-b826-950327776069" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF726475\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c6c6-401e-003a-27e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "9c990ee3-f057-4b7e-b826-950327776069" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6ed11e85-7b0a-45e5-9189-1ec5c9bf48f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c6e4-401e-003a-40e6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse051372129e39a6f4844bbFri, 06 Sep 2019 19:11:19 GMT\"0x8D732FDFF726475\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "6ed11e85-7b0a-45e5-9189-1ec5c9bf48f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse051372129e39a6f4844bb?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" : "9964bd46-b720-4758-921e-bf5729ac532b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c707-401e-003a-5fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "9964bd46-b720-4758-921e-bf5729ac532b" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse051372129e39a6f4844bb" ] +} \ 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..0bdc508619f7 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0820714496bc7e4a8e421?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" : "cb9991bc-ec27-4e02-939b-4b7183a6b3f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF84B873\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c728-401e-003a-7ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "cb9991bc-ec27-4e02-939b-4b7183a6b3f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4e18e6c4-c4fb-4639-894a-dc1960aa7f4e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c73c-401e-003a-0ce6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0820714496bc7e4a8e421Fri, 06 Sep 2019 19:11:19 GMT\"0x8D732FDFF84B873\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "4e18e6c4-c4fb-4639-894a-dc1960aa7f4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0820714496bc7e4a8e421?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" : "2312e20d-fc25-486c-8598-f9ad1a9a85fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c749-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "2312e20d-fc25-486c-8598-f9ad1a9a85fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0820714496bc7e4a8e421" ] +} \ 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..7b83e3688167 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse030596f554e16b3a4d4cb?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" : "85c404f4-9342-4a27-b647-e3597ef7e8c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF97338D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c769-401e-003a-32e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "85c404f4-9342-4a27-b647-e3597ef7e8c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c904f54e-ad5b-4ed9-9a31-eff35b103902" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c77e-401e-003a-45e6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse030596f554e16b3a4d4cbFri, 06 Sep 2019 19:11:19 GMT\"0x8D732FDFF97338D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "c904f54e-ad5b-4ed9-9a31-eff35b103902", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse030596f554e16b3a4d4cb?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" : "45f01c3d-9bdf-40fc-a8ae-e3f07eb671fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c78c-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "45f01c3d-9bdf-40fc-a8ae-e3f07eb671fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse030596f554e16b3a4d4cb" ] +} \ 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..db84a9e3313b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse098066199c7fc7085f4b7?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" : "ca7c8fd3-2489-45c8-9c1e-ebdaea58a058" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFFA8EB25\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c7a2-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "ca7c8fd3-2489-45c8-9c1e-ebdaea58a058" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7d69080d-f4f0-476a-a2cc-6d84863f0998" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c7c2-401e-003a-80e6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse098066199c7fc7085f4b7Fri, 06 Sep 2019 19:11:19 GMT\"0x8D732FDFFA8EB25\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "7d69080d-f4f0-476a-a2cc-6d84863f0998", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse098066199c7fc7085f4b7?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" : "0004e5cd-1d04-4792-93fc-03ce1b9dd8d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c7d0-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "0004e5cd-1d04-4792-93fc-03ce1b9dd8d5" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse098066199c7fc7085f4b7" ] +} \ 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..853ff0934165 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse010770171e0c499ed148d?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" : "47fe8775-a11c-4641-860d-be68dc4670dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFFC245BC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c7e4-401e-003a-1fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "47fe8775-a11c-4641-860d-be68dc4670dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d0905649-5e0d-43a8-9ad5-1edef9ef89f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c82e-401e-003a-5be6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse010770171e0c499ed148dFri, 06 Sep 2019 19:11:19 GMT\"0x8D732FDFFC245BC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "d0905649-5e0d-43a8-9ad5-1edef9ef89f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse010770171e0c499ed148d?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" : "59f3c079-526d-4765-a10c-2888e61dd0ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c83f-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "59f3c079-526d-4765-a10c-2888e61dd0ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse010770171e0c499ed148d" ] +} \ 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..c8a7d91e7f9f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse042971cc9db65cfa46481?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" : "6e91069f-9418-400e-9961-4b7d488f62b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFFF2B068\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c85f-401e-003a-07e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "6e91069f-9418-400e-9961-4b7d488f62b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c09058f4-b0b1-4e78-9ddf-459e01793ebd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c8a5-401e-003a-3ee6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse042971cc9db65cfa46481Fri, 06 Sep 2019 19:11:19 GMT\"0x8D732FDFFF2B068\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "c09058f4-b0b1-4e78-9ddf-459e01793ebd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse042971cc9db65cfa46481?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" : "adae9049-f140-4ce4-83e3-78fbfff513bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c8b8-401e-003a-4fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:19 GMT", + "x-ms-client-request-id" : "adae9049-f140-4ce4-83e3-78fbfff513bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse042971cc9db65cfa46481" ] +} \ 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..0ea22211167d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0978410cff102369e34ab?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" : "cb9c5b9a-0861-4e2d-a8cf-029a35e6c2c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE001338B3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c8cc-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "cb9c5b9a-0861-4e2d-a8cf-029a35e6c2c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "07072f3f-6591-45da-8e3a-1e1ce1590aaa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c941-401e-003a-4ae6-6473d5000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0978410cff102369e34abFri, 06 Sep 2019 19:11:20 GMT\"0x8D732FE001338B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "07072f3f-6591-45da-8e3a-1e1ce1590aaa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0978410cff102369e34ab?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" : "e280cda4-d541-40bf-a99c-a1f8db1e917a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c959-401e-003a-5de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "e280cda4-d541-40bf-a99c-a1f8db1e917a" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0978410cff102369e34ab" ] +} \ 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..f35f97bff41e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia05401891aed9d681b34d?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" : "0ebb855f-5cf9-467f-9489-19ff96cf3d61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE006452A9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c9c7-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "0ebb855f-5cf9-467f-9489-19ff96cf3d61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d4fdd06b-fb98-4e51-a182-5b84ea63945c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c9e0-401e-003a-53e6-6473d5000000", + "Body" : "jtcblobsaspermissionsparseiajtcblobsaspermissionsparseia05401891aed9d681b34dFri, 06 Sep 2019 19:11:20 GMT\"0x8D732FE006452A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "d4fdd06b-fb98-4e51-a182-5b84ea63945c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia05401891aed9d681b34d?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" : "6246cb94-63af-4c64-a476-1b4b5d2211a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c9e9-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "6246cb94-63af-4c64-a476-1b4b5d2211a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparseia05401891aed9d681b34d" ] +} \ 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..3bd584e82058 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring051192ac657f753f3146?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" : "41d88c66-d91c-4463-984c-efb3b6148b19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFEF96D58\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c56d-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "41d88c66-d91c-4463-984c-efb3b6148b19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "893e8009-268c-4eed-89a3-ce30ccbff7a3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c581-401e-003a-09e6-6473d5000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring051192ac657f753f3146Fri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFEF96D58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "893e8009-268c-4eed-89a3-ce30ccbff7a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring051192ac657f753f3146?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" : "f0affeb3-e862-43a4-9965-d1cfb5ecfe2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c58e-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "f0affeb3-e862-43a4-9965-d1cfb5ecfe2b" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring051192ac657f753f3146" ] +} \ 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..00c17c87294b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring03943285ad7a69aaa44e?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" : "59852d8e-c02c-4a33-bbf9-ddf7a0b980d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF0AD6B8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c59f-401e-003a-25e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "59852d8e-c02c-4a33-bbf9-ddf7a0b980d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "92747307-2b2f-4dd1-9dfa-9e295cd59009" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c5b0-401e-003a-32e6-6473d5000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring03943285ad7a69aaa44eFri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFF0AD6B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "92747307-2b2f-4dd1-9dfa-9e295cd59009", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring03943285ad7a69aaa44e?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" : "35014a76-f70b-4f46-8614-de555dba0e27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c5c5-401e-003a-45e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "35014a76-f70b-4f46-8614-de555dba0e27" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring03943285ad7a69aaa44e" ] +} \ 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..8817f6c47a28 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring082200d7b6ed67877a47?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" : "2abcbd82-607c-4c25-91c4-fac22c5572d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF1ED8D2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c5d4-401e-003a-53e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "2abcbd82-607c-4c25-91c4-fac22c5572d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "22309b73-17ac-40ee-bbf5-4a3545caa972" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c605-401e-003a-80e6-6473d5000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring082200d7b6ed67877a47Fri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFF1ED8D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "22309b73-17ac-40ee-bbf5-4a3545caa972", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring082200d7b6ed67877a47?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" : "74497727-5ecf-4cd5-ad13-4f505b286a84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c614-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "74497727-5ecf-4cd5-ad13-4f505b286a84" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring082200d7b6ed67877a47" ] +} \ 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..7d3f68dfd577 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring067687bd7b3a41d8c04e?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" : "ea119cb9-9f34-4c35-a238-78704ca69fbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF3D3DB7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c626-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "ea119cb9-9f34-4c35-a238-78704ca69fbf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a4dec246-ed21-41d6-baf9-017a7197c197" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c63d-401e-003a-32e6-6473d5000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring067687bd7b3a41d8c04eFri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFF3D3DB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "a4dec246-ed21-41d6-baf9-017a7197c197", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring067687bd7b3a41d8c04e?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" : "df42d12c-f601-464b-a382-4ac010701152" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c650-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "df42d12c-f601-464b-a382-4ac010701152" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring067687bd7b3a41d8c04e" ] +} \ 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..ec9d63dc5963 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring09429051648cd700204d?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" : "09d58a43-fbbe-4ee4-9959-93eb951f9e93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF507C4F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c662-401e-003a-53e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "09d58a43-fbbe-4ee4-9959-93eb951f9e93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "4654fcf8-bca0-48b4-b0ef-6f8c0c4796ed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c679-401e-003a-69e6-6473d5000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring09429051648cd700204dFri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFF507C4F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "4654fcf8-bca0-48b4-b0ef-6f8c0c4796ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring09429051648cd700204d?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" : "0f7c55e6-f884-4c17-93c9-b8f0e1fb51fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c684-401e-003a-74e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "0f7c55e6-f884-4c17-93c9-b8f0e1fb51fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring09429051648cd700204d" ] +} \ 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..0b98082eefaf --- /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://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0496083dce2621dfaa47?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" : "7ad103c3-acbe-4502-aa75-6794ebf58385" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFF617064\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c693-401e-003a-01e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "7ad103c3-acbe-4502-aa75-6794ebf58385" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3e12c2f8-4037-4b35-a065-cb3f994da26a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c6a5-401e-003a-0ce6-6473d5000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0496083dce2621dfaa47Fri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFF617064\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "3e12c2f8-4037-4b35-a065-cb3f994da26a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0496083dce2621dfaa47?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" : "c9bec701-9a9a-4c12-b519-4078f8d15e4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c6b5-401e-003a-19e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "c9bec701-9a9a-4c12-b519-4078f8d15e4b" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0496083dce2621dfaa47" ] +} \ 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..57235457f221 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobservicesasnetworktestblobsnapshot.json @@ -0,0 +1,241 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot0197224d1e4898?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" : "cb74cc68-a641-4dbb-b03c-6d7b3515d05f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFB4C6EDD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b8dc-401e-003a-26e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "cb74cc68-a641-4dbb-b03c-6d7b3515d05f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683?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" : "05a4e06a-a5b4-4e16-b4c4-507c88fa52cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFB530027\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b8fc-401e-003a-41e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "05a4e06a-a5b4-4e16-b4c4-507c88fa52cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683/javablobblobservicesasnetworktestblobsnapshot275288dd68d0", + "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" : "c4a11b4a-bd64-4252-b39d-22d1083451c4", + "Content-Type" : "application/octet-stream" + }, + "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 19:11:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D732FDFB643551\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76b94b-401e-003a-01e6-6473d5000000", + "x-ms-client-request-id" : "c4a11b4a-bd64-4252-b39d-22d1083451c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683/javablobblobservicesasnetworktestblobsnapshot275288dd68d0?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", + "x-ms-client-request-id" : "c086b0ac-2d26-4856-9903-7ce064f3d717" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:11:12.2408078Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFB643551\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b963-401e-003a-12e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "c086b0ac-2d26-4856-9903-7ce064f3d717" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683/javablobblobservicesasnetworktestblobsnapshot275288dd68d0?sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A12Z&se=2019-09-07T19%3A11%3A12Z&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", + "x-ms-client-request-id" : "0054df2e-69c1-44a5-8d76-180edfc084f9" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "447", + "StatusCode" : "403", + "x-ms-request-id" : "8f76b974-401e-003a-20e6-6473d5000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:8f76b974-401e-003a-20e6-6473d5000000\nTime:2019-09-06T19:11:12.2861888ZThe specified signed resource is not allowed for the this resource level", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683/javablobblobservicesasnetworktestblobsnapshot275288dd68d0?snapshot=2019-09-06T19%3a11%3a12.2408078Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A12Z&se=2019-09-07T19%3A11%3A12Z&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", + "x-ms-client-request-id" : "46a47ba4-bc81-4922-b7f8-2da386d3fe59" + }, + "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, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-09-06T19:11:12.2408078Z", + "Cache-Control" : "cache", + "ETag" : "\"0x8D732FDFB643551\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "8f76b981-401e-003a-2de6-6473d5000000", + "Body" : "default", + "x-ms-client-request-id" : "46a47ba4-bc81-4922-b7f8-2da386d3fe59", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683/javablobblobservicesasnetworktestblobsnapshot275288dd68d0?snapshot=2019-09-06T19%3a11%3a12.2408078Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A12Z&se=2019-09-07T19%3A11%3A12Z&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", + "x-ms-client-request-id" : "ae2f625e-ee05-4ee7-965b-72f1b7a6a15a" + }, + "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, 06 Sep 2019 19:11:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:11:12 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-06T19:11:12.2408078Z", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D732FDFB643551\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:11:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "8f76b997-401e-003a-3ce6-6473d5000000", + "x-ms-client-request-id" : "ae2f625e-ee05-4ee7-965b-72f1b7a6a15a", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobservicesasnetworktestblobsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "a5ab7d5c-a1a0-495b-b3b0-e36246c8f781" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b9b0-401e-003a-51e6-6473d5000000", + "Body" : "jtcblobservicesasnetworktestblobsnapshotjtcblobservicesasnetworktestblobsnapshot0197224d1e4898Fri, 06 Sep 2019 19:11:12 GMT\"0x8D732FDFB4C6EDD\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcblobservicesasnetworktestblobsnapshot161753d8ded683Fri, 06 Sep 2019 19:11:12 GMT\"0x8D732FDFB530027\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "a5ab7d5c-a1a0-495b-b3b0-e36246c8f781", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot0197224d1e4898?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" : "930090c7-7ae6-41c3-84ad-46783f701b2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b9bb-401e-003a-5be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "930090c7-7ae6-41c3-84ad-46783f701b2b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot161753d8ded683?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" : "a31c7eb5-9450-417c-bec4-3e2eb3c61a46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b9d3-401e-003a-6fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:12 GMT", + "x-ms-client-request-id" : "a31c7eb5-9450-417c-bec4-3e2eb3c61a46" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobservicesasnetworktestblobsnapshot0197224d1e4898", "jtcblobservicesasnetworktestblobsnapshot161753d8ded683", "javablobblobservicesasnetworktestblobsnapshot275288dd68d0", "2019-09-06T19:11:12.270Z", "2019-09-06T19:11:12.270Z" ] +} \ 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..43803594a082 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0sastestbloburlpartsb9663101d2099ed781?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" : "be786033-0b45-41f6-bc0a-ea7e092d2b0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE070EAACA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e001-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "be786033-0b45-41f6-bc0a-ea7e092d2b0c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dab74c16-29ed-4d93-a517-639c7f3631da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e00a-401e-003a-16e6-6473d5000000", + "Body" : "jtcbloburlpartsjtcbloburlparts0sastestbloburlpartsb9663101d2099ed781Fri, 06 Sep 2019 19:11:31 GMT\"0x8D732FE070EAACA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "dab74c16-29ed-4d93-a517-639c7f3631da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0sastestbloburlpartsb9663101d2099ed781?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" : "969e21d5-21aa-442a-889c-a7a8ba36fa61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e013-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "969e21d5-21aa-442a-889c-a7a8ba36fa61" + }, + "Exception" : null + } ], + "variables" : [ "jtcbloburlparts0sastestbloburlpartsb9663101d2099ed781" ] +} \ 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..bf8275dd3311 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse004386884f0553d3ea4?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" : "c5788284-c02d-40fe-9950-e6aeb909648f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0126C0C4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cc45-401e-003a-61e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "c5788284-c02d-40fe-9950-e6aeb909648f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c2d409cc-c46c-4a78-a6bb-b6ba3853021f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cc58-401e-003a-71e6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse004386884f0553d3ea4Fri, 06 Sep 2019 19:11:21 GMT\"0x8D732FE0126C0C4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "c2d409cc-c46c-4a78-a6bb-b6ba3853021f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse004386884f0553d3ea4?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" : "63d32c23-b2e5-4d28-859d-7feb951636b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cc66-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "63d32c23-b2e5-4d28-859d-7feb951636b6" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse004386884f0553d3ea4" ] +} \ 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..13e488f9d272 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse032574c2c72f5591294?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" : "63bf4ea2-7971-4bcb-9a37-2cd3a09c2364" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE013A74AB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cc7e-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "63bf4ea2-7971-4bcb-9a37-2cd3a09c2364" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8b78f9b0-45ea-430c-9d5f-e17fa03725ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cca8-401e-003a-3ae6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse032574c2c72f5591294Fri, 06 Sep 2019 19:11:21 GMT\"0x8D732FE013A74AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "8b78f9b0-45ea-430c-9d5f-e17fa03725ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse032574c2c72f5591294?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" : "a0526b07-2336-4c99-88fb-7ea09e9ed2b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ccbd-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "a0526b07-2336-4c99-88fb-7ea09e9ed2b8" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse032574c2c72f5591294" ] +} \ 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..c04c13a7c193 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse003434df10668ddc3c4?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" : "6db2787e-acfd-4015-a296-6db38629bbec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE014AF371\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cce5-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "6db2787e-acfd-4015-a296-6db38629bbec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a808f213-9e73-46ec-bd6b-d24a7a9f7105" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cd02-401e-003a-09e6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse003434df10668ddc3c4Fri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE014AF371\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "a808f213-9e73-46ec-bd6b-d24a7a9f7105", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse003434df10668ddc3c4?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" : "06ed11b6-8e9e-49dd-812b-e9f2198351ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cd1c-401e-003a-1ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "06ed11b6-8e9e-49dd-812b-e9f2198351ba" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse003434df10668ddc3c4" ] +} \ 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..e1149f45f605 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse046579c9dcf22e0d2b4?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" : "9c612d98-bcc2-4fa4-81ea-f2929a053cad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE015FB912\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cd3f-401e-003a-37e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "9c612d98-bcc2-4fa4-81ea-f2929a053cad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "26f53df3-19ab-4d1b-aa46-0b8b91c691b0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cd56-401e-003a-4be6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse046579c9dcf22e0d2b4Fri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE015FB912\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "26f53df3-19ab-4d1b-aa46-0b8b91c691b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse046579c9dcf22e0d2b4?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" : "be4f19c5-5739-4362-9b1d-769ad3b2307e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cd5f-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "be4f19c5-5739-4362-9b1d-769ad3b2307e" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse046579c9dcf22e0d2b4" ] +} \ 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..ae0df7d5de6e --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse031937f18274f8f0964?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" : "35340bb3-23e8-4e17-a098-5b5f00ad140d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0171BED4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cd6f-401e-003a-63e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "35340bb3-23e8-4e17-a098-5b5f00ad140d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0dc4cd7c-f5ee-42a1-b2a9-0c481b826512" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cd84-401e-003a-75e6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse031937f18274f8f0964Fri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE0171BED4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "0dc4cd7c-f5ee-42a1-b2a9-0c481b826512", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse031937f18274f8f0964?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" : "3ba1028d-57d9-4b6d-a51a-0376af52bb24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cd8f-401e-003a-7fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "3ba1028d-57d9-4b6d-a51a-0376af52bb24" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse031937f18274f8f0964" ] +} \ 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..596805d08680 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse04314739e8b495bf1f4?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" : "9f8d2c2b-ae22-4996-8679-e191cc43d804" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE018264BF\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cd9f-401e-003a-0fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "9f8d2c2b-ae22-4996-8679-e191cc43d804" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "789cbdc0-372c-4704-8a80-c7264394c87d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cdb0-401e-003a-1be6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse04314739e8b495bf1f4Fri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE018264BF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "789cbdc0-372c-4704-8a80-c7264394c87d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse04314739e8b495bf1f4?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" : "9a8c26ff-08f1-4603-a611-bf3773a8a9fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cdc2-401e-003a-29e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "9a8c26ff-08f1-4603-a611-bf3773a8a9fa" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse04314739e8b495bf1f4" ] +} \ 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..3387d15926ff --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse040403fbdde3fec6da4?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" : "ab4c25ea-529e-4401-bf08-5f369ea6a36b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0193F536\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cdd2-401e-003a-37e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "ab4c25ea-529e-4401-bf08-5f369ea6a36b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e6f9ffeb-e40c-4fe4-b313-fb137216cc8c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cde6-401e-003a-46e6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse040403fbdde3fec6da4Fri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE0193F536\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "e6f9ffeb-e40c-4fe4-b313-fb137216cc8c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse040403fbdde3fec6da4?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" : "31db72f0-e050-49d5-8465-bc4aa1c2f061" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cdf7-401e-003a-56e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "31db72f0-e050-49d5-8465-bc4aa1c2f061" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse040403fbdde3fec6da4" ] +} \ 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..518279dca6a6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse047518e70fffb7ee994?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" : "48c8d02f-a4d3-4f8e-89ef-baa734561ee2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE01A7A922\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ce13-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "48c8d02f-a4d3-4f8e-89ef-baa734561ee2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0a48d55b-4376-41f6-ad76-b752333399ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ce2d-401e-003a-79e6-6473d5000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse047518e70fffb7ee994Fri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE01A7A922\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "0a48d55b-4376-41f6-ad76-b752333399ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse047518e70fffb7ee994?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" : "43a28ae9-486a-4193-92f2-f192fe0f828b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ce3d-401e-003a-03e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "43a28ae9-486a-4193-92f2-f192fe0f828b" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse047518e70fffb7ee994" ] +} \ 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..4cb1b7b9514b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia030178591adf2c0dce?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" : "138dc1a8-573c-4a2e-8258-f811650edf24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE01B9AEE3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ce55-401e-003a-15e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "138dc1a8-573c-4a2e-8258-f811650edf24" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1d94202f-c25f-4fe1-ad37-bc3a02b65091" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ce64-401e-003a-21e6-6473d5000000", + "Body" : "jtccontainersaspermissionsparseiajtccontainersaspermissionsparseia030178591adf2c0dceFri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE01B9AEE3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "1d94202f-c25f-4fe1-ad37-bc3a02b65091", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia030178591adf2c0dce?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" : "b3504c37-f969-4339-be4f-8587ca7d77c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ce6c-401e-003a-27e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "b3504c37-f969-4339-be4f-8587ca7d77c6" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparseia030178591adf2c0dce" ] +} \ 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..45c6143cd205 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring079913f43efe05440?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" : "6afa164a-df79-44cc-b705-ba601a0e76fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0081096C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ca06-401e-003a-75e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "6afa164a-df79-44cc-b705-ba601a0e76fc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a4d567d8-f8a8-441d-bc6f-b9c84322ec26" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ca23-401e-003a-09e6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring079913f43efe05440Fri, 06 Sep 2019 19:11:20 GMT\"0x8D732FE0081096C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "a4d567d8-f8a8-441d-bc6f-b9c84322ec26", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring079913f43efe05440?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" : "f8e7a5e7-65ac-499f-b0da-47ede0b057fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ca2d-401e-003a-12e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "f8e7a5e7-65ac-499f-b0da-47ede0b057fd" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring079913f43efe05440" ] +} \ 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..3e359e2d7cc3 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0040527d112c1f835?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" : "3d1025a8-7d0b-4eca-8df1-dcdad656b197" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE00924BAE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ca45-401e-003a-27e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "3d1025a8-7d0b-4eca-8df1-dcdad656b197" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b3ade094-0672-479d-93b7-8ea25054cf93" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ca5f-401e-003a-3ae6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0040527d112c1f835Fri, 06 Sep 2019 19:11:20 GMT\"0x8D732FE00924BAE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "b3ade094-0672-479d-93b7-8ea25054cf93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0040527d112c1f835?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" : "024a118b-7976-42d6-b3b5-18986c81adab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ca6f-401e-003a-48e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:20 GMT", + "x-ms-client-request-id" : "024a118b-7976-42d6-b3b5-18986c81adab" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0040527d112c1f835" ] +} \ 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..42b3a9bb0caf --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring034615c7ee9f4b49e?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" : "86fe1799-9b61-49f4-bf95-7e5b30a9c7b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE00A33FC2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ca78-401e-003a-51e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "86fe1799-9b61-49f4-bf95-7e5b30a9c7b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3d4194e1-3a43-4792-9712-f10962a7f05b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cab2-401e-003a-04e6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring034615c7ee9f4b49eFri, 06 Sep 2019 19:11:20 GMT\"0x8D732FE00A33FC2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "3d4194e1-3a43-4792-9712-f10962a7f05b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring034615c7ee9f4b49e?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" : "e04b0f3f-cea2-499a-9727-5b14c139d638" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cabd-401e-003a-0fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "e04b0f3f-cea2-499a-9727-5b14c139d638" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring034615c7ee9f4b49e" ] +} \ 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..2f8fdf4db8a2 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring086996ac0f97713d4?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" : "d5dab165-f85e-46b0-b0e7-08f519274811" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE00BF32F9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cad3-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "d5dab165-f85e-46b0-b0e7-08f519274811" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ee4a9765-e644-4284-bc0b-a1fe8df08024" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76caef-401e-003a-37e6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring086996ac0f97713d4Fri, 06 Sep 2019 19:11:21 GMT\"0x8D732FE00BF32F9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "ee4a9765-e644-4284-bc0b-a1fe8df08024", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring086996ac0f97713d4?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" : "3a73f128-bc9f-40b9-b99c-446cddae6ebf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cb00-401e-003a-46e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "3a73f128-bc9f-40b9-b99c-446cddae6ebf" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring086996ac0f97713d4" ] +} \ 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..b0d901b772b6 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring087594aa78c210498?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" : "e4ec50f2-3341-44c8-8bac-6b46f80e0364" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE00D5CDCD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cb1e-401e-003a-60e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "e4ec50f2-3341-44c8-8bac-6b46f80e0364" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "08c2343d-d233-42ad-8686-52e800d0a83d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cb5a-401e-003a-15e6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring087594aa78c210498Fri, 06 Sep 2019 19:11:21 GMT\"0x8D732FE00D5CDCD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "08c2343d-d233-42ad-8686-52e800d0a83d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring087594aa78c210498?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" : "8edbe536-96b8-4f62-895b-f198815fb768" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cb69-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "8edbe536-96b8-4f62-895b-f198815fb768" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring087594aa78c210498" ] +} \ 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..46c99a08b836 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0813284e402b307ef?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" : "19f783b8-d7e8-4240-ad0e-688f06c861e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE00EE16AA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cb8c-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "19f783b8-d7e8-4240-ad0e-688f06c861e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f005daa6-baf3-4e6e-91b5-8d4627a81d9f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cb96-401e-003a-48e6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0813284e402b307efFri, 06 Sep 2019 19:11:21 GMT\"0x8D732FE00EE16AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "f005daa6-baf3-4e6e-91b5-8d4627a81d9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0813284e402b307ef?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" : "27419f31-e6be-4b96-a14d-0d0557ab5400" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cbab-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "27419f31-e6be-4b96-a14d-0d0557ab5400" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0813284e402b307ef" ] +} \ 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..2c6e38b46b34 --- /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://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring059773cde9a28888c?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" : "918550fe-d594-4ab4-9f36-a3f951fd35e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE01146CC2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cc08-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "918550fe-d594-4ab4-9f36-a3f951fd35e4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c82b9283-9c33-467a-9ee1-b8bef866b4c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cc18-401e-003a-38e6-6473d5000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring059773cde9a28888cFri, 06 Sep 2019 19:11:21 GMT\"0x8D732FE01146CC2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "c82b9283-9c33-467a-9ee1-b8bef866b4c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring059773cde9a28888c?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" : "8fa1ff91-9058-42cb-9a4e-4cf8e760afd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cc31-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:21 GMT", + "x-ms-client-request-id" : "8fa1ff91-9058-42cb-9a4e-4cf8e760afd7" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring059773cde9a28888c" ] +} \ 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..42c728edc57f --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparseadd611727db64890d1?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" : "2c45dee2-2a99-4a8f-badd-6e577442471b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE020633FC\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cf59-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "2c45dee2-2a99-4a8f-badd-6e577442471b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1a6c67fe-1974-4298-b45a-4450cfcf7d38" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cf70-401e-003a-65e6-6473d5000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparseadd611727db64890d1Fri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE020633FC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "1a6c67fe-1974-4298-b45a-4450cfcf7d38", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparseadd611727db64890d1?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" : "f453ce47-b879-497c-96e7-9fb049e20e4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cf80-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "f453ce47-b879-497c-96e7-9fb049e20e4a" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparseadd611727db64890d1" ] +} \ 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..22a84db689d1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparsefb11762955bb95c34e?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" : "9581517a-e85f-40ed-8189-bb5e48a58108" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE021A0EF0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cf98-401e-003a-03e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "9581517a-e85f-40ed-8189-bb5e48a58108" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "05c3104d-8e91-49f5-9bda-de8eb29e4de8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cfc9-401e-003a-29e6-6473d5000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparsefb11762955bb95c34eFri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE021A0EF0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "05c3104d-8e91-49f5-9bda-de8eb29e4de8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparsefb11762955bb95c34e?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" : "5eb000aa-36bc-42da-8f40-b6779de6ffa6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cfda-401e-003a-37e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "5eb000aa-36bc-42da-8f40-b6779de6ffa6" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparsefb11762955bb95c34e" ] +} \ 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..6f6c7fe25500 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparse232251894533ae21d5?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" : "56c7dbca-0231-4aaa-aef5-de7aa371e8dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE02358CFB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cff3-401e-003a-4de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "56c7dbca-0231-4aaa-aef5-de7aa371e8dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5d0eb052-599e-4f3a-b6e9-282ddfd6456e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cffd-401e-003a-56e6-6473d5000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparse232251894533ae21d5Fri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE02358CFB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "5d0eb052-599e-4f3a-b6e9-282ddfd6456e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparse232251894533ae21d5?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" : "8b015f41-a256-4671-84b7-80256df1c86b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d00e-401e-003a-65e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "8b015f41-a256-4671-84b7-80256df1c86b" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparse232251894533ae21d5" ] +} \ 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..49f62b85d94e --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostringbd5353564ff852a?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" : "8c34904f-a3a2-407d-bf8d-68a3fcc0a671" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE01CD3BAE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ce8e-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "8c34904f-a3a2-407d-bf8d-68a3fcc0a671" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "261c135b-71c8-4510-b677-25baf4a9718a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76ce9e-401e-003a-4ee6-6473d5000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostringbd5353564ff852aFri, 06 Sep 2019 19:11:22 GMT\"0x8D732FE01CD3BAE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:22 GMT", + "x-ms-client-request-id" : "261c135b-71c8-4510-b677-25baf4a9718a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostringbd5353564ff852a?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" : "01bfa9a7-b5dc-412a-a055-968b0bf78c0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76ceaf-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "01bfa9a7-b5dc-412a-a055-968b0bf78c0c" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostringbd5353564ff852a" ] +} \ 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..6e85b1fa584f --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostringa0444534f88ee4f?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" : "770624f6-c150-489a-a71c-ba4c56b62c17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE01E00520\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76ced2-401e-003a-71e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "770624f6-c150-489a-a71c-ba4c56b62c17" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "70767489-9221-41fd-a7e3-df79beba0c29" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cef3-401e-003a-08e6-6473d5000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostringa0444534f88ee4fFri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE01E00520\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "70767489-9221-41fd-a7e3-df79beba0c29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostringa0444534f88ee4f?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" : "18d11e0c-db98-4966-84da-373fc17d8c46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cf07-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "18d11e0c-db98-4966-84da-373fc17d8c46" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostringa0444534f88ee4f" ] +} \ 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..3b7ac00e6151 --- /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://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostring7822089025a7cad?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" : "08633214-33ab-4401-8595-1772e7a56591" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE01F34393\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76cf25-401e-003a-2ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "08633214-33ab-4401-8595-1772e7a56591" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "59b3d152-4d68-44ef-95f3-61fcd66c92b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76cf39-401e-003a-3ce6-6473d5000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostring7822089025a7cadFri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE01F34393\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "59b3d152-4d68-44ef-95f3-61fcd66c92b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostring7822089025a7cad?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" : "5f02e709-89fe-4b32-a9a5-85597c9a55b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76cf43-401e-003a-43e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "5f02e709-89fe-4b32-a9a5-85597c9a55b5" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostring7822089025a7cad" ] +} \ 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..7b7f26e901fe --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparsefd6230128289e4?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" : "c5c0f41a-2080-49bb-9a8b-a5bb01ccc6df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE024919BD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d021-401e-003a-76e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "c5c0f41a-2080-49bb-9a8b-a5bb01ccc6df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cb0f7e2e-5bbe-42d2-b4f3-acb62da3ad05" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d037-401e-003a-0ae6-6473d5000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0sastestsasprotocolparsefd6230128289e4Fri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE024919BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "cb0f7e2e-5bbe-42d2-b4f3-acb62da3ad05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparsefd6230128289e4?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" : "a64bd1e0-7c5d-437d-8f57-4785e1521068" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d04e-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "a64bd1e0-7c5d-437d-8f57-4785e1521068" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0sastestsasprotocolparsefd6230128289e4" ] +} \ 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..bcd821a51f5c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse537106156cad96?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" : "a5d34f5a-4446-43f6-8aa4-a1ce90103493" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0264226F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d063-401e-003a-2be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "a5d34f5a-4446-43f6-8aa4-a1ce90103493" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a8bdcbeb-9f5b-40b2-b6bc-874dfc1dad08" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d08b-401e-003a-48e6-6473d5000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0sastestsasprotocolparse537106156cad96Fri, 06 Sep 2019 19:11:23 GMT\"0x8D732FE0264226F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "a8bdcbeb-9f5b-40b2-b6bc-874dfc1dad08", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse537106156cad96?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" : "f4a33b40-538e-408d-bf42-0d5dd96e48f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d09a-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:23 GMT", + "x-ms-client-request-id" : "f4a33b40-538e-408d-bf42-0d5dd96e48f6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0sastestsasprotocolparse537106156cad96" ] +} \ 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..d5c09a0d4503 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign05665887c5963cbc4?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" : "58c5679f-a687-4287-9f0a-3be629313bbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC281080\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bbc1-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "58c5679f-a687-4287-9f0a-3be629313bbe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a22d6778-c209-4d6d-b3fb-42344150554e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bbdb-401e-003a-31e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign05665887c5963cbc4Fri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC281080\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "a22d6778-c209-4d6d-b3fb-42344150554e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign05665887c5963cbc4?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" : "18c43583-fc07-45fb-9dfe-585fa47e114b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bbe7-401e-003a-3de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "18c43583-fc07-45fb-9dfe-585fa47e114b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign05665887c5963cbc4" ] +} \ 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..e5b57e2db0a0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign07728961256d4a43b?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" : "d327acdb-be9d-40d2-9f6e-59573d1cb980" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC3B4F0C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bbf9-401e-003a-4ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "d327acdb-be9d-40d2-9f6e-59573d1cb980" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "31910d4f-8aa4-4257-af4a-6d6eb23d4a1c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bc08-401e-003a-58e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign07728961256d4a43bFri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC3B4F0C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "31910d4f-8aa4-4257-af4a-6d6eb23d4a1c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign07728961256d4a43b?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" : "c0383d14-cf94-4ad2-b341-9fa9c0bba3dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bc14-401e-003a-64e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "c0383d14-cf94-4ad2-b341-9fa9c0bba3dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign07728961256d4a43b" ] +} \ 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..50a7f00990a8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0982978d808b9e279?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" : "5c0b561b-b7ab-48dc-8988-79366ccb8e67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC51E9D2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bc2d-401e-003a-79e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "5c0b561b-b7ab-48dc-8988-79366ccb8e67" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ac4f8f79-8a3e-472f-873f-46f8d50d0d79" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bc3d-401e-003a-04e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0982978d808b9e279Fri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC51E9D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "ac4f8f79-8a3e-472f-873f-46f8d50d0d79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0982978d808b9e279?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" : "b11a7fd1-86d9-4d0c-9465-27b9b5a4c9d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bc49-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "b11a7fd1-86d9-4d0c-9465-27b9b5a4c9d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0982978d808b9e279" ] +} \ 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..973263efe927 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0803434cbe8a98eea?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" : "283e47c0-db14-4c71-852f-2a2b57d93761" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC635339\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bc64-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "283e47c0-db14-4c71-852f-2a2b57d93761" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3acafc4c-47e4-45bd-a3a3-16f111189ce9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bc71-401e-003a-30e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0803434cbe8a98eeaFri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC635339\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "3acafc4c-47e4-45bd-a3a3-16f111189ce9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0803434cbe8a98eea?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" : "0ab2c957-f01a-4e8f-a512-4b900717030e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bc7d-401e-003a-3be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "0ab2c957-f01a-4e8f-a512-4b900717030e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0803434cbe8a98eea" ] +} \ 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..a6572652e569 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0889380455e9fc815?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" : "448963cc-55c2-4346-8add-1a15a3518a4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC7531D3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bc9b-401e-003a-55e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:13 GMT", + "x-ms-client-request-id" : "448963cc-55c2-4346-8add-1a15a3518a4d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d6722f16-28c8-4a2d-ac69-d54af999f6a5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bcb5-401e-003a-6ce6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0889380455e9fc815Fri, 06 Sep 2019 19:11:13 GMT\"0x8D732FDFC7531D3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "d6722f16-28c8-4a2d-ac69-d54af999f6a5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0889380455e9fc815?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" : "90b63e6c-2b65-4cdb-9b3a-71052184f364" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bcc4-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "90b63e6c-2b65-4cdb-9b3a-71052184f364" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0889380455e9fc815" ] +} \ 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..953c396e1eff --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign03417742dbc2b6ac7?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" : "ef9ff860-1750-455a-88ef-9e5ebdb94864" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC86C251\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bce9-401e-003a-1de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "ef9ff860-1750-455a-88ef-9e5ebdb94864" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2bebf33-9971-4fd3-9dbb-124247f9843a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bcf7-401e-003a-27e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign03417742dbc2b6ac7Fri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFC86C251\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "d2bebf33-9971-4fd3-9dbb-124247f9843a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign03417742dbc2b6ac7?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" : "32693ae1-9326-470d-8623-f058f42ccc7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bd07-401e-003a-34e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "32693ae1-9326-470d-8623-f058f42ccc7c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign03417742dbc2b6ac7" ] +} \ 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..cfcff1bcd089 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0629422b47d4476e7?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" : "4cc63e8c-e093-47ab-91d7-d495875567f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFC97DD82\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bd1f-401e-003a-4ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "4cc63e8c-e093-47ab-91d7-d495875567f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b81c6e4e-4251-4233-83b2-bcaa98ce2a70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bd2c-401e-003a-56e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0629422b47d4476e7Fri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFC97DD82\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "b81c6e4e-4251-4233-83b2-bcaa98ce2a70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0629422b47d4476e7?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" : "32a4f930-1d65-442d-bdc6-ce2f695f8530" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bd4d-401e-003a-70e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "32a4f930-1d65-442d-bdc6-ce2f695f8530" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0629422b47d4476e7" ] +} \ 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..d4f7f863d851 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign036271788cade751c?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" : "ade39441-70b1-4c22-be4d-314f4a9b9e74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFCB46D30\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bd5e-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "ade39441-70b1-4c22-be4d-314f4a9b9e74" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "98330ec6-3040-4b67-8748-d91e157b2b3c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bd6b-401e-003a-08e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign036271788cade751cFri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFCB46D30\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "98330ec6-3040-4b67-8748-d91e157b2b3c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign036271788cade751c?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" : "34a76251-decd-4baf-a367-c77984781912" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bd79-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "34a76251-decd-4baf-a367-c77984781912" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign036271788cade751c" ] +} \ 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..4525ec6b5d7d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0238875b552290b3b?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" : "f590f26a-2f9b-4899-a44d-9c1bc0e5d65e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFCC5131C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bd8b-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "f590f26a-2f9b-4899-a44d-9c1bc0e5d65e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "6df4e599-aa00-4f8c-8963-917983078d8e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bda6-401e-003a-37e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0238875b552290b3bFri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFCC5131C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "6df4e599-aa00-4f8c-8963-917983078d8e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0238875b552290b3b?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" : "9d346a76-9c58-47a9-90f4-275658f44099" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bdb5-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "9d346a76-9c58-47a9-90f4-275658f44099" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0238875b552290b3b" ] +} \ 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..ac7b24c0d28a --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0553135830e25a19a?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" : "41fc077e-4a09-4c44-84b0-f027d35c117b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFCD67C72\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bdca-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "41fc077e-4a09-4c44-84b0-f027d35c117b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "51ce67d8-f247-4712-8b75-0ffb47940a0f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bddb-401e-003a-61e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0553135830e25a19aFri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFCD67C72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "51ce67d8-f247-4712-8b75-0ffb47940a0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0553135830e25a19a?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" : "fee48d5a-b5ea-495a-adfa-1dc4532a3719" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bdf0-401e-003a-75e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "fee48d5a-b5ea-495a-adfa-1dc4532a3719" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0553135830e25a19a" ] +} \ 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..35598d319be8 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05387431?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" : "85e07a9d-808c-4723-b738-33e57c109cd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFCEAF3DB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76be06-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "85e07a9d-808c-4723-b738-33e57c109cd9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "721f0cce-7b15-49ee-986f-e414cdde87e3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76be5c-401e-003a-52e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05387431Fri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFCEAF3DB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "721f0cce-7b15-49ee-986f-e414cdde87e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05387431?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" : "41fb6540-e2a9-4499-8f1a-3f09c7474984" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76be72-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "41fb6540-e2a9-4499-8f1a-3f09c7474984" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05387431" ] +} \ 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..81fc56f19ff0 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey040914bc?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" : "f99f5a07-b3c7-40d0-aa0a-9d978a963856" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFE038669\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c254-401e-003a-51e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "f99f5a07-b3c7-40d0-aa0a-9d978a963856" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "2462b490-9784-4d7c-999d-5e087b58f043" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c273-401e-003a-6ce6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey040914bcFri, 06 Sep 2019 19:11:16 GMT\"0x8D732FDFE038669\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "2462b490-9784-4d7c-999d-5e087b58f043", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey040914bc?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" : "c7e8bb15-d30a-45fd-9291-37118988ffad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c284-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "c7e8bb15-d30a-45fd-9291-37118988ffad" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey040914bc" ] +} \ 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..510921ab111c --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey040211b7?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" : "087d6723-e581-495e-9f3f-382f37fa7bd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFE17AF9A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c29a-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "087d6723-e581-495e-9f3f-382f37fa7bd3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aaa9ad0a-d2e0-4bda-963c-f8c13fa1782b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c2a3-401e-003a-15e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey040211b7Fri, 06 Sep 2019 19:11:16 GMT\"0x8D732FDFE17AF9A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "aaa9ad0a-d2e0-4bda-963c-f8c13fa1782b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey040211b7?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" : "2ed8575a-69e4-4942-8c16-886a13cc5595" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c2b3-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "2ed8575a-69e4-4942-8c16-886a13cc5595" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey040211b7" ] +} \ 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..6f53faa79d1b --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02246040?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" : "2af79815-6c15-4325-9177-fff37627763e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFE3AD0A9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c2f6-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "2af79815-6c15-4325-9177-fff37627763e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3f4b5ca3-a71a-40f9-9172-f153144571e1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c35a-401e-003a-35e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey02246040Fri, 06 Sep 2019 19:11:16 GMT\"0x8D732FDFE3AD0A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "3f4b5ca3-a71a-40f9-9172-f153144571e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02246040?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" : "ba378c58-64cd-4046-a08a-a57ba91878a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c36e-401e-003a-47e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "ba378c58-64cd-4046-a08a-a57ba91878a9" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey02246040" ] +} \ 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..9ddaed2ad59f --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey029533ed?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" : "f978d5e1-4e17-4b17-b9c9-42262d1bed20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFE71A575\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c3d0-401e-003a-21e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "f978d5e1-4e17-4b17-b9c9-42262d1bed20" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "147e771c-27ad-48ba-bdb9-5fc93e1c1f5b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c3e2-401e-003a-30e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey029533edFri, 06 Sep 2019 19:11:17 GMT\"0x8D732FDFE71A575\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "147e771c-27ad-48ba-bdb9-5fc93e1c1f5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey029533ed?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" : "9951d064-70f4-4181-ac93-201d7eb6867c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c3fa-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "9951d064-70f4-4181-ac93-201d7eb6867c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey029533ed" ] +} \ 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..7425f9ace052 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0984815a?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" : "104524be-089b-488c-bf57-58499bd5384a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFE8755B4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c412-401e-003a-58e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "104524be-089b-488c-bf57-58499bd5384a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bcd0f77e-8166-459f-9ea6-85acb2a15861" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c429-401e-003a-6ce6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0984815aFri, 06 Sep 2019 19:11:17 GMT\"0x8D732FDFE8755B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "bcd0f77e-8166-459f-9ea6-85acb2a15861", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0984815a?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" : "3279fab3-53e1-4d1a-89cc-cea50d732cdb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c433-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "3279fab3-53e1-4d1a-89cc-cea50d732cdb" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0984815a" ] +} \ 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..3f19bbfef309 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey084166a2?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" : "c0e598d1-f958-472d-a11a-1d54233d1a11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFD0ED850\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76be9e-401e-003a-0ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:14 GMT", + "x-ms-client-request-id" : "c0e598d1-f958-472d-a11a-1d54233d1a11" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a18e3125-e7ee-4142-871f-5f4e969e3c86" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bec8-401e-003a-35e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey084166a2Fri, 06 Sep 2019 19:11:14 GMT\"0x8D732FDFD0ED850\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "a18e3125-e7ee-4142-871f-5f4e969e3c86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey084166a2?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" : "4a9988c0-06d8-4ae3-b3d6-a7ecc7180cd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bedf-401e-003a-49e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "4a9988c0-06d8-4ae3-b3d6-a7ecc7180cd9" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey084166a2" ] +} \ 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..b854bef84fba --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09024553?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" : "5d910b6b-e8ce-41f6-ab9a-2d1b18285b88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFD285A0C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bf20-401e-003a-02e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "5d910b6b-e8ce-41f6-ab9a-2d1b18285b88" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "be09a8ac-aeb1-4437-ac62-e5d3e2103a3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bf3a-401e-003a-1be6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey09024553Fri, 06 Sep 2019 19:11:15 GMT\"0x8D732FDFD285A0C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "be09a8ac-aeb1-4437-ac62-e5d3e2103a3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09024553?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" : "dab8ff76-cea1-4c1f-9947-721bcf787e31" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bf4f-401e-003a-2de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "dab8ff76-cea1-4c1f-9947-721bcf787e31" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey09024553" ] +} \ 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..d928f66a1c93 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey07276114?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" : "64b2bd1c-0a77-4e5a-a914-a563050c539d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFD3C0DEA\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bf6b-401e-003a-42e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "64b2bd1c-0a77-4e5a-a914-a563050c539d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "fd6d08ca-4a45-4128-b770-1af4d8cdfebc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bf87-401e-003a-5ae6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey07276114Fri, 06 Sep 2019 19:11:15 GMT\"0x8D732FDFD3C0DEA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "fd6d08ca-4a45-4128-b770-1af4d8cdfebc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey07276114?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" : "d3f469d1-2f0b-4861-873b-ef7086f3ed16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bf9c-401e-003a-6ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "d3f469d1-2f0b-4861-873b-ef7086f3ed16" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey07276114" ] +} \ 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..6692c4b57952 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey004857bb?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" : "d7569109-98cb-473e-a6ad-2f95fbaa21dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFD50AC6A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76bfcf-401e-003a-19e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "d7569109-98cb-473e-a6ad-2f95fbaa21dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c963e828-dd37-4a55-bc62-e388297ae5d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76bfe7-401e-003a-30e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey004857bbFri, 06 Sep 2019 19:11:15 GMT\"0x8D732FDFD50AC6A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "c963e828-dd37-4a55-bc62-e388297ae5d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey004857bb?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" : "a852282e-0d6f-4327-a15e-5866b031240c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76bffe-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "a852282e-0d6f-4327-a15e-5866b031240c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey004857bb" ] +} \ 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..5e016666eecc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0720709f?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" : "a3ffd4f1-8515-40e2-b753-8f26b318e5fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFD641219\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c017-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "a3ffd4f1-8515-40e2-b753-8f26b318e5fc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3f57cd79-feb4-4f2d-8963-dc0b42de9a6c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c0a7-401e-003a-58e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0720709fFri, 06 Sep 2019 19:11:15 GMT\"0x8D732FDFD641219\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "3f57cd79-feb4-4f2d-8963-dc0b42de9a6c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0720709f?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" : "4366e9a7-6ceb-42f0-95e8-ce1c59490a40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c0b3-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "4366e9a7-6ceb-42f0-95e8-ce1c59490a40" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0720709f" ] +} \ 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..a3e0761b6625 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04159735?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" : "f2f16895-c71a-4bd4-8fce-d62388f839ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFDA830B4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c106-401e-003a-28e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:15 GMT", + "x-ms-client-request-id" : "f2f16895-c71a-4bd4-8fce-d62388f839ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "21686a64-1898-4dbf-83ba-2b84fa75a9c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c116-401e-003a-36e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey04159735Fri, 06 Sep 2019 19:11:15 GMT\"0x8D732FDFDA830B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "21686a64-1898-4dbf-83ba-2b84fa75a9c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04159735?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" : "7741bcf2-da5a-414e-8335-21d1a3eadfc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c12f-401e-003a-4ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "7741bcf2-da5a-414e-8335-21d1a3eadfc1" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey04159735" ] +} \ 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..ce6c24e47d9e --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey021900f6?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" : "df5b4c0c-6caa-4a36-9ff0-e05299e16b94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFDBA0F5A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c149-401e-003a-63e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "df5b4c0c-6caa-4a36-9ff0-e05299e16b94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bd138817-e3b3-4a9b-9209-b2600e5d9e87" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c15b-401e-003a-72e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey021900f6Fri, 06 Sep 2019 19:11:16 GMT\"0x8D732FDFDBA0F5A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "bd138817-e3b3-4a9b-9209-b2600e5d9e87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey021900f6?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" : "9c515aeb-fb24-4d4c-9274-d60f5facacf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c169-401e-003a-80e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "9c515aeb-fb24-4d4c-9274-d60f5facacf3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey021900f6" ] +} \ 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..0d45b5110a43 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey072465d8?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" : "1ee43109-e37a-4ab2-b931-18e529ca136a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFDCC3C41\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c17f-401e-003a-13e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "1ee43109-e37a-4ab2-b931-18e529ca136a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "69dbd071-7577-4954-96ee-97fcc670838e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c199-401e-003a-28e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey072465d8Fri, 06 Sep 2019 19:11:16 GMT\"0x8D732FDFDCC3C41\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "69dbd071-7577-4954-96ee-97fcc670838e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey072465d8?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" : "68c24489-8d8d-4db1-bdec-a1bd9644cf68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c1ab-401e-003a-38e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "68c24489-8d8d-4db1-bdec-a1bd9644cf68" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey072465d8" ] +} \ 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..83e54f0df091 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02566200?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" : "3e087ae2-9809-4cea-a156-bed542563960" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFDE5218D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c1ce-401e-003a-57e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "3e087ae2-9809-4cea-a156-bed542563960" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "779028f0-d5ce-434f-b0d8-da36a7a4c4a7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c227-401e-003a-27e6-6473d5000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey02566200Fri, 06 Sep 2019 19:11:16 GMT\"0x8D732FDFDE5218D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "779028f0-d5ce-434f-b0d8-da36a7a4c4a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02566200?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" : "c2cf7f99-4f50-4fd5-aa2d-97d03be89ca4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c23d-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:16 GMT", + "x-ms-client-request-id" : "c2cf7f99-4f50-4fd5-aa2d-97d03be89ca4" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey02566200" ] +} \ 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..52be897c9776 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok012863d834be?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" : "fa74f798-c94b-4f9c-8ed1-f5ed14598d1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE027A6F02\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d0ae-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "fa74f798-c94b-4f9c-8ed1-f5ed14598d1b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b2832084-5555-4239-8b2c-1449bec73853" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d109-401e-003a-27e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok012863d834beFri, 06 Sep 2019 19:11:24 GMT\"0x8D732FE027A6F02\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "b2832084-5555-4239-8b2c-1449bec73853", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok012863d834be?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" : "95a1a326-e0b7-47ab-88ae-4cbd2ef7e571" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d11d-401e-003a-35e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "95a1a326-e0b7-47ab-88ae-4cbd2ef7e571" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok012863d834be" ] +} \ 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..bdafbce8872d --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok015552938d3b?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" : "64a80cf1-238b-493d-949b-a909b8c8944d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE02921B82\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d13a-401e-003a-47e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "64a80cf1-238b-493d-949b-a909b8c8944d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "83574174-64e6-4d75-87ab-24c7fa63397b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d14c-401e-003a-55e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok015552938d3bFri, 06 Sep 2019 19:11:24 GMT\"0x8D732FE02921B82\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "83574174-64e6-4d75-87ab-24c7fa63397b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok015552938d3b?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" : "43f36aed-79a0-4fae-9944-1bd6333db1fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d15e-401e-003a-62e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "43f36aed-79a0-4fae-9944-1bd6333db1fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok015552938d3b" ] +} \ 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..627dce1796d4 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0006853acd4c?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" : "8801323f-e35c-40ee-bc7e-4c57d41d9d66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE02A336AE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d172-401e-003a-74e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "8801323f-e35c-40ee-bc7e-4c57d41d9d66" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "1b18cbc8-e65a-4da2-b3bf-8a8795ee960f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d18d-401e-003a-09e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok0006853acd4cFri, 06 Sep 2019 19:11:24 GMT\"0x8D732FE02A336AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "1b18cbc8-e65a-4da2-b3bf-8a8795ee960f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0006853acd4c?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" : "291d8c92-85d3-4789-8e3f-8b38cd4eb485" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d19c-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "291d8c92-85d3-4789-8e3f-8b38cd4eb485" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok0006853acd4c" ] +} \ 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..1ab0a515eefa --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok020918bd5100?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" : "e0436caf-d535-4471-853a-fa7a5181e682" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE02B5D8E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d1ad-401e-003a-24e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "e0436caf-d535-4471-853a-fa7a5181e682" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "aff7a8b0-123d-407b-9caa-6e5ba92f1e65" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d1c1-401e-003a-32e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok020918bd5100Fri, 06 Sep 2019 19:11:24 GMT\"0x8D732FE02B5D8E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "aff7a8b0-123d-407b-9caa-6e5ba92f1e65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok020918bd5100?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" : "c10d553c-3f94-4bc2-acaf-21359f24f8be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d1d0-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "c10d553c-3f94-4bc2-acaf-21359f24f8be" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok020918bd5100" ] +} \ 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..7f316ff53f41 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok045447107c60?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" : "47e6f1a0-b6cd-45b5-893a-06b734cef4d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE02D0E192\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d1e6-401e-003a-4fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "47e6f1a0-b6cd-45b5-893a-06b734cef4d8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e14a7c15-91f0-46b4-97d2-ee0ffe2a6f18" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d23e-401e-003a-19e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok045447107c60Fri, 06 Sep 2019 19:11:24 GMT\"0x8D732FE02D0E192\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "e14a7c15-91f0-46b4-97d2-ee0ffe2a6f18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok045447107c60?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" : "59440d13-4c6c-4af8-a3c4-9912d93a4ccf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d244-401e-003a-1fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "59440d13-4c6c-4af8-a3c4-9912d93a4ccf" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok045447107c60" ] +} \ 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..242403d3ebb1 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0134349f895a?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" : "09d300c6-2801-4ed6-8434-d0155b17bea6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE02F0CD77\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76d26f-401e-003a-3ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "09d300c6-2801-4ed6-8434-d0155b17bea6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5ab38f1c-5d77-4eea-af50-b02f7c9f457c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76d27d-401e-003a-48e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok0134349f895aFri, 06 Sep 2019 19:11:24 GMT\"0x8D732FE02F0CD77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "5ab38f1c-5d77-4eea-af50-b02f7c9f457c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0134349f895a?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" : "e2d85e62-cc37-4f83-9891-2f0b2b1f7017" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76d292-401e-003a-5ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:24 GMT", + "x-ms-client-request-id" : "e2d85e62-cc37-4f83-9891-2f0b2b1f7017" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok0134349f895a" ] +} \ 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..5aded9e0818e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource0833664a1c?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" : "98478640-3a6e-4da8-b4f2-f5e18084662e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFE9C425E\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c447-401e-003a-05e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "98478640-3a6e-4da8-b4f2-f5e18084662e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "cc067bd7-be33-4b53-9448-33bc4b57e7c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c461-401e-003a-18e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource0833664a1cFri, 06 Sep 2019 19:11:17 GMT\"0x8D732FDFE9C425E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "cc067bd7-be33-4b53-9448-33bc4b57e7c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource0833664a1c?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" : "f4a5444e-bf26-4dc4-bc40-29f276a9fc72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c46d-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "f4a5444e-bf26-4dc4-bc40-29f276a9fc72" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource0833664a1c", "javablobservicesassignaturevaluescanonicalizedresource1994004" ] +} \ 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..89fe08fb65dc --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia0475868fbf2ed8dd7c4?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" : "106dd32c-77e9-4080-bf01-78234fd473a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFEB9203F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c47c-401e-003a-31e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "106dd32c-77e9-4080-bf01-78234fd473a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "c207af10-eaaa-428b-8c6a-42daa0347a3b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c4d2-401e-003a-79e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia0475868fbf2ed8dd7c4Fri, 06 Sep 2019 19:11:17 GMT\"0x8D732FDFEB9203F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "c207af10-eaaa-428b-8c6a-42daa0347a3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia0475868fbf2ed8dd7c4?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" : "a46712a5-98a5-49a5-afcb-ed66ac6d4c1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c4e3-401e-003a-08e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:17 GMT", + "x-ms-client-request-id" : "a46712a5-98a5-49a5-afcb-ed66ac6d4c1f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia0475868fbf2ed8dd7c4" ] +} \ 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..38f5d20ad380 --- /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://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia02880976967e7f70f94?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" : "1c664c3b-a0ec-40b0-98cb-27d857598960" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFEE2F9A5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76c4fa-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "1c664c3b-a0ec-40b0-98cb-27d857598960" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f83aaea-c999-438b-bd8f-0533ab4387ab" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76c542-401e-003a-58e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia02880976967e7f70f94Fri, 06 Sep 2019 19:11:18 GMT\"0x8D732FDFEE2F9A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "8f83aaea-c999-438b-bd8f-0533ab4387ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia02880976967e7f70f94?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" : "94281db6-887d-49c9-9c2f-d640c9748f49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76c54f-401e-003a-63e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:18 GMT", + "x-ms-client-request-id" : "94281db6-887d-49c9-9c2f-d640c9748f49" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia02880976967e7f70f94" ] +} \ 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..666fade4d6e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0969550ec4d39?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" : "0ba33b62-905d-42ec-b84c-2d262ba753fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFAA38256\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b66e-401e-003a-09e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "x-ms-client-request-id" : "0ba33b62-905d-42ec-b84c-2d262ba753fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0969550ec4d39/javablobservicesassignaturevaluesnetworktestblob14285602ae", + "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" : "af1adb78-fa1a-4cb9-a3fc-7bba74471839", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:10 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D732FDFAA9E0DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76b689-401e-003a-1ee6-6473d5000000", + "x-ms-client-request-id" : "af1adb78-fa1a-4cb9-a3fc-7bba74471839" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0969550ec4d39/javablobservicesassignaturevaluesnetworktestblob14285602ae?sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A10Z&se=2019-09-07T19%3A11%3A10Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d5729315-e5a6-41d4-a733-1ce0d7bbeab4" + }, + "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" : "Fri, 06 Sep 2019 19:11:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "\"0x8D732FDFAA9E0DF\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:11:10 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "8f76b6a8-401e-003a-3be6-6473d5000000", + "Body" : "test", + "x-ms-client-request-id" : "d5729315-e5a6-41d4-a733-1ce0d7bbeab4", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0969550ec4d39/javablobservicesassignaturevaluesnetworktestblob14285602ae?sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A10Z&se=2019-09-07T19%3A11%3A10Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "19a0478f-e32e-40b2-b617-9764674b7997" + }, + "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" : "Fri, 06 Sep 2019 19:11:10 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" : "Fri, 06 Sep 2019 19:11:10 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "8f76b6d2-401e-003a-5fe6-6473d5000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "\"0x8D732FDFAA9E0DF\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "19a0478f-e32e-40b2-b617-9764674b7997", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "79f98d20-856e-46e3-927e-2837a5f84437" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b6e9-401e-003a-72e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobjtcservicesassignaturevaluesnetworktestblob0969550ec4d39Fri, 06 Sep 2019 19:11:10 GMT\"0x8D732FDFAA38256\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "79f98d20-856e-46e3-927e-2837a5f84437", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0969550ec4d39?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" : "3e4ca4e3-c592-4f10-9fad-3d59579d5423" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b709-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "3e4ca4e3-c592-4f10-9fad-3d59579d5423" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblob0969550ec4d39", "javablobservicesassignaturevaluesnetworktestblob14285602ae", "2019-09-06T19:11:10.996Z", "2019-09-06T19:11:10.996Z" ] +} \ 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..41f653c86428 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json @@ -0,0 +1,181 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f?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" : "41054725-4d7d-473b-99d4-ed2a842936a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFAD61068\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b720-401e-003a-22e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "41054725-4d7d-473b-99d4-ed2a842936a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f/javablobservicesassignaturevaluesnetworktestblobsnapshot180126", + "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" : "3857f40d-210b-4a35-b46f-ab8b4483084f", + "Content-Type" : "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" : "Fri, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D732FDFAE71F78\"", + "Content-Length" : "0", + "x-ms-request-id" : "8f76b77c-401e-003a-68e6-6473d5000000", + "x-ms-client-request-id" : "3857f40d-210b-4a35-b46f-ab8b4483084f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f/javablobservicesassignaturevaluesnetworktestblobsnapshot180126?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", + "x-ms-client-request-id" : "7dc38cf4-460b-44a5-acf3-a41b85edad76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-06T19:11:11.4350601Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFAE71F78\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b78b-401e-003a-77e6-6473d5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "7dc38cf4-460b-44a5-acf3-a41b85edad76" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f/javablobservicesassignaturevaluesnetworktestblobsnapshot180126?snapshot=2019-09-06T19%3a11%3a11.4350601Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A11Z&se=2019-09-07T19%3A11%3A11Z&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", + "x-ms-client-request-id" : "d8463cbc-904f-4d41-aa6a-67fe388b9e72" + }, + "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, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-09-06T19:11:11.4350601Z", + "Cache-Control" : "cache", + "ETag" : "\"0x8D732FDFAE71F78\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:11:11 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "8f76b79b-401e-003a-04e6-6473d5000000", + "Body" : "test", + "x-ms-client-request-id" : "d8463cbc-904f-4d41-aa6a-67fe388b9e72", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f/javablobservicesassignaturevaluesnetworktestblobsnapshot180126?snapshot=2019-09-06T19%3a11%3a11.4350601Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-05T19%3A11%3A11Z&se=2019-09-07T19%3A11%3A11Z&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", + "x-ms-client-request-id" : "73035557-61c0-4f93-a443-fcf1e2400069" + }, + "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, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 06 Sep 2019 19:11:11 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-06T19:11:11.4350601Z", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D732FDFAE71F78\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 06 Sep 2019 19:11:11 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "8f76b805-401e-003a-64e6-6473d5000000", + "x-ms-client-request-id" : "73035557-61c0-4f93-a443-fcf1e2400069", + "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", + "x-ms-client-request-id" : "e0683f26-0b23-458c-aac2-2673e6f7b973" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b814-401e-003a-72e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotjtcservicesassignaturevaluesnetworktestblobsnapshot05230651fFri, 06 Sep 2019 19:11:11 GMT\"0x8D732FDFAD61068\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "e0683f26-0b23-458c-aac2-2673e6f7b973", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f?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" : "e59f0bb6-c4bc-45e6-bbfa-1d8bfaba47a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b81e-401e-003a-7ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "e59f0bb6-c4bc-45e6-bbfa-1d8bfaba47a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot05230651f", "javablobservicesassignaturevaluesnetworktestblobsnapshot180126", "2019-09-06T19:11:11.468Z", "2019-09-06T19:11:11.468Z" ] +} \ 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..a26666155ce3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontainer.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer016942c052?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" : "0b3550f9-82d2-49e5-a93b-2d939b4c92bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FDFB26DC43\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76b839-401e-003a-16e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "0b3550f9-82d2-49e5-a93b-2d939b4c92bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer016942c052?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "17c667f2-8b06-4902-9ad4-7738ff2aefa0", + "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" : "\"0x8D732FDFB2C59CE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b859-401e-003a-32e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "17c667f2-8b06-4902-9ad4-7738ff2aefa0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer016942c052?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_212; Windows 10 10.0", + "x-ms-client-request-id" : "d2b6a622-81a4-415c-8e3b-75e8e0f09a34" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b876-401e-003a-4ce6-6473d5000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "d2b6a622-81a4-415c-8e3b-75e8e0f09a34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer016942c052?include=&restype=container&comp=list&sv=2019-02-02&se=2019-09-07T19%3A11%3A11Z&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "a269da43-2d77-4db1-888a-1089ba5483a6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b887-401e-003a-5ae6-6473d5000000", + "Body" : "", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "a269da43-2d77-4db1-888a-1089ba5483a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestcontainer&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "720818db-9bd1-4789-a2d1-d6ba838af6bd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76b896-401e-003a-68e6-6473d5000000", + "Body" : "jtcservicesassignaturevaluesnetworktestcontainerjtcservicesassignaturevaluesnetworktestcontainer016942c052Fri, 06 Sep 2019 19:11:11 GMT\"0x8D732FDFB2C59CE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "720818db-9bd1-4789-a2d1-d6ba838af6bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer016942c052?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" : "4ab6953a-688e-4b80-b548-127ea67883f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76b8a8-401e-003a-7ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:11 GMT", + "x-ms-client-request-id" : "4ab6953a-688e-4b80-b548-127ea67883f3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestcontainer016942c052", "2019-09-06T19:11:11.816Z", "2019-09-06T19:11:11.853Z" ] +} \ 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..5b9703a3481e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0sastesturlparserdca2527061d510d589854?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" : "7b501f43-aa4e-4d50-bd0d-c632fb4b86e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0722379A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e029-401e-003a-31e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "7b501f43-aa4e-4d50-bd0d-c632fb4b86e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9aed3f96-f0ec-4252-84db-a281a905e7bf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e038-401e-003a-3de6-6473d5000000", + "Body" : "jtcurlparserjtcurlparser0sastesturlparserdca2527061d510d589854Fri, 06 Sep 2019 19:11:31 GMT\"0x8D732FE0722379A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "9aed3f96-f0ec-4252-84db-a281a905e7bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0sastesturlparserdca2527061d510d589854?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" : "e9a88949-3ae7-44a6-ad69-e2eda11b12f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e047-401e-003a-4be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:31 GMT", + "x-ms-client-request-id" : "e9a88949-3ae7-44a6-ad69-e2eda11b12f8" + }, + "Exception" : null + } ], + "variables" : [ "jtcurlparser0sastesturlparserdca2527061d510d589854" ] +} \ 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..06a1a9092b8b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0serviceapitestgetaccountinfo0ee7236744a7?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" : "0cf5c3c3-6d3c-460b-bc5c-bcd63fad88bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE22C47775\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc148f-601e-004b-1de7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "0cf5c3c3-6d3c-460b-bc5c-bcd63fad88bf" + }, + "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" : "b87fbc76-bfeb-4f30-a82a-7e1fccd439f4", + "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" : "eecc149a-601e-004b-27e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "b87fbc76-bfeb-4f30-a82a-7e1fccd439f4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "87567fe2-3227-4d43-8f30-1650fad9c095" + }, + "Response" : { + "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" : "*", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "eecc14de-601e-004b-5ee7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "87567fe2-3227-4d43-8f30-1650fad9c095" + }, + "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" : "f81751d6-5e7a-4380-910d-9ad6c968a4ff", + "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" : "eecc14e6-601e-004b-66e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "f81751d6-5e7a-4380-910d-9ad6c968a4ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "122d5c6b-040f-46a9-a029-dffa79f37544" + }, + "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" : "eecc14f4-601e-004b-71e7-6401ec000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0serviceapitestgetaccountinfo0ee7236744a7Fri, 06 Sep 2019 19:12:18 GMT\"0x8D732FE22C47775\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "122d5c6b-040f-46a9-a029-dffa79f37544", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0serviceapitestgetaccountinfo0ee7236744a7?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" : "7967217a-4e53-4176-9020-11f320a512f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc1502-601e-004b-7ee7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "7967217a-4e53-4176-9020-11f320a512f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0serviceapitestgetaccountinfo0ee7236744a7" ] +} \ 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..ce5ebd8b9d0e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror050175077d66ad2983489e9?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" : "948fced6-94be-42f0-9a25-0c5a66e7f786" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE23383D8F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc158a-601e-004b-6be7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "948fced6-94be-42f0-9a25-0c5a66e7f786" + }, + "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" : "becc12cc-4dd5-49bb-aef0-62e0fa41637e", + "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" : "eecc1597-601e-004b-75e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "becc12cc-4dd5-49bb-aef0-62e0fa41637e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3a022282-046c-4544-aa23-ebffb763c484" + }, + "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" : "eecc15ab-601e-004b-05e7-6401ec000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:eecc15ab-601e-004b-05e7-6401ec000000\nTime:2019-09-06T19:12:19.0895530Z", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "3a022282-046c-4544-aa23-ebffb763c484", + "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" : "c16cd606-432a-45e0-9807-e747cdb16d5d", + "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" : "eecc15ba-601e-004b-12e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "c16cd606-432a-45e0-9807-e747cdb16d5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e5352868-7b96-4dc4-8f30-b824d864fe06" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc15d2-601e-004b-27e7-6401ec000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror050175077d66ad2983489e9Fri, 06 Sep 2019 19:12:19 GMT\"0x8D732FE23383D8F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "e5352868-7b96-4dc4-8f30-b824d864fe06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror050175077d66ad2983489e9?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" : "74ab2129-06ec-4794-b14b-78be19493fc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc15e0-601e-004b-35e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "74ab2129-06ec-4794-b14b-78be19493fc1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror050175077d66ad2983489e9" ] +} \ 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..2b767c10aa76 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0serviceapitestgetaccountinfomine7942128b?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" : "afc77050-53e7-4af7-959f-10722fa7c5e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE23070F49\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc1512-601e-004b-0de7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "afc77050-53e7-4af7-959f-10722fa7c5e9" + }, + "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" : "e7e1d83f-acdd-4ab6-901f-fbd43d4dba15", + "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" : "eecc151f-601e-004b-16e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "e7e1d83f-acdd-4ab6-901f-fbd43d4dba15" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "336682dd-0a44-443b-aa9c-a206feac1a1b" + }, + "Response" : { + "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" : "*", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "eecc1532-601e-004b-25e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "336682dd-0a44-443b-aa9c-a206feac1a1b" + }, + "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" : "b8ec8631-a4de-40dd-9a6c-1d9a7d094f2a", + "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" : "eecc153f-601e-004b-30e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "b8ec8631-a4de-40dd-9a6c-1d9a7d094f2a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "67305645-c2b7-4434-9cce-19e4434723ae" + }, + "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" : "eecc154c-601e-004b-3ae7-6401ec000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0serviceapitestgetaccountinfomine7942128bFri, 06 Sep 2019 19:12:18 GMT\"0x8D732FE23070F49\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "67305645-c2b7-4434-9cce-19e4434723ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0serviceapitestgetaccountinfomine7942128b?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" : "d6f91710-86a1-4de4-8d73-88205276123e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc1557-601e-004b-43e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "d6f91710-86a1-4de4-8d73-88205276123e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0serviceapitestgetaccountinfomine7942128b" ] +} \ 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..3f0c9058b35d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropserror0serviceapitestgetpropserror18157416a3b15?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" : "d6676a69-04b2-4f85-991d-82f54cf44e84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE1EE9560D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc0b56-601e-004b-6ce6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "d6676a69-04b2-4f85-991d-82f54cf44e84" + }, + "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" : "a0f91432-a9a6-4ea8-b844-a1e94273ff4c", + "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" : "eecc0b6d-601e-004b-7ee6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "a0f91432-a9a6-4ea8-b844-a1e94273ff4c" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9201ddc1-4481-4c31-aa25-9698c80aac66" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "472", + "StatusCode" : "403", + "x-ms-request-id" : "71f4a57b-d01e-0129-6ae6-646914000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:71f4a57b-d01e-0129-6ae6-646914000000\nTime:2019-09-06T19:12:12.0430838ZCannot find the claimed account when trying to GetProperties for the account azstoragesdkaccount.", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "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" : "eb53ecff-c96f-4d2b-b47b-8c297778386b", + "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" : "eecc0bda-601e-004b-58e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:12 GMT", + "x-ms-client-request-id" : "eb53ecff-c96f-4d2b-b47b-8c297778386b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e3eb4b91-bd58-4642-9b3e-653cd3cc1b7e" + }, + "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" : "eecc0bec-601e-004b-66e6-6401ec000000", + "Body" : "jtcgetpropserrorjtcgetpropserror0serviceapitestgetpropserror18157416a3b15Fri, 06 Sep 2019 19:12:11 GMT\"0x8D732FE1EE9560D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:12 GMT", + "x-ms-client-request-id" : "e3eb4b91-bd58-4642-9b3e-653cd3cc1b7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropserror0serviceapitestgetpropserror18157416a3b15?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" : "d2b74274-4b43-467a-b78c-890d832723d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0bf8-601e-004b-71e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:12 GMT", + "x-ms-client-request-id" : "d2b74274-4b43-467a-b78c-890d832723d5" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropserror0serviceapitestgetpropserror18157416a3b15" ] +} \ 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..29c64f88ad45 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropsmin0serviceapitestgetpropsmin09855392d578e85?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" : "0913a4b3-1413-4f8c-9ad0-9b87d78e0632" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE1EC2D8C9\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc0aec-601e-004b-15e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "0913a4b3-1413-4f8c-9ad0-9b87d78e0632" + }, + "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" : "eec7b432-8077-465a-8710-5d68c2d4801a", + "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" : "eecc0b04-601e-004b-28e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "eec7b432-8077-465a-8710-5d68c2d4801a" + }, + "Exception" : null + }, { + "Method" : "GET", + "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" : "fc840dfe-bd76-459c-ab63-cbdfb74feaa5" + }, + "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" : "eecc0b0e-601e-004b-2fe6-6401ec000000", + "Body" : "1.0falsefalsefalsefalse1.0falsefalse1.0falsefalsefalsefalse2018-03-28", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "fc840dfe-bd76-459c-ab63-cbdfb74feaa5", + "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" : "7cf498b8-05a2-4a85-b309-620b50c92dca", + "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" : "eecc0b20-601e-004b-3de6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "7cf498b8-05a2-4a85-b309-620b50c92dca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b8d5c020-e263-4f73-bfec-18451a006102" + }, + "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" : "eecc0b37-601e-004b-51e6-6401ec000000", + "Body" : "jtcgetpropsminjtcgetpropsmin0serviceapitestgetpropsmin09855392d578e85Fri, 06 Sep 2019 19:12:11 GMT\"0x8D732FE1EC2D8C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "b8d5c020-e263-4f73-bfec-18451a006102", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropsmin0serviceapitestgetpropsmin09855392d578e85?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" : "9c70443d-ae7c-4025-a9c3-067ebb37a231" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0b42-601e-004b-5ae6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "9c70443d-ae7c-4025-a9c3-067ebb37a231" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropsmin0serviceapitestgetpropsmin09855392d578e85" ] +} \ 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..2b3a8d80929b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstats0serviceapitestgetstatsfc652226e528e4a107?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" : "c5d98738-1d5b-412b-bf2c-a90cca526e6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE20C3E2C0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc0f7b-601e-004b-47e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "c5d98738-1d5b-412b-bf2c-a90cca526e6b" + }, + "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" : "621a1862-5072-4fee-a41a-24139cefe71f", + "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" : "eecc0f8b-601e-004b-54e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "621a1862-5072-4fee-a41a-24139cefe71f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount-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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5f404182-db87-404a-84b4-f1d1aa5b9978" + }, + "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" : "3fcf3493-701e-00f6-14e6-648202000000", + "Body" : "liveFri, 06 Sep 2019 19:09:52 GMT", + "Date" : "Fri, 06 Sep 2019 19:12:16 GMT", + "x-ms-client-request-id" : "5f404182-db87-404a-84b4-f1d1aa5b9978", + "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" : "0bb04f63-ad61-47d9-bf41-3dec33cf8471", + "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" : "eecc1371-601e-004b-36e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "0bb04f63-ad61-47d9-bf41-3dec33cf8471" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "dd177e3c-c135-4d81-bed6-96ab1656b69c" + }, + "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" : "eecc1383-601e-004b-44e6-6401ec000000", + "Body" : "jtcgetstatsjtcgetstats0serviceapitestgetstatsfc652226e528e4a107Fri, 06 Sep 2019 19:12:14 GMT\"0x8D732FE20C3E2C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "dd177e3c-c135-4d81-bed6-96ab1656b69c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstats0serviceapitestgetstatsfc652226e528e4a107?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" : "45f43682-d5b5-4b72-8f5b-f8341a1e087a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc138e-601e-004b-4ee6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "45f43682-d5b5-4b72-8f5b-f8341a1e087a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstats0serviceapitestgetstatsfc652226e528e4a107" ] +} \ 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..242d962f83e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatserror0serviceapitestgetstatserrorc9258689ca97c?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" : "73e20dec-4749-460d-8818-ee7ace97f2b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE229B8883\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc1428-601e-004b-46e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "73e20dec-4749-460d-8818-ee7ace97f2b2" + }, + "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" : "10fed879-dd37-4811-bc77-c4d867cd5192", + "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" : "eecc1435-601e-004b-51e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "10fed879-dd37-4811-bc77-c4d867cd5192" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "15a926aa-0469-449f-9544-caeb638a7bd2" + }, + "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" : "eecc1442-601e-004b-5be7-6401ec000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:eecc1442-601e-004b-5be7-6401ec000000\nTime:2019-09-06T19:12:18.0925867Zcompstats", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "15a926aa-0469-449f-9544-caeb638a7bd2", + "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" : "6f9632f2-7c3b-4aa2-8e28-373c44414a76", + "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" : "eecc1466-601e-004b-7ae7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "6f9632f2-7c3b-4aa2-8e28-373c44414a76" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "7cbf2138-1453-499a-b8bd-18405207246e" + }, + "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" : "eecc1472-601e-004b-06e7-6401ec000000", + "Body" : "jtcgetstatserrorjtcgetstatserror0serviceapitestgetstatserrorc9258689ca97cFri, 06 Sep 2019 19:12:17 GMT\"0x8D732FE229B8883\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "7cbf2138-1453-499a-b8bd-18405207246e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatserror0serviceapitestgetstatserrorc9258689ca97c?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" : "9a244376-3374-415f-a906-62891279dd4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc1481-601e-004b-12e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:18 GMT", + "x-ms-client-request-id" : "9a244376-3374-415f-a906-62891279dd4e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstatserror0serviceapitestgetstatserrorc9258689ca97c" ] +} \ 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..2ea8b2489ad6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatsmin0serviceapitestgetstatsminf7f6982603407b8?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" : "57e73c4e-b17b-4c35-a80b-333b2ad32c1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE2261F3AD\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc1398-601e-004b-57e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "57e73c4e-b17b-4c35-a80b-333b2ad32c1a" + }, + "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" : "79b765bf-50c8-4ef7-aad7-36a4e7dd9baa", + "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" : "eecc13ce-601e-004b-07e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "79b765bf-50c8-4ef7-aad7-36a4e7dd9baa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount-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_212; Windows 10 10.0", + "x-ms-client-request-id" : "5b5653ad-d916-4dfd-8b0b-820056763161" + }, + "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" : "3fcf3496-701e-00f6-16e7-648202000000", + "Body" : "liveFri, 06 Sep 2019 19:09:52 GMT", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "5b5653ad-d916-4dfd-8b0b-820056763161", + "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" : "f00a666e-37e9-4165-94c0-ff9dbbaffefb", + "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" : "eecc13f5-601e-004b-23e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "f00a666e-37e9-4165-94c0-ff9dbbaffefb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "da21dc15-ee6b-4011-9c0a-a5c07daceea4" + }, + "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" : "eecc1401-601e-004b-2be7-6401ec000000", + "Body" : "jtcgetstatsminjtcgetstatsmin0serviceapitestgetstatsminf7f6982603407b8Fri, 06 Sep 2019 19:12:17 GMT\"0x8D732FE2261F3AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "da21dc15-ee6b-4011-9c0a-a5c07daceea4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatsmin0serviceapitestgetstatsminf7f6982603407b8?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" : "9fcae393-2d4f-49fd-b136-7e62c08e9e1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc1414-601e-004b-37e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:17 GMT", + "x-ms-client-request-id" : "9fcae393-2d4f-49fd-b136-7e62c08e9e1a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstatsmin0serviceapitestgetstatsminf7f6982603407b8" ] +} \ 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..fb2c5addc337 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json @@ -0,0 +1,209 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinvalidaccountname0serviceapitestinvalidaccountname1a086106?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" : "b3a798f9-e178-4168-8046-a067e1b3375d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE235BD3EB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc15f3-601e-004b-48e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "b3a798f9-e178-4168-8046-a067e1b3375d" + }, + "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" : "277ffb93-9b63-451e-ad12-fc41fd12374c", + "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" : "eecc1606-601e-004b-56e7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:19 GMT", + "x-ms-client-request-id" : "277ffb93-9b63-451e-ad12-fc41fd12374c" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f2be283a-a241-4e19-b9eb-a0046578489a" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "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" : "098574e8-2c85-4168-97ea-9fe360fd4fb3", + "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" : "eecc7ee6-601e-004b-0ce7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:13:19 GMT", + "x-ms-client-request-id" : "098574e8-2c85-4168-97ea-9fe360fd4fb3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8ab406ac-8e44-4380-8534-a12d60f1ee50" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc7f1a-601e-004b-32e7-6401ec000000", + "Body" : "jtcinvalidaccountnamejtcinvalidaccountname0serviceapitestinvalidaccountname1a086106Fri, 06 Sep 2019 19:12:19 GMT\"0x8D732FE235BD3EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:13:19 GMT", + "x-ms-client-request-id" : "8ab406ac-8e44-4380-8534-a12d60f1ee50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinvalidaccountname0serviceapitestinvalidaccountname1a086106?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" : "8d954ab1-5ee5-4229-b0f2-35ec835a9f13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc7f27-601e-004b-3ee7-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:13:19 GMT", + "x-ms-client-request-id" : "8d954ab1-5ee5-4229-b0f2-35ec835a9f13" + }, + "Exception" : null + } ], + "variables" : [ "jtcinvalidaccountname0serviceapitestinvalidaccountname1a086106" ] +} \ 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..f1bfbff035b3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainers0serviceapitestlistcontainers9e6039545ba4?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" : "43ea76c5-08a6-4c1c-9067-e72f1ae959dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE073B6B10\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e055-401e-003a-58e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "43ea76c5-08a6-4c1c-9067-e72f1ae959dc" + }, + "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" : "6512ea58-2c93-40ff-9c93-7e4fc413d54a", + "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" : "8f76e0a6-401e-003a-1ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "6512ea58-2c93-40ff-9c93-7e4fc413d54a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "8f534a9d-97ff-4e64-8642-366c014bfe2d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e18d-401e-003a-52e6-6473d5000000", + "Body" : "jtclistcontainersjtclistcontainers0serviceapitestlistcontainers9e6039545ba4Fri, 06 Sep 2019 19:11:32 GMT\"0x8D732FE073B6B10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "8f534a9d-97ff-4e64-8642-366c014bfe2d", + "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" : "11405c36-38b3-4116-9efa-25db71ce2f9a", + "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" : "8f76e19e-401e-003a-61e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "11405c36-38b3-4116-9efa-25db71ce2f9a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "e9802d8b-699c-436f-9031-9e540637942e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e1e2-401e-003a-23e6-6473d5000000", + "Body" : "jtclistcontainersjtclistcontainers0serviceapitestlistcontainers9e6039545ba4Fri, 06 Sep 2019 19:11:32 GMT\"0x8D732FE073B6B10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "e9802d8b-699c-436f-9031-9e540637942e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainers0serviceapitestlistcontainers9e6039545ba4?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" : "11098e20-fcdb-47dd-a65e-eeb92ec9c62b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e1ee-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "11098e20-fcdb-47dd-a65e-eeb92ec9c62b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainers0serviceapitestlistcontainers9e6039545ba4" ] +} \ 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..af0dd8182a73 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersdetails070977cb5d6331bda94d32?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" : "ce70b0ea-b437-4955-b99c-6058cbf0cb6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0917CB8F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e6b7-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "ce70b0ea-b437-4955-b99c-6058cbf0cb6d" + }, + "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" : "8dd0cfb6-c96b-4c8f-83fd-53f880799868", + "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" : "8f76e6c6-401e-003a-7ee6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "8dd0cfb6-c96b-4c8f-83fd-53f880799868" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/aaajtclistcontainersdetails169915198acec314e94deb?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" : "c95db0f7-0964-4a93-b878-2dbd5c3e7fe3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE092451C5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e6d8-401e-003a-0fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "c95db0f7-0964-4a93-b878-2dbd5c3e7fe3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ae98565b-0ee9-498d-8b18-43ddb49d2c69" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e72f-401e-003a-5ce6-6473d5000000", + "Body" : "aaajtcaaajtclistcontainersdetails169915198acec314e94debFri, 06 Sep 2019 19:11:35 GMT\"0x8D732FE092451C5\"unlockedavailable$account-encryption-keyfalsefalsefalsebar", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "ae98565b-0ee9-498d-8b18-43ddb49d2c69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/aaajtclistcontainersdetails169915198acec314e94deb?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" : "defbcc3c-6165-4ed3-83cc-1d8172aa9538" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e73c-401e-003a-67e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "defbcc3c-6165-4ed3-83cc-1d8172aa9538" + }, + "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" : "704754ce-3bcb-4988-bf5b-d653550d0288", + "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" : "8f76e74c-401e-003a-75e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "704754ce-3bcb-4988-bf5b-d653550d0288" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ed7d9d20-501f-497a-9a9c-8aa1171f5985" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e76e-401e-003a-11e6-6473d5000000", + "Body" : "jtclistcontainersdetailsjtclistcontainersdetails070977cb5d6331bda94d32Fri, 06 Sep 2019 19:11:35 GMT\"0x8D732FE0917CB8F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "ed7d9d20-501f-497a-9a9c-8aa1171f5985", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersdetails070977cb5d6331bda94d32?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" : "1c04b5f9-ac5c-491a-8f91-41d0113403f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e77e-401e-003a-20e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "1c04b5f9-ac5c-491a-8f91-41d0113403f1" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersdetails070977cb5d6331bda94d32", "jtclistcontainersdetails169915198acec314e94deb" ] +} \ 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..1d8d03df16db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerserror09094646fcbf256bb042aaa?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" : "727ca12c-7246-41c8-8c61-ab0bfc80c210" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0A3F7DF6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbd6c-601e-004b-5fe6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "727ca12c-7246-41c8-8c61-ab0bfc80c210" + }, + "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" : "7f7122e1-fd8d-4e9f-b8b1-f967c780d1b7", + "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" : "eecbbd95-601e-004b-05e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "7f7122e1-fd8d-4e9f-b8b1-f967c780d1b7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9bb8e3d6-a809-493a-9ebf-e6e3808ccfdb" + }, + "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" : "eecbbdb1-601e-004b-20e6-6401ec000000", + "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:eecbbdb1-601e-004b-20e6-6401ec000000\nTime:2019-09-06T19:11:37.2050482Z", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "9bb8e3d6-a809-493a-9ebf-e6e3808ccfdb", + "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" : "766099f6-8c56-44fd-baaf-23ce3d98f4a6", + "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" : "eecbbdca-601e-004b-38e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "766099f6-8c56-44fd-baaf-23ce3d98f4a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9e089108-b837-4b4d-aca1-4ee5193df7fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecbbdf3-601e-004b-5ce6-6401ec000000", + "Body" : "jtclistcontainerserrorjtclistcontainerserror09094646fcbf256bb042aaaFri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A3F7DF6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "9e089108-b837-4b4d-aca1-4ee5193df7fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerserror09094646fcbf256bb042aaa?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" : "fdaf343d-2784-40ef-8033-54cf2a99cdda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbe13-601e-004b-7ce6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "fdaf343d-2784-40ef-8033-54cf2a99cdda" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainerserror09094646fcbf256bb042aaa" ] +} \ 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..2ef77f68e668 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json @@ -0,0 +1,526 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker0568716ac1876924234ae48?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" : "a9af9cdd-fd72-42cf-aaa2-7dbd6a27d968" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE07F99287\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e2a9-401e-003a-5be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "a9af9cdd-fd72-42cf-aaa2-7dbd6a27d968" + }, + "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" : "58897263-510f-4797-91dc-44c749d5cc70", + "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" : "8f76e2bc-401e-003a-6ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "58897263-510f-4797-91dc-44c749d5cc70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker104077b9dc01c7dc08498d8?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" : "b02b0af5-78a2-4fb1-a9e8-7551a83c81ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0805A361\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e2d5-401e-003a-7de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "b02b0af5-78a2-4fb1-a9e8-7551a83c81ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker23557439922d22f75840978?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" : "c299c6b2-b844-437b-b4cd-c1211fbc1333" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE081B0563\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e2ef-401e-003a-14e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "c299c6b2-b844-437b-b4cd-c1211fbc1333" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker384056ffc45998646147e6a?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" : "adc3650d-b8a3-4166-9049-ab9d59db7510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0824F2E0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e338-401e-003a-52e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "adc3650d-b8a3-4166-9049-ab9d59db7510" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker473098e8640a0f65cd46838?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" : "dafb523a-5449-44cd-8a93-06389b63a3e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE082BAB4A\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e34f-401e-003a-68e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "dafb523a-5449-44cd-8a93-06389b63a3e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker581427c5feed3609164beda?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" : "27bf0b2f-b410-4bab-beb9-9474793adecd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0831A037\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e362-401e-003a-78e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "27bf0b2f-b410-4bab-beb9-9474793adecd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker6056765bcb17fe00004c4cb?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" : "5c1b4f58-f08a-4676-961f-32aa8c58faa1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0836F8AB\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e379-401e-003a-0de6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "5c1b4f58-f08a-4676-961f-32aa8c58faa1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker7462623755276dc69349379?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" : "b02e8ac0-ecc9-4576-85b4-c7850553d555" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE084330B7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e393-401e-003a-23e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "b02e8ac0-ecc9-4576-85b4-c7850553d555" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker8624613342e0420129492c9?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" : "e64c70e6-962a-4452-8a26-0516bc46272b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE08544BD6\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e3ee-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "e64c70e6-962a-4452-8a26-0516bc46272b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker9613720c884fff3d0443a08?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" : "dbd2ab31-6712-40ec-9847-e99c9082d0bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE085C8B3C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e402-401e-003a-06e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "dbd2ab31-6712-40ec-9847-e99c9082d0bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker10991348d143fac32d746c1?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" : "96153e94-39b0-420e-a241-2d1ec4f9cfab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE08739B55\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e47a-401e-003a-72e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "96153e94-39b0-420e-a241-2d1ec4f9cfab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "3ca90f0e-16ca-44d3-954c-71a935cb71ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e487-401e-003a-7ee6-6473d5000000", + "Body" : "$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA8EB66FF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker0568716ac1876924234ae48Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE07F99287\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker104077b9dc01c7dc08498d8Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0805A361\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker10991348d143fac32d746c1Fri, 06 Sep 2019 19:11:34 GMT\"0x8D732FE08739B55\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker23557439922d22f75840978Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE081B0563\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker384056ffc45998646147e6aFri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0824F2E0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker473098e8640a0f65cd46838Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE082BAB4A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker581427c5feed3609164bedaFri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0831A037\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker6056765bcb17fe00004c4cbFri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0836F8AB\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker7462623755276dc69349379Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE084330B7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker8624613342e0420129492c9Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE08544BD6\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker9613720c884fff3d0443a08Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE085C8B3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "3ca90f0e-16ca-44d3-954c-71a935cb71ca", + "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" : "34e96b5d-b72a-4789-96b4-d7797d071993", + "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" : "8f76e4ca-401e-003a-3ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "34e96b5d-b72a-4789-96b4-d7797d071993" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "9cbd748e-e72d-4b94-976f-79e50a4f4de2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e52a-401e-003a-0de6-6473d5000000", + "Body" : "jtclistcontainersmarkerjtclistcontainersmarker0568716ac1876924234ae48Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE07F99287\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker104077b9dc01c7dc08498d8Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0805A361\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker10991348d143fac32d746c1Fri, 06 Sep 2019 19:11:34 GMT\"0x8D732FE08739B55\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker23557439922d22f75840978Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE081B0563\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker384056ffc45998646147e6aFri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0824F2E0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker473098e8640a0f65cd46838Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE082BAB4A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker581427c5feed3609164bedaFri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0831A037\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker6056765bcb17fe00004c4cbFri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE0836F8AB\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker7462623755276dc69349379Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE084330B7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker8624613342e0420129492c9Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE08544BD6\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker9613720c884fff3d0443a08Fri, 06 Sep 2019 19:11:33 GMT\"0x8D732FE085C8B3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "9cbd748e-e72d-4b94-976f-79e50a4f4de2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker0568716ac1876924234ae48?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" : "14966809-2d6a-41f9-b986-b672c3b46437" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e564-401e-003a-44e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "14966809-2d6a-41f9-b986-b672c3b46437" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker104077b9dc01c7dc08498d8?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" : "647bbe08-18cd-4be3-9619-ff76c40d3612" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e5a0-401e-003a-79e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "647bbe08-18cd-4be3-9619-ff76c40d3612" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker10991348d143fac32d746c1?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" : "5a29875b-0642-45d2-8c83-e0c73f50c97d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e5b5-401e-003a-0be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "5a29875b-0642-45d2-8c83-e0c73f50c97d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker23557439922d22f75840978?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" : "9862620e-cd1d-4c0f-94a1-6a57fecd4921" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e5c9-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "9862620e-cd1d-4c0f-94a1-6a57fecd4921" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker384056ffc45998646147e6a?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" : "c3c912a2-c583-49af-9071-8a42389e0463" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e5e0-401e-003a-2ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "c3c912a2-c583-49af-9071-8a42389e0463" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker473098e8640a0f65cd46838?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" : "f1597514-3e60-4703-b053-7ac232f1553c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e62c-401e-003a-73e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "f1597514-3e60-4703-b053-7ac232f1553c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker581427c5feed3609164beda?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" : "ccb738f2-4c50-4df6-8edc-7607a052947e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e63e-401e-003a-04e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "ccb738f2-4c50-4df6-8edc-7607a052947e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker6056765bcb17fe00004c4cb?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" : "63eed387-52dc-4942-b42a-8cf648d912aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e655-401e-003a-17e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:34 GMT", + "x-ms-client-request-id" : "63eed387-52dc-4942-b42a-8cf648d912aa" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker7462623755276dc69349379?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" : "e9920952-7eb8-4f82-8abb-9b1e70af8a18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e670-401e-003a-2fe6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "e9920952-7eb8-4f82-8abb-9b1e70af8a18" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker8624613342e0420129492c9?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" : "123a2134-b7af-4d63-97ef-9c9c62fb81c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e689-401e-003a-48e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "123a2134-b7af-4d63-97ef-9c9c62fb81c5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker9613720c884fff3d0443a08?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" : "938398d2-a2df-4fde-a2d3-74b0633bc15d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e69e-401e-003a-5ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "938398d2-a2df-4fde-a2d3-74b0633bc15d" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmarker0568716ac1876924234ae48", "jtclistcontainersmarker104077b9dc01c7dc08498d8", "jtclistcontainersmarker23557439922d22f75840978", "jtclistcontainersmarker384056ffc45998646147e6a", "jtclistcontainersmarker473098e8640a0f65cd46838", "jtclistcontainersmarker581427c5feed3609164beda", "jtclistcontainersmarker6056765bcb17fe00004c4cb", "jtclistcontainersmarker7462623755276dc69349379", "jtclistcontainersmarker8624613342e0420129492c9", "jtclistcontainersmarker9613720c884fff3d0443a08", "jtclistcontainersmarker10991348d143fac32d746c1" ] +} \ 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..1cb4b3705330 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json @@ -0,0 +1,368 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults046786abcd524262b9426?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" : "a8636ba8-3700-434f-9ee7-68b05aeb4783" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0960A637\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e788-401e-003a-2ae6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "a8636ba8-3700-434f-9ee7-68b05aeb4783" + }, + "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" : "cbdcec0c-13a4-4c1b-bad3-22edc2d4ee40", + "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" : "8f76e7c2-401e-003a-61e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "cbdcec0c-13a4-4c1b-bad3-22edc2d4ee40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults176576291dfdc920f345b?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" : "cdf5c2d2-a00e-46f5-b860-ccf887ee52bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE097A00CE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e7cd-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "cdf5c2d2-a00e-46f5-b860-ccf887ee52bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults239778ef2870c61652419?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" : "bf2aa17c-65ef-4465-b7ce-904036d916cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0987BFC8\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e801-401e-003a-1be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "bf2aa17c-65ef-4465-b7ce-904036d916cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults33847961e9919fc5984e0?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" : "945adf18-869c-4549-9548-09541b8954eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE09A33DC5\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e85e-401e-003a-6be6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "945adf18-869c-4549-9548-09541b8954eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults4268664bff6a52e6f04d9?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" : "92d7fb27-d99e-49b6-8b6d-e2724cbe5ee0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE09B0FCC3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e8ad-401e-003a-36e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "92d7fb27-d99e-49b6-8b6d-e2724cbe5ee0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults569199c22297cf7cc2423?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" : "92984237-d717-4c8b-a5f3-8eecbde8c0af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE09BE4678\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e8e1-401e-003a-65e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "92984237-d717-4c8b-a5f3-8eecbde8c0af" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f3e52211-19bb-4b7e-9a74-6842097a38fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e92b-401e-003a-25e6-6473d5000000", + "Body" : "3$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA8EB66FF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults046786abcd524262b9426Fri, 06 Sep 2019 19:11:35 GMT\"0x8D732FE0960A637\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainersmaxresults176576291dfdc920f345b", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "f3e52211-19bb-4b7e-9a74-6842097a38fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainersmaxresults176576291dfdc920f345b&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "b54c158c-feda-491d-b7dd-b9cac17790ee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e9b3-401e-003a-1fe6-6473d5000000", + "Body" : "/azstoragesdkaccount/jtclistcontainersmaxresults176576291dfdc920f345b3jtclistcontainersmaxresults176576291dfdc920f345bFri, 06 Sep 2019 19:11:35 GMT\"0x8D732FE097A00CE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults239778ef2870c61652419Fri, 06 Sep 2019 19:11:35 GMT\"0x8D732FE0987BFC8\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults33847961e9919fc5984e0Fri, 06 Sep 2019 19:11:36 GMT\"0x8D732FE09A33DC5\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainersmaxresults4268664bff6a52e6f04d9", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "b54c158c-feda-491d-b7dd-b9cac17790ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainersmaxresults4268664bff6a52e6f04d9&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "bcb6333c-f6c2-464b-bd5a-2fa08e6506fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e9c3-401e-003a-2de6-6473d5000000", + "Body" : "/azstoragesdkaccount/jtclistcontainersmaxresults4268664bff6a52e6f04d93jtclistcontainersmaxresults4268664bff6a52e6f04d9Fri, 06 Sep 2019 19:11:36 GMT\"0x8D732FE09B0FCC3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults569199c22297cf7cc2423Fri, 06 Sep 2019 19:11:36 GMT\"0x8D732FE09BE4678\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "bcb6333c-f6c2-464b-bd5a-2fa08e6506fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults176576291dfdc920f345b?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" : "ee05997b-2d5d-48f1-ba4f-fcc702034dac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbc4b-601e-004b-5fe6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "ee05997b-2d5d-48f1-ba4f-fcc702034dac" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults239778ef2870c61652419?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" : "4433da06-9673-4c5a-b93a-c5f00db10079" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbc67-601e-004b-79e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "4433da06-9673-4c5a-b93a-c5f00db10079" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults33847961e9919fc5984e0?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" : "b27c46ed-9ac2-4e67-b34a-dc39bf182bc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbc90-601e-004b-1ee6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "b27c46ed-9ac2-4e67-b34a-dc39bf182bc0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults4268664bff6a52e6f04d9?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" : "8ac1607c-9b25-4aa4-9db5-08b360025611" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbca1-601e-004b-2de6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "8ac1607c-9b25-4aa4-9db5-08b360025611" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults569199c22297cf7cc2423?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" : "e92af5cc-abe6-4857-a954-7a516ffeeb72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbcc3-601e-004b-4ce6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:35 GMT", + "x-ms-client-request-id" : "e92af5cc-abe6-4857-a954-7a516ffeeb72" + }, + "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" : "5f0d398b-cbcc-438b-8d53-a151b8cdcdd6", + "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" : "eecbbcf0-601e-004b-73e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "5f0d398b-cbcc-438b-8d53-a151b8cdcdd6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "37e99e1d-af52-4837-a62c-d207ce246d9f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecbbd1b-601e-004b-15e6-6401ec000000", + "Body" : "jtclistcontainersmaxresultsjtclistcontainersmaxresults046786abcd524262b9426Fri, 06 Sep 2019 19:11:35 GMT\"0x8D732FE0960A637\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "37e99e1d-af52-4837-a62c-d207ce246d9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults046786abcd524262b9426?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" : "e68676b9-51f1-4c28-9bfe-e74eeb5bdb74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbbd3f-601e-004b-38e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "e68676b9-51f1-4c28-9bfe-e74eeb5bdb74" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmaxresults046786abcd524262b9426", "jtclistcontainersmaxresults176576291dfdc920f345b", "jtclistcontainersmaxresults239778ef2870c61652419", "jtclistcontainersmaxresults33847961e9919fc5984e0", "jtclistcontainersmaxresults4268664bff6a52e6f04d9", "jtclistcontainersmaxresults569199c22297cf7cc2423" ] +} \ 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..4780dc4246f3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmin0serviceapitestlistcontainersminc92362826?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" : "888e0f25-552b-4403-919b-ab7e57246e5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE07C2E4B7\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8f76e203-401e-003a-43e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "888e0f25-552b-4403-919b-ab7e57246e5e" + }, + "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" : "6ddb442b-cc9b-4701-b7d0-11a1eadd9ffc", + "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" : "8f76e216-401e-003a-54e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:32 GMT", + "x-ms-client-request-id" : "6ddb442b-cc9b-4701-b7d0-11a1eadd9ffc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "487b8146-ffa1-42e5-b88e-ce3f1958e0fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e225-401e-003a-61e6-6473d5000000", + "Body" : "$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA8EB66FF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmin0serviceapitestlistcontainersminc92362826Fri, 06 Sep 2019 19:11:32 GMT\"0x8D732FE07C2E4B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "487b8146-ffa1-42e5-b88e-ce3f1958e0fe", + "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" : "b71076f2-8c16-4c92-b561-502737471328", + "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" : "8f76e272-401e-003a-26e6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "b71076f2-8c16-4c92-b561-502737471328" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "86dc13f2-7170-46d1-b41f-28dc5b7bf5fd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8f76e288-401e-003a-3ce6-6473d5000000", + "Body" : "jtclistcontainersminjtclistcontainersmin0serviceapitestlistcontainersminc92362826Fri, 06 Sep 2019 19:11:32 GMT\"0x8D732FE07C2E4B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "86dc13f2-7170-46d1-b41f-28dc5b7bf5fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmin0serviceapitestlistcontainersminc92362826?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" : "16dfe994-fda0-44ea-ae07-cbc2a7a68596" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8f76e29a-401e-003a-4ce6-6473d5000000", + "Date" : "Fri, 06 Sep 2019 19:11:33 GMT", + "x-ms-client-request-id" : "16dfe994-fda0-44ea-ae07-cbc2a7a68596" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmin0serviceapitestlistcontainersminc92362826" ] +} \ 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..dbb3ae752e19 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,368 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux086519829?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" : "f2999a3f-e829-42fd-a4cb-8af078b31ac4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0A63FEF1\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbe3c-601e-004b-25e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "f2999a3f-e829-42fd-a4cb-8af078b31ac4" + }, + "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" : "f21a9580-2af7-4b42-9699-a16bab274fdf", + "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" : "eecbbe5f-601e-004b-44e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "f21a9580-2af7-4b42-9699-a16bab274fdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a5?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" : "753678d8-3422-4bad-bea6-317b64546ea3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0A70FA6F\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbe7e-601e-004b-63e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "753678d8-3422-4bad-bea6-317b64546ea3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux279635dab?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" : "feaba4cb-e40b-4af8-a687-c100c1a5558f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0A7652F3\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbea5-601e-004b-05e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "feaba4cb-e40b-4af8-a687-c100c1a5558f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux34221185f?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" : "d1090bc8-012c-4945-b047-d395b016abb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0A7C960D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbec9-601e-004b-23e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "d1090bc8-012c-4945-b047-d395b016abb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux437972aed?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" : "a0bd6b8d-b4e4-43eb-ba1b-d48e8c6d0430" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0A8215B2\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbef2-601e-004b-48e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "a0bd6b8d-b4e4-43eb-ba1b-d48e8c6d0430" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux5022712dd?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" : "7f2967c1-0c8c-41cd-bd53-0ade9bf7380e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0AA9A4A0\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbbfb4-601e-004b-67e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:36 GMT", + "x-ms-client-request-id" : "7f2967c1-0c8c-41cd-bd53-0ade9bf7380e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "27221981-9952-47f8-a24a-fb65e13cbe7a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecbc013-601e-004b-32e6-6401ec000000", + "Body" : "3$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 06 Sep 2019 19:08:53 GMT\"0x8D732FDA8EB66FF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux086519829Fri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A63FEF1\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a5", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "27221981-9952-47f8-a24a-fb65e13cbe7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a5&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "272d624a-d784-4362-9674-d97e343fe1e9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecbc154-601e-004b-39e6-6401ec000000", + "Body" : "/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a53jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a5Fri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A70FA6F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux279635dabFri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A7652F3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux34221185fFri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A7C960D\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux437972aed", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "272d624a-d784-4362-9674-d97e343fe1e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux437972aed&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_212; Windows 10 10.0", + "x-ms-client-request-id" : "89a8c02e-95f4-4893-9200-8829fa914b2f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecbc170-601e-004b-51e6-6401ec000000", + "Body" : "/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux437972aed3jtclistcontainerswithtimeoutstillbackedbypagedflux437972aedFri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A8215B2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux5022712ddFri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0AA9A4A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "89a8c02e-95f4-4893-9200-8829fa914b2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a5?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" : "12b7999b-aef6-4f96-bdc6-69c570be95e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbc18b-601e-004b-6ae6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "12b7999b-aef6-4f96-bdc6-69c570be95e1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux279635dab?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" : "b7849201-e6ee-4043-9aaf-c639167beac2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbc1b0-601e-004b-08e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "b7849201-e6ee-4043-9aaf-c639167beac2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux34221185f?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" : "a0a44359-7718-4e4b-bf24-5c74c1536bd8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbc1d5-601e-004b-27e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "a0a44359-7718-4e4b-bf24-5c74c1536bd8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux437972aed?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" : "533e38de-abbe-432b-b67e-5766f1e1335f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbc1f6-601e-004b-44e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "533e38de-abbe-432b-b67e-5766f1e1335f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux5022712dd?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" : "512f627b-1391-4d70-a9ff-4de3172c7f56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbc21c-601e-004b-65e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "512f627b-1391-4d70-a9ff-4de3172c7f56" + }, + "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" : "ce06ec3c-96c4-491f-bf6f-6797218a141e", + "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" : "eecbc23e-601e-004b-05e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "ce06ec3c-96c4-491f-bf6f-6797218a141e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "f1b63ccd-b171-404a-adfa-3f5e28c6418c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecbc258-601e-004b-1de6-6401ec000000", + "Body" : "jtclistcontainerswithtimeoutstillbackedbypagedfluxjtclistcontainerswithtimeoutstillbackedbypagedflux086519829Fri, 06 Sep 2019 19:11:37 GMT\"0x8D732FE0A63FEF1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "f1b63ccd-b171-404a-adfa-3f5e28c6418c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux086519829?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" : "d058368d-5e87-4070-8fdc-7c156985d860" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecbc270-601e-004b-33e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "d058368d-5e87-4070-8fdc-7c156985d860" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainerswithtimeoutstillbackedbypagedflux086519829", "jtclistcontainerswithtimeoutstillbackedbypagedflux1793187a5", "jtclistcontainerswithtimeoutstillbackedbypagedflux279635dab", "jtclistcontainerswithtimeoutstillbackedbypagedflux34221185f", "jtclistcontainerswithtimeoutstillbackedbypagedflux437972aed", "jtclistcontainerswithtimeoutstillbackedbypagedflux5022712dd" ] +} \ 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..d522a9f5b34c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json @@ -0,0 +1,150 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetgetproperties0serviceapitestsetgetpropertiesb93097715d?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" : "7cf2b989-a047-47b3-81eb-548e17ab3ba3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE0B27581B\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:11:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecbc298-601e-004b-58e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "7cf2b989-a047-47b3-81eb-548e17ab3ba3" + }, + "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" : "23de0ca1-4eb6-4ce9-a4cb-1b88428e3c39", + "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" : "eecbc30d-601e-004b-3ae6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "23de0ca1-4eb6-4ce9-a4cb-1b88428e3c39" + }, + "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" : "b09de4b2-ff00-44e8-b251-4d7cc7c4f0e5", + "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" : "eecbc32f-601e-004b-5ae6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:11:37 GMT", + "x-ms-client-request-id" : "b09de4b2-ff00-44e8-b251-4d7cc7c4f0e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "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" : "5c7e791c-c0e1-43e0-b353-b805d1a5b69f" + }, + "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" : "eecc06ab-601e-004b-58e6-6401ec000000", + "Body" : "1.0truefalsefalsetrue51.0truetruetrue51.0truetruetrue5GET,PUT,HEAD*x-ms-versionx-ms-client-request-id10true5truemyIndex.htmlcustom/error/path.html2016-05-31", + "Date" : "Fri, 06 Sep 2019 19:12:08 GMT", + "x-ms-client-request-id" : "5c7e791c-c0e1-43e0-b353-b805d1a5b69f", + "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" : "9b694463-1bbd-49a6-8f4c-f35374cb9a2e", + "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" : "eecc06c5-601e-004b-67e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:08 GMT", + "x-ms-client-request-id" : "9b694463-1bbd-49a6-8f4c-f35374cb9a2e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "18de27fc-81a4-49e4-9ab6-33b18ff88b4f" + }, + "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" : "eecc06db-601e-004b-73e6-6401ec000000", + "Body" : "jtcsetgetpropertiesjtcsetgetproperties0serviceapitestsetgetpropertiesb93097715dFri, 06 Sep 2019 19:11:38 GMT\"0x8D732FE0B27581B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:08 GMT", + "x-ms-client-request-id" : "18de27fc-81a4-49e4-9ab6-33b18ff88b4f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetgetproperties0serviceapitestsetgetpropertiesb93097715d?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" : "7a02aaff-1f97-4f2a-a2d9-56ab9af58723" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc06e7-601e-004b-7de6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:08 GMT", + "x-ms-client-request-id" : "7a02aaff-1f97-4f2a-a2d9-56ab9af58723" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetgetproperties0serviceapitestsetgetpropertiesb93097715d" ] +} \ 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..599e2fa86c13 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropserror0serviceapitestsetpropserror1c275226116a1?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" : "b8a98936-9e04-4924-9f21-f06d643eb132" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE1D714D2C\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc077c-601e-004b-6ae6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "b8a98936-9e04-4924-9f21-f06d643eb132" + }, + "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" : "69135854-2f1e-46cd-a28e-19d1bc15e28c", + "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" : "eecc0786-601e-004b-6fe6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "69135854-2f1e-46cd-a28e-19d1bc15e28c" + }, + "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_212; Windows 10 10.0", + "x-ms-client-request-id" : "19b3513c-4bb4-4eca-91b6-4ff3a45ff7fd", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "472", + "StatusCode" : "403", + "x-ms-request-id" : "71f4a04b-d01e-0129-49e6-646914000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:71f4a04b-d01e-0129-49e6-646914000000\nTime:2019-09-06T19:12:11.2385115ZCannot find the claimed account when trying to GetProperties for the account azstoragesdkaccount.", + "Date" : "Fri, 06 Sep 2019 19:12:10 GMT", + "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" : "5c06b6dc-d68c-4cde-8b3d-2e07c84c350d", + "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" : "eecc0abe-601e-004b-6fe6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "5c06b6dc-d68c-4cde-8b3d-2e07c84c350d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "ce901cb4-8c89-485a-8aa6-920884828916" + }, + "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" : "eecc0ad2-601e-004b-7ee6-6401ec000000", + "Body" : "jtcsetpropserrorjtcsetpropserror0serviceapitestsetpropserror1c275226116a1Fri, 06 Sep 2019 19:12:09 GMT\"0x8D732FE1D714D2C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "ce901cb4-8c89-485a-8aa6-920884828916", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropserror0serviceapitestsetpropserror1c275226116a1?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" : "e97c130a-55d1-4501-87f1-00b72e530aaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0adf-601e-004b-08e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:11 GMT", + "x-ms-client-request-id" : "e97c130a-55d1-4501-87f1-00b72e530aaa" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetpropserror0serviceapitestsetpropserror1c275226116a1" ] +} \ 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..2dc58d360319 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropsmin0serviceapitestsetpropsmin302374095bf8174?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" : "53a955d9-e2fa-41cd-8dce-d52349c2f7b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE1D45020D\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc06fc-601e-004b-0ce6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "53a955d9-e2fa-41cd-8dce-d52349c2f7b6" + }, + "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" : "a0a9321a-f4f7-4938-a55d-a6d4c22d582f", + "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" : "eecc0734-601e-004b-37e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "a0a9321a-f4f7-4938-a55d-a6d4c22d582f" + }, + "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" : "c0d892c9-9d7f-49fc-85e5-0c1e5c8f4fa0", + "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" : "eecc0744-601e-004b-41e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "c0d892c9-9d7f-49fc-85e5-0c1e5c8f4fa0" + }, + "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" : "927fa995-bc11-478d-a6d9-15cdd48fa898", + "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" : "eecc0753-601e-004b-4be6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "927fa995-bc11-478d-a6d9-15cdd48fa898" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.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_212; Windows 10 10.0", + "x-ms-client-request-id" : "0f877f68-1a55-4685-ac19-4cb1cbdb5d07" + }, + "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" : "eecc0761-601e-004b-55e6-6401ec000000", + "Body" : "jtcsetpropsminjtcsetpropsmin0serviceapitestsetpropsmin302374095bf8174Fri, 06 Sep 2019 19:12:09 GMT\"0x8D732FE1D45020D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "0f877f68-1a55-4685-ac19-4cb1cbdb5d07", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropsmin0serviceapitestsetpropsmin302374095bf8174?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" : "4ada7410-e505-49c4-924e-67386835136a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0772-601e-004b-61e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:09 GMT", + "x-ms-client-request-id" : "4ada7410-e505-49c4-924e-67386835136a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetpropsmin0serviceapitestsetpropsmin302374095bf8174" ] +} \ 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..aac2b5fcb2b0 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -15,7 +15,8 @@ azure-storage-common 12.0.0-preview.3 - 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.4 org.slf4j @@ -55,7 +60,7 @@ com.azure azure-core-test - 1.0.0-preview.3 + 1.0.0-preview.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 98% 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..1394b502b55d 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,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; @@ -40,8 +40,7 @@ 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. 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..969f32cc8502 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASQueryParameters.java @@ -0,0 +1,97 @@ +// 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 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; + } + + /** + * 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 96% 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..0951faa12dd0 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,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; @@ -30,8 +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. 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 96% 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..69c75df949c2 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. 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..71cbfbd851c0 --- /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.services(accountSASService == null ? null : accountSASService.toString()); + values.resourceTypes(accountSASResourceType == null ? null : accountSASResourceType.toString()); + values.permissions(accountSASPermission == null ? null : accountSASPermission.toString()); + values.expiryTime(expiryTime); + values.startTime(startTime); + + if (version != null) { + values.version(version); + } + + values.ipRange(ipRange); + values.protocol(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 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 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.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-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..da40194d5e98 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseClientBuilder.java @@ -0,0 +1,356 @@ +// 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..8bc98e9deab9 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseSASQueryParameters.java @@ -0,0 +1,191 @@ +// 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 version() { + return version; + } + + /** + * @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 Please refer to *SASPermission classes for more details. + */ + public String permissions() { + return permissions; + } + + /** + * @return The signature for the SAS token. + */ + public String signature() { + 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..f70ba75a363a 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,8 @@ 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"; + private HeaderConstants() { // Private to prevent construction. } @@ -212,6 +214,21 @@ 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. } 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..c66823153ecf 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 @@ -7,10 +7,16 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.exception.UnexpectedLengthException; 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 java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import javax.crypto.Mac; @@ -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,29 @@ 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 +99,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 +244,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}. * @@ -437,4 +488,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..f93d8ec8ab69 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 @@ -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..0d6023687bf5 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; @@ -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..42fbcce913a7 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,7 @@ * functionality. */ public final class RequestRetryOptions { + private final ClientLogger logger = new ClientLogger(RequestRetryOptions.class); private final int maxTries; private final int tryTimeout; @@ -19,8 +22,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 +37,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 @@ -154,7 +157,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); 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..3fc0326aa3bb 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; @@ -92,7 +92,7 @@ stream, the buffers that were emitted will have already been consumed (their pos 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); + Flux bufferedBody = (context.httpRequest().body() == null) ? null : context.httpRequest().body().map(ByteBuffer::duplicate); context.httpRequest().body(bufferedBody); if (!tryingPrimary) { UrlBuilder builder = UrlBuilder.parse(context.httpRequest().url()); 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..33aa0aba7935 --- /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.request().headers().value(headerName); + String responseHeaderValue = httpResponse.headerValue(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..00625019ca36 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; /** @@ -38,7 +41,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN String newURL = requestURL.toString() + delimiter + credential.sasToken(); context.httpRequest().url(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-file/README.md b/sdk/storage/azure-storage-file/README.md index 75e91197b6d4..a868f4c410af 100644 --- a/sdk/storage/azure-storage-file/README.md +++ b/sdk/storage/azure-storage-file/README.md @@ -208,7 +208,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 +246,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 +307,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 +322,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 +337,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 +358,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 +397,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 +421,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 +481,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..2257699309e8 100644 --- a/sdk/storage/azure-storage-file/pom.xml +++ b/sdk/storage/azure-storage-file/pom.xml @@ -15,7 +15,8 @@ azure-storage-file 12.0.0-preview.3 - 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,6 +32,10 @@ HEAD + + com.azure.storage.file + + com.azure @@ -61,13 +66,13 @@ com.azure - azure-identity - 1.0.0-preview.3 + azure-core-http-netty + 1.0.0-preview.4 test - junit - junit + org.slf4j + slf4j-simple test @@ -75,6 +80,48 @@ reactor-test test + + org.spockframework + spock-core + test + + + src/main/java + src/test/java + + + ${basedir}/src/test/resources + + + + + + 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-file/src/main/java/com/azure/storage/file/BaseFileClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/BaseFileClientBuilder.java new file mode 100644 index 000000000000..0677c6715ef3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/BaseFileClientBuilder.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +import com.azure.core.credentials.TokenCredential; +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 BaseFileClientBuilder> extends BaseClientBuilder { + + private static final String FILE_ENDPOINT_MIDFIX = "file"; + + private final ClientLogger logger = new ClientLogger(BaseFileClientBuilder.class); + + @Override + protected final UserAgentPolicy getUserAgentPolicy() { + return new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, super.getConfiguration()); + } + + @Override + protected final String getServiceUrlMidfix() { + return FILE_ENDPOINT_MIDFIX; + } + + /** + * UNSUPPORTED OPERATION: Azure Storage file service does not support token authorization. + * 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}. + */ + public final T credential(TokenCredential credential) { + throw logger.logExceptionAsError(new UnsupportedOperationException( + "Azure Storage file service does not support token authorization.")); + } + + /** + * UNSUPPORTED OPERATION: Azure Storage file 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 file service validations + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java index e5a044464b8d..df496a66471a 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java @@ -4,36 +4,48 @@ package com.azure.storage.file; 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.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.implementation.AzureFileStorageBuilder; import com.azure.storage.file.implementation.AzureFileStorageImpl; import com.azure.storage.file.models.DirectoryInfo; import com.azure.storage.file.models.DirectoryProperties; import com.azure.storage.file.models.DirectorySetMetadataInfo; import com.azure.storage.file.models.DirectorysCreateResponse; -import com.azure.storage.file.models.DirectorysForceCloseHandlesResponse; import com.azure.storage.file.models.DirectorysGetPropertiesResponse; import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; -import com.azure.storage.file.models.DirectorysListHandlesResponse; import com.azure.storage.file.models.DirectorysSetMetadataResponse; +import com.azure.storage.file.models.DirectorysSetPropertiesResponse; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.FileRef; import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; +import reactor.core.publisher.Mono; + import java.net.MalformedURLException; import java.net.URL; import java.time.OffsetDateTime; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; +import java.util.Objects; +import java.util.Set; +import java.util.TreeSet; +import java.util.function.Function; + +import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.file.FileExtensions.filePermissionAndKeyHelper; +import static com.azure.storage.file.PostProcessor.postProcessResponse; /** * This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. @@ -44,14 +56,16 @@ * * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation} * - *

    View {@link DirectoryClientBuilder this} for additional ways to construct the client.

    + *

    View {@link FileClientBuilder this} for additional ways to construct the client.

    * - * @see DirectoryClientBuilder + * @see FileClientBuilder * @see DirectoryClient * @see SharedKeyCredential * @see SASTokenCredential */ public class DirectoryAsyncClient { + private final ClientLogger logger = new ClientLogger(DirectoryAsyncClient.class); + private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String directoryPath; @@ -66,30 +80,14 @@ public class DirectoryAsyncClient { * @param snapshot The snapshot of the share */ DirectoryAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String directoryPath, String snapshot) { + Objects.requireNonNull(shareName); + Objects.requireNonNull(directoryPath); this.shareName = shareName; this.directoryPath = directoryPath; this.snapshot = snapshot; this.azureFileStorageClient = azureFileStorageClient; } - /** - * Creates a DirectoryAsyncClient that sends requests to this directory at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that HTTP requests and response flow through - * @param shareName Name of the share - * @param directoryPath Name of the directory - * @param snapshot Optional snapshot of the share - */ - DirectoryAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String directoryPath, String snapshot) { - this.shareName = shareName; - this.directoryPath = directoryPath; - this.snapshot = snapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); - } - /** * Get the url of the storage directory client. * @return the URL of the storage directory client @@ -99,8 +97,8 @@ public URL getDirectoryUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -144,11 +142,11 @@ public DirectoryAsyncClient getSubDirectoryClient(String subDirectoryName) { *

    For more information, see the * Azure Docs.

    * - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + * @return The {@link DirectoryInfo directory info}. + * @throws StorageException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Mono> create() { - return create(null); + public Mono create() { + return createWithResponse(null, null, null).flatMap(FluxUtil::toMono); } /** @@ -158,17 +156,39 @@ public Mono> create() { * *

    Create the directory

    * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.create#map} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createWithResponse#filesmbproperties-string-map} * *

    For more information, see the * Azure Docs.

    * + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. * @param metadata Optional metadata to associate with the directory * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + * @throws StorageException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Mono> create(Map metadata) { - return azureFileStorageClient.directorys().createWithRestResponseAsync(shareName, directoryPath, null, metadata, Context.NONE) + public Mono> createWithResponse(FileSmbProperties smbProperties, String filePermission, + Map metadata) { + return withContext(context -> createWithResponse(smbProperties, filePermission, metadata, context)); + } + + Mono> createWithResponse(FileSmbProperties smbProperties, String filePermission, + Map metadata, Context context) { + FileSmbProperties properties = smbProperties == null ? new FileSmbProperties() : smbProperties; + + // Checks that file permission and file permission key are valid + filePermissionAndKeyHelper(filePermission, properties.filePermissionKey()); + + // If file permission and file permission key are both not set then set default value + filePermission = properties.filePermission(filePermission, FileConstants.FILE_PERMISSION_INHERIT); + String filePermissionKey = properties.filePermissionKey(); + + String fileAttributes = properties.ntfsFileAttributes(FileConstants.FILE_ATTRIBUTES_NONE); + String fileCreationTime = properties.fileCreationTime(FileConstants.FILE_TIME_NOW); + String fileLastWriteTime = properties.fileLastWriteTime(FileConstants.FILE_TIME_NOW); + + return postProcessResponse(azureFileStorageClient.directorys().createWithRestResponseAsync(shareName, directoryPath, fileAttributes, + fileCreationTime, fileLastWriteTime, null, metadata, filePermission, filePermissionKey, context)) .map(this::createWithRestResponse); } @@ -179,16 +199,40 @@ public Mono> create(Map metadata) { * *

    Delete the directory

    * - * {@codesnippet com.azure.storage.file.directoryClient.delete} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.delete} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return An empty response. + * @throws StorageException If the share doesn't exist + */ + public Mono delete() { + return deleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Deletes the directory in the file share. + * + *

    Code Samples

    + * + *

    Delete the directory

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteWithResponse} * *

    For more information, see the * Azure Docs.

    * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist + * @throws StorageException If the share doesn't exist */ - public Mono delete() { - return azureFileStorageClient.directorys().deleteWithRestResponseAsync(shareName, directoryPath, Context.NONE).map(VoidResponse::new) + public Mono deleteWithResponse() { + return withContext(this::deleteWithResponse); + } + + Mono deleteWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.directorys() + .deleteWithRestResponseAsync(shareName, directoryPath, context)) .map(VoidResponse::new); } @@ -207,11 +251,99 @@ public Mono delete() { * * @return Storage directory properties */ - public Mono> getProperties() { - return azureFileStorageClient.directorys().getPropertiesWithRestResponseAsync(shareName, directoryPath, snapshot, null, Context.NONE) + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the properties of this directory. + * The properties includes directory metadata, last modified date, is server encrypted, and eTag. + * + *

    Code Samples

    + * + *

    Retrieve directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return A response containing the storage directory properties with headers and response status code + */ + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.directorys() + .getPropertiesWithRestResponseAsync(shareName, directoryPath, snapshot, null, context)) .map(this::getPropertiesResponse); } + /** + * Sets the properties of this directory. + * The properties include the file SMB properties and the file permission. + * + *

    Code Samples

    + * + *

    Set directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.setProperties#filesmbproperties-string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. + * @return The storage directory SMB properties + */ + public Mono setProperties(FileSmbProperties smbProperties, String filePermission) { + return setPropertiesWithResponse(smbProperties, filePermission).flatMap(FluxUtil::toMono); + } + + /** + * Sets the properties of this directory. + * The properties include the file SMB properties and the file permission. + * + *

    Code Samples

    + * + *

    Set directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.setPropertiesWithResponse#filesmbproperties-string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. + * @return A response containing the storage directory smb properties with headers and response status code + */ + public Mono> setPropertiesWithResponse(FileSmbProperties smbProperties, String filePermission) { + return withContext(context -> setPropertiesWithResponse(smbProperties, filePermission, Context.NONE)); + } + + Mono> setPropertiesWithResponse(FileSmbProperties smbProperties, String filePermission, + Context context) { + + FileSmbProperties properties = smbProperties == null ? new FileSmbProperties() : smbProperties; + + // Checks that file permission and file permission key are valid + filePermissionAndKeyHelper(filePermission, properties.filePermissionKey()); + + // If file permission and file permission key are both not set then set default value + filePermission = properties.filePermission(filePermission, FileConstants.PRESERVE); + String filePermissionKey = properties.filePermissionKey(); + + String fileAttributes = properties.ntfsFileAttributes(FileConstants.PRESERVE); + String fileCreationTime = properties.fileCreationTime(FileConstants.PRESERVE); + String fileLastWriteTime = properties.fileLastWriteTime(FileConstants.PRESERVE); + + return postProcessResponse(azureFileStorageClient.directorys() + .setPropertiesWithRestResponseAsync(shareName, directoryPath, fileAttributes, fileCreationTime, + fileLastWriteTime, null, filePermission, filePermissionKey, context) + .map(this::setPropertiesResponse)); + } + /** * Sets the user-defined metadata to associate to the directory. * @@ -232,10 +364,41 @@ public Mono> getProperties() { * * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared * @return information about the directory - * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys + * @throws StorageException If the directory doesn't exist or the metadata contains invalid keys */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.directorys().setMetadataWithRestResponseAsync(shareName, directoryPath, null, metadata, Context.NONE) + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined metadata to associate to the directory. + * + *

    If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

    + * + *

    Code Samples

    + * + *

    Set the metadata to "directory:updatedMetadata"

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map} + * + *

    Clear the metadata of the directory

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared + * @return A response containing the information about the directory with headers and response status code + * @throws StorageException If the directory doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono> setMetadataWithResponse(Map metadata, Context context) { + return postProcessResponse(azureFileStorageClient.directorys() + .setMetadataWithRestResponseAsync(shareName, directoryPath, null, metadata, context)) .map(this::setMetadataResponse); } @@ -246,14 +409,14 @@ public Mono> setMetadata(Map * *

    List all sub-directories and files in the account

    * - * {@codesnippet com.azure.storage.file.directoryClient.listFilesAndDirectories} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories} * *

    For more information, see the * Azure Docs.

    * * @return {@link FileRef File info} in the storage directory */ - public Flux listFilesAndDirectories() { + public PagedFlux listFilesAndDirectories() { return listFilesAndDirectories(null, null); } @@ -274,9 +437,19 @@ public Flux listFilesAndDirectories() { * If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items. * @return {@link FileRef File info} in this directory with prefix and max number of return results. */ - public Flux listFilesAndDirectories(String prefix, Integer maxResults) { - return azureFileStorageClient.directorys().listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryPath, prefix, snapshot, null, maxResults, null, Context.NONE) - .flatMapMany(response -> nextPageForFileAndDirecotries(response, prefix, maxResults)); + public PagedFlux listFilesAndDirectories(String prefix, Integer maxResults) { + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.directorys() + .listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryPath, prefix, snapshot, + marker, maxResults, null, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + convertResponseAndGetNumOfResults(response), + response.value().nextMarker(), + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -286,7 +459,7 @@ public Flux listFilesAndDirectories(String prefix, Integer maxResults) * *

    Get 10 handles with recursive call.

    * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.getHandles} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean} * *

    For more information, see the * Azure Docs.

    @@ -295,15 +468,23 @@ public Flux listFilesAndDirectories(String prefix, Integer maxResults) * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. * @return {@link HandleItem handles} in the directory that satisfy the requirements */ - public Flux getHandles(Integer maxResult, boolean recursive) { - return azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryPath, null, maxResult, null, snapshot, recursive, Context.NONE) - .flatMapMany(response -> nextPageForHandles(response, maxResult, recursive)); + public PagedFlux listHandles(Integer maxResult, boolean recursive) { + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.directorys() + .listHandlesWithRestResponseAsync(shareName, directoryPath, marker, maxResult, null, snapshot, recursive, + Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value().handleList(), + response.value().nextMarker(), + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** - * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryAsyncClient#getHandles(Integer, boolean)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 + * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryAsyncClient#listHandles(Integer, boolean)} . * *

    Code Samples

    * @@ -318,9 +499,21 @@ public Flux getHandles(Integer maxResult, boolean recursive) { * @param recursive A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified in the URI. * @return The counts of number of handles closed */ - public Flux forceCloseHandles(String handleId, boolean recursive) { - return azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryPath, handleId, null, null, snapshot, recursive, Context.NONE) - .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId, recursive)); + public PagedFlux forceCloseHandles(String handleId, boolean recursive) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github Issue 4525 + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.directorys() + .forceCloseHandlesWithRestResponseAsync(shareName, directoryPath, handleId, null, marker, snapshot, + recursive, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + Collections.singletonList(response.deserializedHeaders().numberOfHandlesClosed()), + response.deserializedHeaders().marker(), + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -336,11 +529,11 @@ public Flux forceCloseHandles(String handleId, boolean recursive) { * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. + * @return A subdirectory client. + * @throws StorageException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Mono> createSubDirectory(String subDirectoryName) { - return createSubDirectory(subDirectoryName, null); + public Mono createSubDirectory(String subDirectoryName) { + return createSubDirectoryWithResponse(subDirectoryName, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -350,20 +543,29 @@ public Mono> createSubDirectory(String subDirecto * *

    Create the subdirectory named "subdir", with metadata

    * - * {@codesnippet com.azure.storage.file.directoryClient.createSubDirectory#string-map} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map} * *

    For more information, see the * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. * @param metadata Optional metadata to associate with the subdirectory * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. + * @throws StorageException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. */ - public Mono> createSubDirectory(String subDirectoryName, Map metadata) { + public Mono> createSubDirectoryWithResponse(String subDirectoryName, + FileSmbProperties smbProperties, String filePermission, Map metadata) { + return withContext(context -> createSubDirectoryWithResponse(subDirectoryName, smbProperties, filePermission, + metadata, context)); + } + + Mono> createSubDirectoryWithResponse(String subDirectoryName, + FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { DirectoryAsyncClient createSubClient = getSubDirectoryClient(subDirectoryName); - return createSubClient.create(metadata) - .map(response -> new SimpleResponse<>(response, createSubClient)); + return postProcessResponse(createSubClient.createWithResponse(smbProperties, filePermission, metadata, context)) + .map(response -> new SimpleResponse<>(response, createSubClient)); } /** @@ -379,12 +581,36 @@ public Mono> createSubDirectory(String subDirecto * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory + * @return An empty response. + * @throws StorageException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + */ + public Mono deleteSubDirectory(String subDirectoryName) { + return deleteSubDirectoryWithResponse(subDirectoryName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the subdirectory with specific name in this directory. + * + *

    Code Samples

    + * + *

    Delete the subdirectory named "subdir"

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param subDirectoryName Name of the subdirectory * @return A response that only contains headers and response status code - * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + * @throws StorageException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. */ - public Mono deleteSubDirectory(String subDirectoryName) { + public Mono deleteSubDirectoryWithResponse(String subDirectoryName) { + return withContext(context -> deleteSubDirectoryWithResponse(subDirectoryName, context)); + } + + Mono deleteSubDirectoryWithResponse(String subDirectoryName, Context context) { DirectoryAsyncClient deleteSubClient = getSubDirectoryClient(subDirectoryName); - return deleteSubClient.delete().map(VoidResponse::new); + return postProcessResponse(deleteSubClient.deleteWithResponse(context)).map(VoidResponse::new); } /** @@ -401,11 +627,11 @@ public Mono deleteSubDirectory(String subDirectoryName) { * * @param fileName Name of the file * @param maxSize Size of the file - * @return A response containing the FileAsyncClient and the status of creating the directory. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. + * @return The FileAsyncClient. + * @throws StorageException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Mono> createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public Mono createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -415,21 +641,31 @@ public Mono> createFile(String fileName, long maxSize) * *

    Create the file named "myFile"

    * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.createFile#string-long-fileHTTPHeaders-map} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map} * *

    For more information, see the * Azure Docs.

    * * @param fileName Name of the file * @param maxSize Max size of the file - * @param httpHeaders the Http headers set to the file - * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file. + * @param metadata Optional name-value pairs associated with the file as metadata. * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. + * @throws StorageException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + public Mono> createFileWithResponse(String fileName, long maxSize, + FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata) { + return withContext(context -> createFileWithResponse(fileName, maxSize, httpHeaders, smbProperties, filePermission, + metadata, context)); + } + + Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); - return fileAsyncClient.create(maxSize, httpHeaders, metadata).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + return postProcessResponse(fileAsyncClient.createWithResponse(maxSize, httpHeaders, smbProperties, filePermission, + metadata, context)).map(response -> new SimpleResponse<>(response, fileAsyncClient)); } /** @@ -445,12 +681,37 @@ public Mono> createFile(String fileName, long maxSize, * Azure Docs.

    * * @param fileName Name of the file + * @return An empty response. + * @throws StorageException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + */ + public Mono deleteFile(String fileName) { + return deleteFileWithResponse(fileName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the file with specific name in this directory. + * + *

    Code Samples

    + * + *

    Delete the file "filetest"

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param fileName Name of the file * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + * @throws StorageException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. */ - public Mono deleteFile(String fileName) { + public Mono deleteFileWithResponse(String fileName) { + return withContext(context -> deleteFileWithResponse(fileName, context)); + } + + Mono deleteFileWithResponse(String fileName, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); - return fileAsyncClient.delete().map(VoidResponse::new); + return postProcessResponse(fileAsyncClient.deleteWithResponse(context)) + .map(VoidResponse::new); } /** @@ -472,9 +733,9 @@ public String getShareSnapshotId() { private Response createWithRestResponse(final DirectorysCreateResponse response) { String eTag = response.deserializedHeaders().eTag(); OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); - DirectoryInfo directoryInfo = new DirectoryInfo(eTag, lastModified); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); + DirectoryInfo directoryInfo = new DirectoryInfo(eTag, lastModified, smbProperties); return new SimpleResponse<>(response, directoryInfo); - } private Response getPropertiesResponse(DirectorysGetPropertiesResponse response) { @@ -482,56 +743,35 @@ private Response getPropertiesResponse(DirectorysGetPropert String eTag = response.deserializedHeaders().eTag(); OffsetDateTime offsetDateTime = response.deserializedHeaders().lastModified(); boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - - DirectoryProperties directoryProperties = new DirectoryProperties(metadata, eTag, offsetDateTime, isServerEncrypted); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); + DirectoryProperties directoryProperties = new DirectoryProperties(metadata, eTag, offsetDateTime, isServerEncrypted, smbProperties); return new SimpleResponse<>(response, directoryProperties); } + private Response setPropertiesResponse(final DirectorysSetPropertiesResponse response) { + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); + DirectoryInfo directoryInfo = new DirectoryInfo(eTag, lastModified, smbProperties); + return new SimpleResponse<>(response, directoryInfo); + } + private Response setMetadataResponse(final DirectorysSetMetadataResponse response) { String eTag = response.deserializedHeaders().eTag(); boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - DirectorySetMetadataInfo directorySetMetadataInfo = new DirectorySetMetadataInfo(eTag, isServerEncrypted); return new SimpleResponse<>(response, directorySetMetadataInfo); } - private Flux nextPageForFileAndDirecotries(final DirectorysListFilesAndDirectoriesSegmentResponse response, final String prefix, final Integer maxResult) { - List fileRefs = convertResponseAndGetNumOfResults(response); - - if (response.value().nextMarker() == null) { - return Flux.fromIterable(fileRefs); - } - Mono listResponse = azureFileStorageClient.directorys().listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryPath, prefix, snapshot, response.value().nextMarker(), maxResult, null, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForFileAndDirecotries(newResponse, prefix, maxResult)); - return Flux.fromIterable(fileRefs).concatWith(fileRefPublisher); - } - - private Flux nextPageForHandles(DirectorysListHandlesResponse response, Integer maxResult, boolean recursive) { - List handleItems = response.value().handleList(); - - if (response.value().nextMarker() == null) { - return Flux.fromIterable(handleItems); - } - Mono listResponse = azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryPath, response.value().nextMarker(), maxResult, null, snapshot, recursive, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResult, recursive)); - return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); - } - - private Flux nextPageForForceCloseHandles(DirectorysForceCloseHandlesResponse response, String handleId, boolean recursive) { - List handleCount = Arrays.asList(response.deserializedHeaders().numberOfHandlesClosed()); - - if (response.deserializedHeaders().marker() == null) { - return Flux.fromIterable(handleCount); + private List convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { + Set fileRefs = new TreeSet<>(Comparator.comparing(FileRef::name)); + if (response.value().segment() != null) { + response.value().segment().directoryItems() + .forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); + response.value().segment().fileItems() + .forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); } - Mono listResponse = azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryPath, handleId, null, response.deserializedHeaders().marker(), snapshot, recursive, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForForceCloseHandles(newResponse, handleId, recursive)); - return Flux.fromIterable(handleCount).concatWith(fileRefPublisher); - } - private List convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { - List fileRefs = new ArrayList<>(); - response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); - response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); - return fileRefs; + return new ArrayList<>(fileRefs); } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java index 7de1792d0c35..2827c9d253d5 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java @@ -3,9 +3,11 @@ package com.azure.storage.file; +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.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.DirectoryInfo; @@ -14,7 +16,7 @@ import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.FileRef; import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; import java.net.URL; import java.util.Map; @@ -27,9 +29,9 @@ * * {@codesnippet com.azure.storage.file.directoryClient.instantiation} * - *

    View {@link DirectoryClientBuilder this} for additional ways to construct the client.

    + *

    View {@link FileClientBuilder this} for additional ways to construct the client.

    * - * @see DirectoryClientBuilder + * @see FileClientBuilder * @see DirectoryClient * @see SharedKeyCredential * @see SASTokenCredential @@ -94,11 +96,11 @@ public DirectoryClient getSubDirectoryClient(String subDirectoryName) { *

    For more information, see the * Azure Docs.

    * - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + * @return The {@link DirectoryInfo directory info}. + * @throws StorageException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Response create() { - return create(null); + public DirectoryInfo create() { + return createWithResponse(null, null, null, Context.NONE).value(); } /** @@ -108,17 +110,21 @@ public Response create() { * *

    Create the directory

    * - * {@codesnippet com.azure.storage.file.directoryClient.create#map} + * {@codesnippet com.azure.storage.file.directoryClient.createWithResponse#filesmbproperties-string-map-context} * *

    For more information, see the * Azure Docs.

    * + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. * @param metadata Optional metadata to associate with the directory. * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Response create(Map metadata) { - return directoryAsyncClient.create(metadata).block(); + public Response createWithResponse(FileSmbProperties smbProperties, String filePermission, + Map metadata, Context context) { + return directoryAsyncClient.createWithResponse(smbProperties, filePermission, metadata, context).block(); } /** @@ -133,11 +139,30 @@ public Response create(Map metadata) { *

    For more information, see the * Azure Docs.

    * + * @throws StorageException If the share doesn't exist + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + /** + * Deletes the directory in the file share. The directory must be empty before it can be deleted. + * + *

    Code Samples

    + * + *

    Delete the directory

    + * + * {@codesnippet com.azure.storage.file.DirectoryClient.deleteWithResponse#Context} + * + *

    For more information, see the + * Azure Docs.

    + * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the share doesn't exist */ - public VoidResponse delete() { - return directoryAsyncClient.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return directoryAsyncClient.deleteWithResponse(context).block(); } /** @@ -155,8 +180,71 @@ public VoidResponse delete() { * * @return Storage directory properties */ - public Response getProperties() { - return directoryAsyncClient.getProperties().block(); + public DirectoryProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of this directory. + * The properties includes directory metadata, last modified date, is server encrypted, and eTag. + * + *

    Code Samples

    + * + *

    Retrieve directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryClient.getPropertiesWithResponse#Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the storage directory properties with response status code and headers + */ + public Response getPropertiesWithResponse(Context context) { + return directoryAsyncClient.getPropertiesWithResponse(context).block(); + } + + /** + * Sets the properties of this directory. + * The properties include the file SMB properties and the file permission. + * + *

    Code Samples

    + * + *

    Set directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryClient.setProperties#filesmbproperties-string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. + * @return The storage directory SMB properties + */ + public DirectoryInfo setProperties(FileSmbProperties smbProperties, String filePermission) { + return setPropertiesWithResponse(smbProperties, filePermission, Context.NONE).value(); + } + + /** + * Sets the properties of this directory. + * The properties include the file SMB properties and the file permission. + * + *

    Code Samples

    + * + *

    Set directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryClient.setPropertiesWithResponse#filesmbproperties-string-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the storage directory smb properties with headers and response status code + */ + public Response setPropertiesWithResponse(FileSmbProperties smbProperties, String filePermission, Context context) { + return directoryAsyncClient.setPropertiesWithResponse(smbProperties, filePermission, context).block(); } /** @@ -178,11 +266,38 @@ public Response getProperties() { * Azure Docs.

    * * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared - * @return information about the directory - * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys + * @return The information about the directory + * @throws StorageException If the directory doesn't exist or the metadata contains invalid keys */ - public Response setMetadata(Map metadata) { - return directoryAsyncClient.setMetadata(metadata).block(); + public DirectorySetMetadataInfo setMetadata(Map metadata) { + return setMetadataWithResponse(metadata, Context.NONE).value(); + } + + /** + * Sets the user-defined metadata to associate to the directory. + * + *

    If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

    + * + *

    Code Samples

    + * + *

    Set the metadata to "directory:updatedMetadata"

    + * + * {@codesnippet com.azure.storage.file.directoryClient.setMetadataWithResponse#map-Context} + * + *

    Clear the metadata of the directory

    + * + * {@codesnippet com.azure.storage.file.DirectoryClient.setMetadataWithResponse#Map-Context.clearMetadata} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the information about the directory and response status code + * @throws StorageException If the directory doesn't exist or the metadata contains invalid keys + */ + public Response setMetadataWithResponse(Map metadata, Context context) { + return directoryAsyncClient.setMetadataWithResponse(metadata, context).block(); } /** @@ -199,7 +314,7 @@ public Response setMetadata(Map metada * * @return {@link FileRef File info} in the storage directory */ - public Iterable listFilesAndDirectories() { + public PagedIterable listFilesAndDirectories() { return listFilesAndDirectories(null, null); } @@ -220,8 +335,8 @@ public Iterable listFilesAndDirectories() { * If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items. * @return {@link FileRef File info} in this directory with prefix and max number of return results. */ - public Iterable listFilesAndDirectories(String prefix, Integer maxResults) { - return directoryAsyncClient.listFilesAndDirectories(prefix, maxResults).toIterable(); + public PagedIterable listFilesAndDirectories(String prefix, Integer maxResults) { + return new PagedIterable<>(directoryAsyncClient.listFilesAndDirectories(prefix, maxResults)); } /** @@ -231,7 +346,7 @@ public Iterable listFilesAndDirectories(String prefix, Integer maxResul * *

    Get 10 handles with recursive call.

    * - * {@codesnippet com.azure.storage.file.directoryClient.getHandles} + * {@codesnippet com.azure.storage.file.directoryClient.listHandles#Integer-boolean} * *

    For more information, see the * Azure Docs.

    @@ -240,14 +355,12 @@ public Iterable listFilesAndDirectories(String prefix, Integer maxResul * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. * @return {@link HandleItem handles} in the directory that satisfy the requirements */ - public Iterable getHandles(Integer maxResult, boolean recursive) { - return directoryAsyncClient.getHandles(maxResult, recursive).collectList().block(); + public PagedIterable listHandles(Integer maxResult, boolean recursive) { + return new PagedIterable<>(directoryAsyncClient.listHandles(maxResult, recursive)); } /** - * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryClient#getHandles(Integer, boolean)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 + * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryClient#listHandles(Integer, boolean)} . * *

    Code Samples

    * @@ -262,8 +375,10 @@ public Iterable getHandles(Integer maxResult, boolean recursive) { * @param recursive A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified in the URI. * @return The counts of number of handles closed. */ - public Iterable forceCloseHandles(String handleId, boolean recursive) { - return directoryAsyncClient.forceCloseHandles(handleId, recursive).collectList().block(); + public PagedIterable forceCloseHandles(String handleId, boolean recursive) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github Issue 4525 + return new PagedIterable<>(directoryAsyncClient.forceCloseHandles(handleId, recursive)); } /** @@ -279,11 +394,11 @@ public Iterable forceCloseHandles(String handleId, boolean recursive) { * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. + * @return The subdirectory client. + * @throws StorageException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Response createSubDirectory(String subDirectoryName) { - return createSubDirectory(subDirectoryName, null); + public DirectoryClient createSubDirectory(String subDirectoryName) { + return createSubDirectoryWithResponse(subDirectoryName, null, null, null, Context.NONE).value(); } /** @@ -293,19 +408,23 @@ public Response createSubDirectory(String subDirectoryName) { * *

    Create the subdirectory named "subdir", with metadata

    * - * {@codesnippet com.azure.storage.file.directoryClient.createSubDirectory#string-map} + * {@codesnippet com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map-context} * *

    For more information, see the * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. * @param metadata Optional metadata to associate with the subdirectory * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. */ - public Response createSubDirectory(String subDirectoryName, Map metadata) { + public Response createSubDirectoryWithResponse(String subDirectoryName, FileSmbProperties smbProperties, + String filePermission, Map metadata, Context context) { DirectoryClient directoryClient = getSubDirectoryClient(subDirectoryName); - return new SimpleResponse<>(directoryClient.create(metadata), directoryClient); + return new SimpleResponse<>(directoryClient.createWithResponse(smbProperties, filePermission, metadata, context), directoryClient); } /** @@ -321,11 +440,31 @@ public Response createSubDirectory(String subDirectoryName, Map * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory + * @throws StorageException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + */ + public void deleteSubDirectory(String subDirectoryName) { + deleteSubDirectoryWithResponse(subDirectoryName, Context.NONE); + } + + /** + * Deletes the subdirectory with specific name in this directory. The directory must be empty before it can be deleted. + * + *

    Code Samples

    + * + *

    Delete the subdirectory named "subdir"

    + * + * {@codesnippet com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param subDirectoryName Name of the subdirectory * @return A response that only contains headers and response status code - * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. */ - public VoidResponse deleteSubDirectory(String subDirectoryName) { - return directoryAsyncClient.deleteSubDirectory(subDirectoryName).block(); + public VoidResponse deleteSubDirectoryWithResponse(String subDirectoryName, Context context) { + return directoryAsyncClient.deleteSubDirectoryWithResponse(subDirectoryName, context).block(); } /** @@ -342,11 +481,11 @@ public VoidResponse deleteSubDirectory(String subDirectoryName) { * * @param fileName Name of the file * @param maxSize Size of the file - * @return A response containing the FileClient and the status of creating the directory. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. + * @return The FileClient + * @throws StorageException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Response createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public FileClient createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null, null, null, Context.NONE).value(); } /** @@ -356,21 +495,44 @@ public Response createFile(String fileName, long maxSize) { * *

    Create the file named "myFile"

    * - * {@codesnippet com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map} + * {@codesnippet com.azure.storage.file.directoryClient.createFile#string-long-filehttpheaders-filesmbproperties-string-map-context} * *

    For more information, see the * Azure Docs.

    * * @param fileName Name of the file * @param maxSize Max size of the file - * @param httpHeaders the Http headers set to the file - * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission THe file permission of the file. + * @param metadata Optional name-value pairs associated with the file as metadata. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. + * @throws StorageException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. + */ + public Response createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { + return directoryAsyncClient.createFileWithResponse(fileName, maxSize, httpHeaders, smbProperties, filePermission, + metadata, context).map(response -> new SimpleResponse<>(response, new FileClient(response.value()))).block(); + } + + /** + * Deletes the file with specific name in this directory. + * + *

    Code Samples

    + * + *

    Delete the file "filetest"

    + * + * {@codesnippet com.azure.storage.file.directoryClient.deleteFileWithResponse#string-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param fileName Name of the file + * @throws StorageException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. */ - public Response createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return directoryAsyncClient.createFile(fileName, maxSize, httpHeaders, metadata) - .map(response -> new SimpleResponse<>(response, new FileClient(response.value()))).block(); + public void deleteFile(String fileName) { + deleteFileWithResponse(fileName, Context.NONE); } /** @@ -380,17 +542,18 @@ public Response createFile(String fileName, long maxSize, FileHTTPHe * *

    Delete the file "filetest"

    * - * {@codesnippet com.azure.storage.file.directoryClient.deleteFile#string} + * {@codesnippet com.azure.storage.file.DirectoryClient.deleteFileWithResponse#String-Context} * *

    For more information, see the * Azure Docs.

    * * @param fileName Name of the file * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. */ - public VoidResponse deleteFile(String fileName) { - return directoryAsyncClient.deleteFile(fileName).block(); + public VoidResponse deleteFileWithResponse(String fileName, Context context) { + return directoryAsyncClient.deleteFileWithResponse(fileName, context).block(); } /** diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java deleted file mode 100644 index 85609f09297b..000000000000 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -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.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.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 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 DirectoryClient FileClients} - * and {@link DirectoryAsyncClient FileAsyncClients}, calling {@link DirectoryClientBuilder#buildClient() buildClient} - * constructs an instance of FileClient and calling {@link DirectoryClientBuilder#buildAsyncClient() buildAsyncClient} - * constructs an instance of FileAsyncClient. - * - *

    The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. - * {@link DirectoryClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * {@link DirectoryClientBuilder#shareName(String)}, {@link DirectoryClientBuilder#directoryPath(String)} and a {@link SASTokenCredential} that authorizes the client.

    - * - *

    Instantiating a synchronous Directory Client with SAS token

    - * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} - * - *

    Instantiating an Asynchronous Directory Client with SAS token

    - * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} - * - *

    If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may - * be set using {@link DirectoryClientBuilder#credential(SASTokenCredential) credential}.

    - * - * {@codesnippet com.azure.storage.file.directoryClient.instantiation.credential} - * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation.credential} - * - *

    Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage File service must be used. Set the SharedKeyCredential with - * {@link DirectoryClientBuilder#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 Directory Client with connection string.

    - * {@codesnippet com.azure.storage.file.directoryClient.instantiation.connectionstring} - * - *

    Instantiating an Asynchronous Directory Client with connection string.

    - * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring} - * - * @see DirectoryClient - * @see DirectoryAsyncClient - * @see SASTokenCredential - * @see SharedKeyCredential - */ -public class DirectoryClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private final List policies; - private final RetryPolicy retryPolicy; - - private HttpLogDetailLevel logLevel; - private Configuration configuration; - private URL endpoint; - private String shareName; - private String directoryPath; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private String snapshot; - - /** - * Creates a builder instance that is able to configure and construct {@link DirectoryClient DirectoryClients} - * and {@link DirectoryAsyncClient DirectoryAsyncClients}. - */ - public DirectoryClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - - configuration = ConfigurationManager.getConfiguration(); - } - - /** - * Creates a {@link DirectoryAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is - * called a new instance of {@link DirectoryAsyncClient} is created. - * - *

    - * If {@link DirectoryClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link DirectoryClientBuilder#endpoint(String) endpoint} are used to create the - * {@link DirectoryAsyncClient client}. All other builder settings are ignored. - *

    - * - * @return A ShareAsyncClient with the options set from the builder. - * @throws NullPointerException If {@code shareName} is {@code null} or {@code shareName} is {@code null}. - * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public DirectoryAsyncClient buildAsyncClient() { - Objects.requireNonNull(shareName); - Objects.requireNonNull(directoryPath); - - if (pipeline != null) { - return new DirectoryAsyncClient(endpoint, pipeline, shareName, directoryPath, snapshot); - } - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - 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 DirectoryAsyncClient(endpoint, pipeline, shareName, directoryPath, snapshot); - } - - /** - * Creates a {@link DirectoryClient} based on options set in the builder. Every time {@code buildClient()} is - * called a new instance of {@link DirectoryClient} is created. - * - *

    - * If {@link DirectoryClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link DirectoryClientBuilder#endpoint(String) endpoint} are used to create the - * {@link DirectoryClient client}. All other builder settings are ignored. - *

    - * - * @return A DirectoryClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code directoryPath} is {@code null}. - * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public DirectoryClient buildClient() { - return new DirectoryClient(this.buildAsyncClient()); - } - - /** - * Sets the endpoint for the Azure Storage File instance that the client will interact with. - * - *

    The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share - * that the client will interact with. Rest of the path segments should be the path of the directory.

    - * - *

    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 File instance to send service requests to and receive responses from. - * @return the updated DirectoryClientBuilder object - * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL - */ - public DirectoryClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); - String[] pathSegments = fullURL.getPath().split("/"); - int length = pathSegments.length; - this.shareName = length >= 2 ? pathSegments[1] : this.shareName; - this.directoryPath = length >= 3 ? pathSegments[2] : this.directoryPath; - - // 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; - } - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Directory endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public DirectoryClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - return this; - } - - /** - * Sets the {@link SharedKeyCredential} used to authenticate requests sent to the File service. - * - * @param credential Shared key credential generated from the Storage account that authorizes requests - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public DirectoryClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.sasTokenCredential = null; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public DirectoryClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map 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.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); - } - } - - /** - * Sets the share that the constructed clients will interact with - * - * @param shareName Name of the share - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code shareName} is {@code null}. - */ - public DirectoryClientBuilder shareName(String shareName) { - this.shareName = shareName; - return this; - } - - /** - * Sets the directory that the constructed clients will interact with - * - * @param directoryPath Path to the directory - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code directoryPath} is {@code null}. - */ - public DirectoryClientBuilder directoryPath(String directoryPath) { - this.directoryPath = directoryPath; - return this; - } - - /** - * 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 DirectoryClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public DirectoryClientBuilder 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 DirectoryClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public DirectoryClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(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 DirectoryClientBuilder object. - */ - public DirectoryClientBuilder 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 DirectoryClientBuilder#endpoint(String) endpoint}, - * {@link DirectoryClientBuilder#shareName(String) shareName} @{link DirectoryClientBuilder#directoryPath(String) filePath}, and {@link DirectoryClientBuilder#snapshot(String) snaphotShot} - * when building clients.

    - * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated DirectoryClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public DirectoryClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(pipeline); - 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 builder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated DirectoryClientBuilder object - */ - public DirectoryClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /** - * Sets the share snapshot that the constructed clients will interact with. This snapshot must be linked to the share - * that has been specified in the builder. - * - * @param snapshot Identifier of the share snapshot - * @return the updated DirectoryClientBuilder object. - */ - public DirectoryClientBuilder snapshot(String snapshot) { - this.snapshot = snapshot; - return this; - } -} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java index ce3b9b561530..d41a3c0cd531 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java @@ -4,15 +4,22 @@ package com.azure.storage.file; 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.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.file.implementation.AzureFileStorageBuilder; import com.azure.storage.file.implementation.AzureFileStorageImpl; import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; @@ -28,40 +35,48 @@ import com.azure.storage.file.models.FileUploadRangeHeaders; import com.azure.storage.file.models.FilesCreateResponse; import com.azure.storage.file.models.FilesDownloadResponse; -import com.azure.storage.file.models.FilesForceCloseHandlesResponse; import com.azure.storage.file.models.FilesGetPropertiesResponse; -import com.azure.storage.file.models.FilesGetRangeListResponse; -import com.azure.storage.file.models.FilesListHandlesResponse; import com.azure.storage.file.models.FilesSetHTTPHeadersResponse; import com.azure.storage.file.models.FilesSetMetadataResponse; import com.azure.storage.file.models.FilesStartCopyResponse; import com.azure.storage.file.models.FilesUploadRangeResponse; import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; +import com.azure.storage.file.models.StorageException; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.OpenOption; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.TimeoutException; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.file.FileExtensions.filePermissionAndKeyHelper; +import static com.azure.storage.file.PostProcessor.postProcessResponse; /** - * This class provides a client that contains all the operations for interacting with file in Azure Storage File Service. - * Operations allowed by the client are creating, copying, uploading, downloading, deleting and listing on a file, retrieving properties, setting metadata - * and list or force close handles of the file. + * This class provides a client that contains all the operations for interacting with file in Azure Storage File + * Service. Operations allowed by the client are creating, copying, uploading, downloading, deleting and listing on a + * file, retrieving properties, setting metadata and list or force close handles of the file. * *

    Instantiating an Asynchronous File Client

    * @@ -85,40 +100,26 @@ public class FileAsyncClient { private final String snapshot; /** - * Creates a FileAsyncClient that sends requests to the storage file at {@link AzureFileStorageImpl#getUrl() endpoint}. - * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * Creates a FileAsyncClient that sends requests to the storage file at {@link AzureFileStorageImpl#getUrl() + * endpoint}. Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * * @param azureFileStorageClient Client that interacts with the service interfaces * @param shareName Name of the share * @param filePath Path to the file * @param snapshot The snapshot of the share */ FileAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String filePath, String snapshot) { + Objects.requireNonNull(shareName); + Objects.requireNonNull(filePath); this.shareName = shareName; this.filePath = filePath; this.snapshot = snapshot; this.azureFileStorageClient = azureFileStorageClient; } - /** - * Creates a FileAsyncClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that HTTP requests and response flow through - * @param shareName Name of the share - * @param filePath Path to the file - * @param snapshot Optional snapshot of the share - */ - FileAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String filePath, String snapshot) { - this.shareName = shareName; - this.filePath = filePath; - this.snapshot = snapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); - } - /** * Get the url of the storage file client. + * * @return the URL of the storage file client * @throws RuntimeException If the file is using a malformed URL. */ @@ -126,8 +127,8 @@ public URL getFileUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -145,10 +146,11 @@ public URL getFileUrl() { * * @param maxSize The maximum size in bytes for the file, up to 1 TiB. * @return A response containing the file info and the status of creating the file. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. + * @throws StorageException If the file has already existed, the parent directory does not exist or fileName is + * an invalid resource name. */ - public Mono> create(long maxSize) { - return create(maxSize, null, null); + public Mono create(long maxSize) { + return createWithResponse(maxSize, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -156,22 +158,43 @@ public Mono> create(long maxSize) { * *

    Code Samples

    * - *

    Create the file with length of 1024 bytes, some headers and metadata.

    + *

    Create the file with length of 1024 bytes, some headers, file smb properties and metadata.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map} * *

    For more information, see the * Azure Docs.

    * * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @param httpHeaders Additional parameters for the operation. - * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * @see C# identifiers - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file. + * @param metadata Optional name-value pairs associated with the file as metadata. + * @return A response containing the {@link FileInfo file info} and the status of creating the file. + * @throws StorageException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Mono> create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return azureFileStorageClient.files().createWithRestResponseAsync(shareName, filePath, maxSize, null, metadata, httpHeaders, Context.NONE) + public Mono> createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission, Map metadata) { + return withContext(context -> createWithResponse(maxSize, httpHeaders, smbProperties, filePermission, metadata, context)); + } + + Mono> createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission, Map metadata, Context context) { + smbProperties = smbProperties == null ? new FileSmbProperties() : smbProperties; + + // Checks that file permission and file permission key are valid + filePermissionAndKeyHelper(filePermission, smbProperties.filePermissionKey()); + + // If file permission and file permission key are both not set then set default value + filePermission = smbProperties.filePermission(filePermission, FileConstants.FILE_PERMISSION_INHERIT); + String filePermissionKey = smbProperties.filePermissionKey(); + + String fileAttributes = smbProperties.ntfsFileAttributes(FileConstants.FILE_ATTRIBUTES_NONE); + String fileCreationTime = smbProperties.fileCreationTime(FileConstants.FILE_TIME_NOW); + String fileLastWriteTime = smbProperties.fileLastWriteTime(FileConstants.FILE_TIME_NOW); + + return postProcessResponse(azureFileStorageClient.files().createWithRestResponseAsync(shareName, filePath, maxSize, fileAttributes, + fileCreationTime, fileLastWriteTime, null, metadata, filePermission, filePermissionKey, httpHeaders, context)) .map(this::createFileInfoResponse); } @@ -180,7 +203,7 @@ public Mono> create(long maxSize, FileHTTPHeaders httpHeaders * *

    Code Samples

    * - *

    Copy file from source url to the {@code filePath}

    + *

    Copy file from source url to the {@code resourcePath}

    * * {@codesnippet com.azure.storage.file.fileAsyncClient.startCopy#string-map} * @@ -189,12 +212,38 @@ public Mono> create(long maxSize, FileHTTPHeaders httpHeaders * * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @return The {@link FileCopyInfo file copy info}. + * @see C# identifiers + */ + public Mono startCopy(String sourceUrl, Map metadata) { + return startCopyWithResponse(sourceUrl, metadata).flatMap(FluxUtil::toMono); + } + + /** + * Copies a blob or file to a destination file within the storage account. + * + *

    Code Samples

    + * + *

    Copy file from source url to the {@code resourcePath}

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. + * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @return A response containing the {@link FileCopyInfo file copy info} and the status of copying the file. * @see C# identifiers - * @return A response containing the file copy info and the status of copying the file. */ - public Mono> startCopy(String sourceUrl, Map metadata) { - return azureFileStorageClient.files().startCopyWithRestResponseAsync(shareName, filePath, sourceUrl, null, metadata, Context.NONE) - .map(this::startCopyResponse); + public Mono> startCopyWithResponse(String sourceUrl, Map metadata) { + return withContext(context -> startCopyWithResponse(sourceUrl, metadata, context)); + } + + Mono> startCopyWithResponse(String sourceUrl, Map metadata, Context context) { + return postProcessResponse(azureFileStorageClient.files() + .startCopyWithRestResponseAsync(shareName, filePath, sourceUrl, null, metadata, context)) + .map(this::startCopyResponse); } /** @@ -210,15 +259,42 @@ public Mono> startCopy(String sourceUrl, MapAzure Docs.

    * * @param copyId Specifies the copy id which has copying pending status associate with it. + * @return An empty response. + */ + public Mono abortCopy(String copyId) { + return abortCopyWithResponse(copyId).flatMap(FluxUtil::toMono); + } + + /** + * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. + * + *

    Code Samples

    + * + *

    Abort copy file from copy id("someCopyId")

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param copyId Specifies the copy id which has copying pending status associate with it. * @return A response containing the status of aborting copy the file. */ - public Mono abortCopy(String copyId) { - return azureFileStorageClient.files().abortCopyWithRestResponseAsync(shareName, filePath, copyId, Context.NONE) - .map(VoidResponse::new); + public Mono abortCopyWithResponse(String copyId) { + return withContext(context -> abortCopyWithResponse(copyId, context)); + } + + Mono abortCopyWithResponse(String copyId, Context context) { + return postProcessResponse(azureFileStorageClient.files() + .abortCopyWithRestResponseAsync(shareName, filePath, copyId, context)) + .map(VoidResponse::new); } /** - * Downloads a file from the system, including its metadata and properties + * Downloads a file from the system, including its metadata and properties 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.

    * *

    Code Samples

    * @@ -237,7 +313,10 @@ public Mono downloadToFile(String downloadFilePath) { } /** - * Downloads a file from the system, including its metadata and properties + * Downloads a file from the system, including its metadata and properties 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.

    * *

    Code Samples

    * @@ -253,24 +332,23 @@ public Mono downloadToFile(String downloadFilePath) { * @return An empty response. */ public Mono downloadToFile(String downloadFilePath, FileRange range) { - AsynchronousFileChannel channel = channelSetup(downloadFilePath); - return sliceFileRange(range) - .flatMap(chunk -> downloadWithProperties(chunk, false) - .map(dar -> dar.value().body()) - .subscribeOn(Schedulers.elastic()) - .flatMap(fbb -> FluxUtil.bytebufStreamToFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) - .subscribeOn(Schedulers.elastic()) - .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) - .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException))) - .then() - .doOnTerminate(() -> channelCleanUp(channel)); - } - - private AsynchronousFileChannel channelSetup(String filePath) { + return Mono.using(() -> channelSetup(downloadFilePath, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW), + channel -> sliceFileRange(range) + .flatMap(chunk -> downloadWithPropertiesWithResponse(chunk, false) + .map(dar -> dar.value().body()) + .subscribeOn(Schedulers.elastic()) + .flatMap(fbb -> FluxUtil.writeFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) + .subscribeOn(Schedulers.elastic()) + .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) + .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException))) + .then(), this::channelCleanUp); + } + + private AsynchronousFileChannel channelSetup(String filePath, OpenOption... options) { try { - return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE); + return AsynchronousFileChannel.open(Paths.get(filePath), options); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -278,7 +356,7 @@ private void channelCleanUp(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(Exceptions.propagate(new UncheckedIOException(e))); } } @@ -290,20 +368,20 @@ private Flux sliceFileRange(FileRange fileRange) { } else { end = Mono.empty(); } - end = end.switchIfEmpty(getProperties().map(rb -> rb.value().contentLength())); + end = end.switchIfEmpty(getProperties().map(FileProperties::contentLength)); return end - .map(e -> { - List chunks = new ArrayList<>(); - for (long pos = offset; pos < e; pos += FILE_DEFAULT_BLOCK_SIZE) { - long count = FILE_DEFAULT_BLOCK_SIZE; - if (pos + count > e) { - count = e - pos; - } - chunks.add(new FileRange(pos, pos + count - 1)); - } - return chunks; - }) - .flatMapMany(Flux::fromIterable); + .map(e -> { + List chunks = new ArrayList<>(); + for (long pos = offset; pos < e; pos += FILE_DEFAULT_BLOCK_SIZE) { + long count = FILE_DEFAULT_BLOCK_SIZE; + if (pos + count > e) { + count = e - pos; + } + chunks.add(new FileRange(pos, pos + count - 1)); + } + return chunks; + }) + .flatMapMany(Flux::fromIterable); } /** @@ -318,10 +396,10 @@ private Flux sliceFileRange(FileRange fileRange) { *

    For more information, see the * Azure Docs.

    * - * @return A response that only contains headers and response status code + * @return The {@link FileDownloadInfo file download Info} */ - public Mono> downloadWithProperties() { - return downloadWithProperties(null, null); + public Mono downloadWithProperties() { + return downloadWithPropertiesWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -331,19 +409,25 @@ public Mono> downloadWithProperties() { * *

    Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean} + * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean} * *

    For more information, see the * Azure Docs.

    * * @param range Optional byte range which returns file data only from the specified range. - * @param rangeGetContentMD5 Optional boolean which the service returns the MD5 hash for the range when it sets to true, as long as the range is less than or equal to 4 MB in size. - * @return A response that only contains headers and response status code + * @param rangeGetContentMD5 Optional boolean which the service returns the MD5 hash for the range when it sets + * to true, as long as the range is less than or equal to 4 MB in size. + * @return A response containing the {@link FileDownloadInfo file download Info} with headers and response status code */ - public Mono> downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { + public Mono> downloadWithPropertiesWithResponse(FileRange range, Boolean rangeGetContentMD5) { + return withContext(context -> downloadWithPropertiesWithResponse(range, rangeGetContentMD5, context)); + } + + Mono> downloadWithPropertiesWithResponse(FileRange range, Boolean rangeGetContentMD5, Context context) { String rangeString = range == null ? null : range.toString(); - return azureFileStorageClient.files().downloadWithRestResponseAsync(shareName, filePath, null, rangeString, rangeGetContentMD5, Context.NONE) - .map(this::downloadWithPropertiesResponse); + return postProcessResponse(azureFileStorageClient.files() + .downloadWithRestResponseAsync(shareName, filePath, null, rangeString, rangeGetContentMD5, context)) + .map(this::downloadWithPropertiesResponse); } /** @@ -357,13 +441,55 @@ public Mono> downloadWithProperties(FileRange range, * *

    For more information, see the * Azure Docs.

    + * @return An empty response + * @throws StorageException If the directory doesn't exist or the file doesn't exist. + */ + public Mono delete() { + return deleteWithResponse(null).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the file associate with the client. + * + *

    Code Samples

    + * + *

    Delete the file

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.deleteWithResponse} + * + *

    For more information, see the + * Azure Docs.

    * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. + * @throws StorageException If the directory doesn't exist or the file doesn't exist. */ - public Mono delete() { - return azureFileStorageClient.files().deleteWithRestResponseAsync(shareName, filePath, Context.NONE) - .map(VoidResponse::new); + public Mono deleteWithResponse() { + return withContext(this::deleteWithResponse); + } + + Mono deleteWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.files() + .deleteWithRestResponseAsync(shareName, filePath, context)) + .map(VoidResponse::new); + } + + /** + * Retrieves the properties of the storage account's file. The properties includes file metadata, last modified + * date, is server encrypted, and eTag. + * + *

    Code Samples

    + * + *

    Retrieve file properties

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.getProperties} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return {@link FileProperties Storage file properties} + */ + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -374,44 +500,103 @@ public Mono delete() { * *

    Retrieve file properties

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.getProperties} + * {@codesnippet com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse} * *

    For more information, see the * Azure Docs.

    * - * @return Storage file properties + * @return A response containing the {@link FileProperties storage file properties} and response status code */ - public Mono> getProperties() { - return azureFileStorageClient.files().getPropertiesWithRestResponseAsync(shareName, filePath, snapshot, null, Context.NONE) - .map(this::getPropertiesResponse); + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.files() + .getPropertiesWithRestResponseAsync(shareName, filePath, snapshot, null, context)) + .map(this::getPropertiesResponse); } /** - * Sets the user-defined httpHeaders to associate to the file. + * Sets the user-defined file properties to associate to the file. * - *

    If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

    + *

    If {@code null} is passed for the fileProperties.httpHeaders it will clear the httpHeaders associated to the file. + * If {@code null} is passed for the fileProperties.filesmbproperties it will preserve the filesmb properties associated with the file.

    * *

    Code Samples

    * *

    Set the httpHeaders of contentType of "text/plain"

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders} + * {@codesnippet com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string} * - *

    Clear the metadata of the file

    + *

    Clear the metadata of the file and preserve the SMB properties

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders} + * {@codesnippet com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties} * *

    For more information, see the * Azure Docs.

    * * @param newFileSize New file size of the file - * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @return Response of the information about the file + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file + * @return The {@link FileInfo file info} * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - return azureFileStorageClient.files().setHTTPHeadersWithRestResponseAsync(shareName, filePath, null, newFileSize, httpHeaders, Context.NONE) - .map(this::setHttpHeadersResponse); + public Mono setProperties(long newFileSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission) { + return setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined file properties to associate to the file. + * + *

    If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file. + * If {@code null} is passed for the filesmbproperties it will preserve the filesmbproperties associated with the file.

    + * + *

    Code Samples

    + * + *

    Set the httpHeaders of contentType of "text/plain"

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string} + * + *

    Clear the metadata of the file and preserve the SMB properties

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param newFileSize New file size of the file. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file. + * @return Response containing the {@link FileInfo file info} and response status code. + * @throws IllegalArgumentException thrown if parameters fail the validation. + */ + public Mono> setPropertiesWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission) { + return withContext(context -> setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission, context)); + } + + Mono> setPropertiesWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Context context) { + smbProperties = smbProperties == null ? new FileSmbProperties() : smbProperties; + + // Checks that file permission and file permission key are valid + filePermissionAndKeyHelper(filePermission, smbProperties.filePermissionKey()); + + // If file permission and file permission key are both not set then set default value + filePermission = smbProperties.filePermission(filePermission, FileConstants.PRESERVE); + String filePermissionKey = smbProperties.filePermissionKey(); + + String fileAttributes = smbProperties.ntfsFileAttributes(FileConstants.PRESERVE); + String fileCreationTime = smbProperties.fileCreationTime(FileConstants.PRESERVE); + String fileLastWriteTime = smbProperties.fileLastWriteTime(FileConstants.PRESERVE); + + return postProcessResponse(azureFileStorageClient.files().setHTTPHeadersWithRestResponseAsync(shareName, filePath, fileAttributes, + fileCreationTime, fileLastWriteTime, null, newFileSize, filePermission, filePermissionKey, httpHeaders, context)) + .map(this::setPropertiesResponse); } /** @@ -427,18 +612,70 @@ public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders * *

    Clear the metadata of the file

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata} + * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared + * @return {@link FileMetadataInfo file meta info} + * @throws StorageException If the file doesn't exist or the metadata contains invalid keys + */ + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined metadata to associate to the file. + * + *

    If {@code null} is passed for the metadata it will clear the metadata associated to the file.

    + * + *

    Code Samples

    + * + *

    Set the metadata to "file:updatedMetadata"

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map} + * + *

    Clear the metadata of the file

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata} * *

    For more information, see the * Azure Docs.

    * * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared - * @return information about the file - * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys + * @return A response containing the {@link FileMetadataInfo file meta info} and status code + * @throws StorageException If the file doesn't exist or the metadata contains invalid keys */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.files().setMetadataWithRestResponseAsync(shareName, filePath, null, metadata, Context.NONE) - .map(this::setMetadataResponse); + public Mono> setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono> setMetadataWithResponse(Map metadata, Context context) { + return postProcessResponse(azureFileStorageClient.files() + .setMetadataWithRestResponseAsync(shareName, filePath, null, metadata, context)) + .map(this::setMetadataResponse); + } + + /** + * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an + * in-place write on the specified file. + * + *

    Code Samples

    + * + *

    Upload data "default" to the file in Storage File Service.

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#flux-long} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. + * @return A response that only contains headers and response status code + */ + public Mono upload(Flux data, long length) { + return uploadWithResponse(data, length).flatMap(FluxUtil::toMono); } /** @@ -448,22 +685,51 @@ public Mono> setMetadata(Map metadata * *

    Upload "default" to the file.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#flux-long} + * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long} * *

    For more information, see the * Azure Docs.

    * * @param data The data which will upload to the storage file. * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code + * @throws StorageException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Mono> upload(Flux data, long length) { + public Mono> uploadWithResponse(Flux data, long length) { + return withContext(context -> uploadWithResponse(data, length, context)); + } + + Mono> uploadWithResponse(Flux data, long length, Context context) { FileRange range = new FileRange(0, length - 1); - return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, length, data, null, null, Context.NONE) + return postProcessResponse(azureFileStorageClient.files() + .uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, + length, data, null, null, context)) .map(this::uploadResponse); } + /** + * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place + * write on the specified file. + * + *

    Code Samples

    + * + *

    Upload data "default" starting from 1024 bytes.

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#flux-long-long} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. + * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} + * @return The {@link FileUploadInfo file upload info} + * @throws StorageException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public Mono upload(Flux data, long length, long offset) { + return uploadWithResponse(data, length, offset).flatMap(FluxUtil::toMono); + } + /** * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. * @@ -471,7 +737,7 @@ public Mono> upload(Flux data, long length) { * *

    Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#bytebuf-long-int-filerangewritetype} + * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long} * *

    For more information, see the * Azure Docs.

    @@ -479,39 +745,68 @@ public Mono> upload(Flux data, long length) { * @param data The data which will upload to the storage file. * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. - * @param type You may specify one of the following options: - *
      - *
    • Update: Writes the bytes specified by the request body into the specified range.
    • - *
    • 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.
    • - *
        - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code + * @throws StorageException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Mono> upload(Flux data, long length, long offset, FileRangeWriteType type) { + public Mono> uploadWithResponse(Flux data, long length, long offset) { + return withContext(context -> uploadWithResponse(data, length, offset, context)); + } + + Mono> uploadWithResponse(Flux data, long length, long offset, Context context) { FileRange range = new FileRange(offset, offset + length - 1); - return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), type, length, data, null, null, Context.NONE) - .map(this::uploadResponse); + return postProcessResponse(azureFileStorageClient.files() + .uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, + length, data, null, null, context)) + .map(this::uploadResponse); } /** - * Uploads file to storage file service. + * Clear a range of bytes to specific of a file in storage file service. Clear operations performs an in-place + * write on the specified file. * *

        Code Samples

        * - *

        Upload the file from the source file path.

        + *

        Clears the first 1024 bytes.

        * - * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile#string} + * {@codesnippet com.azure.storage.file.fileAsyncClient.clearRange#long} * *

        For more information, see the - * Azure Docs Create File - * and - * Azure Docs Upload.

        + * Azure Docs.

        * - * @param uploadFilePath The path where store the source file to upload - * @return An empty response. + * @param length Specifies the number of bytes being cleared. + * @return The {@link FileUploadInfo file upload info} */ - public Mono uploadFromFile(String uploadFilePath) { - return uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); + public Mono clearRange(long length) { + return clearRangeWithResponse(length, 0).flatMap(FluxUtil::toMono); + } + + /** + * Clear a range of bytes to specific of a file in storage file service. Clear operations performs an in-place + * write on the specified file. + * + *

        Code Samples

        + * + *

        Clear the range starting from 1024 with length of 1024.

        + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.clearRange#long-long} + * + *

        For more information, see the + * Azure Docs.

        + * + * @param length Specifies the number of bytes being cleared in the request body. + * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} + * @return A response of {@link FileUploadInfo file upload info} that only contains headers and response status code + */ + public Mono> clearRangeWithResponse(long length, long offset) { + return withContext(context -> clearRangeWithResponse(length, offset, context)); + } + + Mono> clearRangeWithResponse(long length, long offset, Context context) { + FileRange range = new FileRange(offset, offset + length - 1); + return postProcessResponse(azureFileStorageClient.files() + .uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.CLEAR, 0L, + null, null, null, context)) + .map(this::uploadResponse); } /** @@ -521,7 +816,7 @@ public Mono uploadFromFile(String uploadFilePath) { * *

        Upload the file from the source file path.

        * - * (@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile#string-filerangewritetype} + * (@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile#string} * *

        For more information, see the * Azure Docs Create File @@ -529,25 +824,16 @@ public Mono uploadFromFile(String uploadFilePath) { * Azure Docs Upload.

        * * @param uploadFilePath The path where store the source file to upload - * @param type You may specify one of the following options: - *
          - *
        • Update: Writes the bytes specified by the request body into the specified range.
        • - *
        • 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.
        • - *
            - * * @return An empty response. * @throws UncheckedIOException If an I/O error occurs. */ - public Mono uploadFromFile(String uploadFilePath, FileRangeWriteType type) { - AsynchronousFileChannel channel = channelSetup(uploadFilePath); - return Flux.fromIterable(sliceFile(uploadFilePath)) - .flatMap(chunk -> { - return upload(FluxUtil.byteBufStreamFromFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start(), type) - .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) - .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException); - }) - .then() - .doOnTerminate(() -> channelCleanUp(channel)); + public Mono uploadFromFile(String uploadFilePath) { + return Mono.using(() -> channelSetup(uploadFilePath, StandardOpenOption.READ), + channel -> Flux.fromIterable(sliceFile(uploadFilePath)).flatMap(chunk -> upload(FluxUtil.readFile(channel, + chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start()) + .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) + .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException)) + .then(), this::channelCleanUp); } private List sliceFile(String path) { @@ -578,9 +864,8 @@ private List sliceFile(String path) { * * @return {@link FileRange ranges} in the files. */ - public Flux listRanges() { - return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, snapshot, null, null, Context.NONE) - .flatMapMany(this::convertListRangesResponseToFileRangeInfo); + public PagedFlux listRanges() { + return listRanges(null); } /** @@ -598,10 +883,19 @@ public Flux listRanges() { * @param range Optional byte range which returns file data only from the specified range. * @return {@link FileRange ranges} in the files that satisfy the requirements */ - public Flux listRanges(FileRange range) { + public PagedFlux listRanges(FileRange range) { String rangeString = range == null ? null : range.toString(); - return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, snapshot, null, rangeString, Context.NONE) - .flatMapMany(this::convertListRangesResponseToFileRangeInfo); + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.files() + .getRangeListWithRestResponseAsync(shareName, filePath, snapshot, null, rangeString, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value().stream().map(FileRange::new).collect(Collectors.toList()), + null, + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -618,7 +912,7 @@ public Flux listRanges(FileRange range) { * * @return {@link HandleItem handles} in the files that satisfy the requirements */ - public Flux listHandles() { + public PagedFlux listHandles() { return listHandles(null); } @@ -637,15 +931,24 @@ public Flux listHandles() { * @param maxResults Optional maximum number of results will return per page * @return {@link HandleItem handles} in the file that satisfy the requirements */ - public Flux listHandles(Integer maxResults) { - return azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, null, maxResults, null, snapshot, Context.NONE) - .flatMapMany(response -> nextPageForHandles(response, maxResults)); + public PagedFlux listHandles(Integer maxResults) { + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.files() + .listHandlesWithRestResponseAsync(shareName, filePath, marker, maxResults, null, snapshot, + Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value().handleList(), + response.value().nextMarker(), + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** - * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileAsyncClient#listHandles()} (Integer)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 + * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link + * FileAsyncClient#listHandles()} (Integer)} . * *

            Code Samples

            * @@ -656,17 +959,29 @@ public Flux listHandles(Integer maxResults) { *

            For more information, see the * Azure Docs.

            * - * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. + * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all + * handles. * @return The counts of number of handles closed */ - public Flux forceCloseHandles(String handleId) { - return azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, null, snapshot, Context.NONE) - .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId)); + public PagedFlux forceCloseHandles(String handleId) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.files() + .forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, marker, + snapshot, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + Collections.singletonList(response.deserializedHeaders().numberOfHandlesClosed()), + response.deserializedHeaders().marker(), + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** - * Get snapshot id which attached to {@link FileAsyncClient}. - * Return {@code null} if no snapshot id attached. + * Get snapshot id which attached to {@link FileAsyncClient}. Return {@code null} if no snapshot id attached. * *

            Code Samples

            * @@ -674,40 +989,123 @@ public Flux forceCloseHandles(String handleId) { * * {@codesnippet com.azure.storage.file.fileAsyncClient.getShareSnapshotId} * - * @return The snapshot id which is a unique {@code DateTime} value that identifies the share snapshot to its base share. + * @return The snapshot id which is a unique {@code DateTime} value that identifies the share snapshot to its base + * share. */ public String getShareSnapshotId() { return this.snapshot; } - private Flux nextPageForForceCloseHandles(final FilesForceCloseHandlesResponse response, final String handleId) { - List handleCount = Arrays.asList(response.deserializedHeaders().numberOfHandlesClosed()); + /** + * Generates a SAS token with the specified parameters + * + * @param permissions The {@code FileSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(FileSASPermission permissions, OffsetDateTime expiryTime) { + return this.generateSAS(null, permissions, expiryTime, null /* startTime */, /* identifier */ null /* + version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* contentLanguage*/, + null /* contentEncoding */, null /* contentLanguage */, null /* contentType */); + } - if (response.deserializedHeaders().marker() == null) { - return Flux.fromIterable(handleCount); - } - Mono listResponse = azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, response.deserializedHeaders().marker(), snapshot, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForForceCloseHandles(newResponse, handleId)); - return Flux.fromIterable(handleCount).concatWith(fileRefPublisher); + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier) { + return this.generateSAS(identifier, null /* permissions */, null /* expiryTime */, null /* startTime */, + null /* version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* + contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, null /* contentType */); } - private Flux nextPageForHandles(final FilesListHandlesResponse response, final Integer maxResults) { - List handleItems = response.value().handleList(); + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code FileSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, FileSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { + return this.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange, null + /* cacheControl */, null /* contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, + null /* contentType */); + } - if (response.value().nextMarker() == null) { - return Flux.fromIterable(handleItems); - } + /** + * Generates a SAS token with the specified parameters + * + *

            Code Samples

            + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.generateSAS#String-FileSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code FileSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @param cacheControl An optional {@code String} cache-control header for the SAS. + * @param contentDisposition An optional {@code String} content-disposition header for the SAS. + * @param contentEncoding An optional {@code String} content-encoding header for the SAS. + * @param contentLanguage An optional {@code String} content-language header for the SAS. + * @param contentType An optional {@code String} content-type header for the SAS. + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, FileSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { - Mono listResponse = azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, response.value().nextMarker(), maxResults, null, snapshot, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResults)); - return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); + FileServiceSASSignatureValues fileServiceSASSignatureValues = new FileServiceSASSignatureValues(version, sasProtocol, + startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, identifier, + cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + + SharedKeyCredential sharedKeyCredential = + Utility.getSharedKeyCredential(this.azureFileStorageClient.getHttpPipeline()); + + Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); + + FileServiceSASSignatureValues values = configureServiceSASSignatureValues(fileServiceSASSignatureValues, + sharedKeyCredential.accountName()); + + FileServiceSASQueryParameters fileServiceSasQueryParameters = values.generateSASQueryParameters(sharedKeyCredential); + + return fileServiceSasQueryParameters.encode(); + } + + /** + * Sets fileServiceSASSignatureValues parameters dependent on the current file type + */ + FileServiceSASSignatureValues configureServiceSASSignatureValues(FileServiceSASSignatureValues fileServiceSASSignatureValues, + String accountName) { + + // Set canonical name + fileServiceSASSignatureValues.canonicalName(this.shareName, this.filePath, accountName); + + // Set resource + fileServiceSASSignatureValues.resource(Constants.UrlConstants.SAS_FILE_CONSTANT); + + return fileServiceSASSignatureValues; } private Response createFileInfoResponse(final FilesCreateResponse response) { String eTag = response.deserializedHeaders().eTag(); OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); + FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted, smbProperties); return new SimpleResponse<>(response, fileInfo); } @@ -720,13 +1118,15 @@ private Response startCopyResponse(final FilesStartCopyResponse re return new SimpleResponse<>(response, fileCopyInfo); } - private Response setHttpHeadersResponse(final FilesSetHTTPHeadersResponse response) { + private Response setPropertiesResponse(final FilesSetHTTPHeadersResponse response) { String eTag = response.deserializedHeaders().eTag(); OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); + FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted, smbProperties); return new SimpleResponse<>(response, fileInfo); } + private Response downloadWithPropertiesResponse(final FilesDownloadResponse response) { String eTag = response.deserializedHeaders().eTag(); OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); @@ -734,8 +1134,9 @@ private Response downloadWithPropertiesResponse(final FilesDow Long contentLength = response.deserializedHeaders().contentLength(); String contentType = response.deserializedHeaders().contentType(); String contentRange = response.deserializedHeaders().contentRange(); - Flux body = response.value(); - FileDownloadInfo fileDownloadInfo = new FileDownloadInfo(eTag, lastModified, metadata, contentLength, contentType, contentRange, body); + Flux body = response.value(); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); + FileDownloadInfo fileDownloadInfo = new FileDownloadInfo(eTag, lastModified, metadata, contentLength, contentType, contentRange, body, smbProperties); return new SimpleResponse<>(response, fileDownloadInfo); } @@ -763,9 +1164,10 @@ private Response getPropertiesResponse(final FilesGetPropertiesR String copySource = headers.copySource(); CopyStatusType copyStatus = headers.copyStatus(); Boolean isServerEncrpted = headers.isServerEncrypted(); + FileSmbProperties smbProperties = new FileSmbProperties(response.headers()); FileProperties fileProperties = new FileProperties(eTag, lastModified, metadata, fileType, contentLength, contentType, contentMD5, contentEncoding, cacheControl, contentDisposition, copyCompletionTime, copyStatusDescription, - copyId, copyProgress, copySource, copyStatus, isServerEncrpted); + copyId, copyProgress, copySource, copyStatus, isServerEncrpted, smbProperties); return new SimpleResponse<>(response, fileProperties); } @@ -790,14 +1192,4 @@ private Response setMetadataResponse(final FilesSetMetadataRes FileMetadataInfo fileMetadataInfo = new FileMetadataInfo(eTag, isServerEncrypted); return new SimpleResponse<>(response, fileMetadataInfo); } - - private Flux convertListRangesResponseToFileRangeInfo(FilesGetRangeListResponse response) { - List fileRanges = new ArrayList<>(); - response.value().forEach(range -> { - long start = range.start(); - long end = range.end(); - fileRanges.add(new FileRange(start, end)); - }); - return Flux.fromIterable(fileRanges); - } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java index b8de3708e898..a0869e95e69f 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java @@ -3,8 +3,12 @@ package com.azure.storage.file; +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.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileCopyInfo; @@ -14,14 +18,16 @@ import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; import com.azure.storage.file.models.FileRange; -import com.azure.storage.file.models.FileRangeWriteType; import com.azure.storage.file.models.FileUploadInfo; import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; +import com.azure.storage.file.models.StorageException; +import reactor.core.publisher.Flux; + import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.file.FileAlreadyExistsException; +import java.time.OffsetDateTime; import java.util.Map; -import reactor.core.publisher.Flux; /** * This class provides a client that contains all the operations for interacting files under Azure Storage File Service. @@ -72,11 +78,11 @@ public URL getFileUrl() { * Azure Docs.

            * * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @return A response containing the file info and the status of creating the file. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. + * @return The {@link FileInfo file info} + * @throws StorageException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. */ - public Response create(long maxSize) { - return fileAsyncClient.create(maxSize).block(); + public FileInfo create(long maxSize) { + return createWithResponse(maxSize, null, null, null, null, Context.NONE).value(); } /** @@ -84,22 +90,46 @@ public Response create(long maxSize) { * *

            Code Samples

            * - *

            Create the file with length of 1024 bytes, some headers and metadata.

            + *

            Create the file with length of 1024 bytes, some headers, file smb properties and metadata.

            * - * {@codesnippet com.azure.storage.file.fileClient.create#long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map-context} * *

            For more information, see the * Azure Docs.

            * * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @param httpHeaders Additional parameters for the operation. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file. + * @param metadata Optional name-value pairs associated with the file as metadata. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileInfo file info} and the status of creating the file. + * @throws StorageException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. + */ + public Response createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission, Map metadata, Context context) { + return fileAsyncClient.createWithResponse(maxSize, httpHeaders, smbProperties, filePermission, metadata, context).block(); + } + + /** + * Copies a blob or file to a destination file within the storage account. + * + *

            Code Samples

            + * + *

            Copy file from source getDirectoryUrl to the {@code resourcePath}

            + * + * {@codesnippet com.azure.storage.file.fileClient.startCopy#string-map} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. * @see C# identifiers - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. + * @return The {@link FileCopyInfo file copy info} */ - public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return fileAsyncClient.create(maxSize, httpHeaders, metadata).block(); + public FileCopyInfo startCopy(String sourceUrl, Map metadata) { + return startCopyWithResponse(sourceUrl, metadata, Context.NONE).value(); } /** @@ -107,9 +137,9 @@ public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map< * *

            Code Samples

            * - *

            Copy file from source getDirectoryUrl to the {@code filePath}

            + *

            Copy file from source getDirectoryUrl to the {@code resourcePath}

            * - * {@codesnippet com.azure.storage.file.fileClient.startCopy#string-map} + * {@codesnippet com.azure.storage.file.fileClient.startCopyWithResponse#string-map-Context} * *

            For more information, see the * Azure Docs.

            @@ -117,10 +147,11 @@ public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map< * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. * @see C# identifiers - * @return A response containing the file copy info and the status of copying the file. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileCopyInfo file copy info} and the status of copying the file. */ - public Response startCopy(String sourceUrl, Map metadata) { - return fileAsyncClient.startCopy(sourceUrl, metadata).block(); + public Response startCopyWithResponse(String sourceUrl, Map metadata, Context context) { + return fileAsyncClient.startCopyWithResponse(sourceUrl, metadata, context).block(); } /** @@ -136,14 +167,36 @@ public Response startCopy(String sourceUrl, Map me * Azure Docs.

            * * @param copyId Specifies the copy id which has copying pending status associate with it. + */ + public void abortCopy(String copyId) { + abortCopyWithResponse(copyId, Context.NONE); + } + + /** + * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. + * + *

            Code Samples

            + * + *

            Abort copy file from copy id("someCopyId")

            + * + * {@codesnippet com.azure.storage.file.fileClient.abortCopyWithResponse#string-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param copyId Specifies the copy id which has copying pending status associate with it. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the status of aborting copy the file. */ - public VoidResponse abortCopy(String copyId) { - return fileAsyncClient.abortCopy(copyId).block(); + public VoidResponse abortCopyWithResponse(String copyId, Context context) { + return fileAsyncClient.abortCopyWithResponse(copyId, context).block(); } /** - * Downloads a file from the system, including its metadata and properties + * Downloads a file from the system, including its metadata and properties 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.

            * *

            Code Samples

            * @@ -161,7 +214,10 @@ public void downloadToFile(String downloadFilePath) { } /** - * Downloads a file from the system, including its metadata and properties + * Downloads a file from the system, including its metadata and properties 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.

            * *

            Code Samples

            * @@ -191,10 +247,10 @@ public void downloadToFile(String downloadFilePath, FileRange range) { *

            For more information, see the * Azure Docs.

            * - * @return A response that only contains headers and response status code + * @return The {@link FileDownloadInfo file download info} */ - public Response downloadWithProperties() { - return fileAsyncClient.downloadWithProperties(null, null).block(); + public FileDownloadInfo downloadWithProperties() { + return downloadWithPropertiesWithResponse(null, null, Context.NONE).value(); } /** @@ -204,17 +260,18 @@ public Response downloadWithProperties() { * *

            Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

            * - * {@codesnippet com.azure.storage.file.fileClient.downloadWithProperties#filerange-boolean} + * {@codesnippet com.azure.storage.file.fileClient.downloadWithPropertiesWithResponse#filerange-boolean-Context} * *

            For more information, see the * Azure Docs.

            * * @param range Optional byte range which returns file data only from the specified range. * @param rangeGetContentMD5 Optional boolean which the service returns the MD5 hash for the range when it sets to true, as long as the range is less than or equal to 4 MB in size. - * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileDownloadInfo file download info} headers and response status code */ - public Response downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { - return fileAsyncClient.downloadWithProperties(range, rangeGetContentMD5).block(); + public Response downloadWithPropertiesWithResponse(FileRange range, Boolean rangeGetContentMD5, Context context) { + return fileAsyncClient.downloadWithPropertiesWithResponse(range, rangeGetContentMD5, context).block(); } /** @@ -229,11 +286,31 @@ public Response downloadWithProperties(FileRange range, Boolea *

            For more information, see the * Azure Docs.

            * + * @throws StorageException If the directory doesn't exist or the file doesn't exist. + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + + /** + * Deletes the file associate with the client. + * + *

            Code Samples

            + * + *

            Delete the file

            + * + * {@codesnippet com.azure.storage.file.fileClient.deleteWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the directory doesn't exist or the file doesn't exist. */ - public VoidResponse delete() { - return fileAsyncClient.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return fileAsyncClient.deleteWithResponse(context).block(); } /** @@ -249,10 +326,30 @@ public VoidResponse delete() { *

            For more information, see the * Azure Docs.

            * - * @return Storage file properties + * @return {@link FileProperties Storage file properties} + */ + public FileProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the storage account's file. + * The properties includes file metadata, last modified date, is server encrypted, and eTag. + * + *

            Code Samples

            + * + *

            Retrieve file properties

            + * + * {@codesnippet com.azure.storage.file.fileClient.getPropertiesWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileProperties Storage file properties} with headers and status code */ - public Response getProperties() { - return fileAsyncClient.getProperties().block(); + public Response getPropertiesWithResponse(Context context) { + return fileAsyncClient.getPropertiesWithResponse(context).block(); } /** @@ -264,22 +361,56 @@ public Response getProperties() { * *

            Set the httpHeaders of contentType of "text/plain"

            * - * {@codesnippet com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders} + * {@codesnippet com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string} * - *

            Clear the httpHeaders of the file

            + *

            Clear the httpHeaders of the file and preserve the SMB properties

            * - * {@codesnippet com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders} + * {@codesnippet com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties} * *

            For more information, see the * Azure Docs.

            * * @param newFileSize New file size of the file - * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @return Response of the information about the file + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file + * @return The {@link FileInfo file info} * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public Response setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - return fileAsyncClient.setHttpHeaders(newFileSize, httpHeaders).block(); + public FileInfo setProperties(long newFileSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission) { + return setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission, Context.NONE).value(); + } + + /** + * Sets the user-defined httpHeaders to associate to the file. + * + *

            If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

            + * + *

            Code Samples

            + * + *

            Set the httpHeaders of contentType of "text/plain"

            + * + * {@codesnippet com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-Context} + * + *

            Clear the httpHeaders of the file and preserve the SMB properties

            + * + * {@codesnippet com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-Context.clearHttpHeaderspreserveSMBProperties} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param newFileSize New file size of the file + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return Response containing the {@link FileInfo file info} with headers and status code + * @throws IllegalArgumentException thrown if parameters fail the validation. + */ + public Response setPropertiesWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Context context) { + return fileAsyncClient.setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission, context).block(); } /** @@ -301,32 +432,81 @@ public Response setHttpHeaders(long newFileSize, FileHTTPHeaders httpH * Azure Docs.

            * * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared - * @return information about the file - * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys + * @return The {@link FileMetadataInfo file meta info} + * @throws StorageException If the file doesn't exist or the metadata contains invalid keys + */ + public FileMetadataInfo setMetadata(Map metadata) { + return setMetadataWithResponse(metadata, Context.NONE).value(); + } + + /** + * Sets the user-defined metadata to associate to the file. + * + *

            If {@code null} is passed for the metadata it will clear the metadata associated to the file.

            + * + *

            Code Samples

            + * + *

            Set the metadata to "file:updatedMetadata"

            + * + * {@codesnippet com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context} + * + *

            Clear the metadata of the file

            + * + * {@codesnippet com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context.clearMetadata} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return Response containing the {@link FileMetadataInfo file meta info} with headers and status code + * @throws StorageException If the file doesn't exist or the metadata contains invalid keys */ - public Response setMetadata(Map metadata) { - return fileAsyncClient.setMetadata(metadata).block(); + public Response setMetadataWithResponse(Map metadata, Context context) { + return fileAsyncClient.setMetadataWithResponse(metadata, context).block(); } /** + * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

            Code Samples

            + * + *

            Upload data "default" to the file in Storage File Service.

            + * + * {@codesnippet com.azure.storage.file.fileClient.upload#bytebuffer-long} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. + * @return The {@link FileUploadInfo file upload info} + * @throws StorageException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public FileUploadInfo upload(ByteBuffer data, long length) { + return uploadWithResponse(data, length, Context.NONE).value(); + } + + /** * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. * *

            Code Samples

            * *

            Upload "default" to the file.

            * - * {@codesnippet com.azure.storage.file.fileClient.upload#flux-long} + * {@codesnippet com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-Context} * *

            For more information, see the * Azure Docs.

            * * @param data The data which will upload to the storage file. * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The {@link FileUploadInfo file upload info} + * @throws StorageException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Response upload(ByteBuf data, long length) { - return fileAsyncClient.upload(Flux.just(data), length).block(); + public Response uploadWithResponse(ByteBuffer data, long length, Context context) { + return fileAsyncClient.uploadWithResponse(Flux.just(data), length, context).block(); } /** @@ -334,46 +514,62 @@ public Response upload(ByteBuf data, long length) { * *

            Code Samples

            * - *

            Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

            + *

            Upload data "default" starting from 1024.

            * - * {@codesnippet com.azure.storage.file.fileClient.upload#bytebuf-long-int-filerangewritetype} + * {@codesnippet com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-long-Context} * *

            For more information, see the * Azure Docs.

            * * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} - * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. - * @param type You may specify one of the following options: - *
              - *
            • Update: Writes the bytes specified by the request body into the specified range.
            • - *
            • 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.
            • - *
                - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code + * @throws StorageException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Response upload(ByteBuf data, long length, int offset, FileRangeWriteType type) { - return fileAsyncClient.upload(Flux.just(data), length, offset, type).block(); + public Response uploadWithResponse(ByteBuffer data, long length, long offset, Context context) { + return fileAsyncClient.uploadWithResponse(Flux.just(data), length, offset, context).block(); } /** - * Uploads file to storage file service. + * Clears a range of bytes to specific of a file in storage file service. Clear operations performs an in-place write on the specified file. * *

                Code Samples

                * - *

                Upload the file from the source file path.

                + *

                Clears the first 1024 bytes.

                * - * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile#string} + * {@codesnippet com.azure.storage.file.fileClient.clearRange#long} * *

                For more information, see the - * Azure Docs Create File - * and - * Azure Docs Upload.

                + * Azure Docs.

                * - * @param uploadFilePath The path where store the source file to upload + * @param length Specifies the number of bytes being cleared. + * @return The {@link FileUploadInfo file upload info} */ - public void uploadFromFile(String uploadFilePath) { - uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); + public FileUploadInfo clearRange(long length) { + return clearRangeWithResponse(length, 0, Context.NONE).value(); + } + + /** + * Clears a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

                Code Samples

                + * + *

                Clear the range starting from 1024 with length of 1024.

                + * + * {@codesnippet com.azure.storage.file.fileClient.clearRangeWithResponse#long-long-Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param length Specifies the number of bytes being transmitted in the request body. + * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code + */ + public Response clearRangeWithResponse(long length, long offset, Context context) { + return fileAsyncClient.clearRangeWithResponse(length, offset, context).block(); } /** @@ -381,9 +577,9 @@ public void uploadFromFile(String uploadFilePath) { * *

                Code Samples

                * - *

                Upload the file from the source file path.

                + *

                Upload the file from the source file path.

                * - * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype} + * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile#string} * *

                For more information, see the * Azure Docs Create File @@ -391,14 +587,9 @@ public void uploadFromFile(String uploadFilePath) { * Azure Docs Upload.

                * * @param uploadFilePath The path where store the source file to upload - * @param type You may specify one of the following options: - *
                  - *
                • Update: Writes the bytes specified by the request body into the specified range.
                • - *
                • 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.
                • - *
                    */ - public void uploadFromFile(String uploadFilePath, FileRangeWriteType type) { - fileAsyncClient.uploadFromFile(uploadFilePath, type).block(); + public void uploadFromFile(String uploadFilePath) { + fileAsyncClient.uploadFromFile(uploadFilePath).block(); } /** @@ -415,8 +606,8 @@ public void uploadFromFile(String uploadFilePath, FileRangeWriteType type) { * * @return {@link FileRange ranges} in the files. */ - public Iterable listRanges() { - return fileAsyncClient.listRanges(null).toIterable(); + public PagedIterable listRanges() { + return listRanges(null); } /** @@ -434,8 +625,8 @@ public Iterable listRanges() { * @param range Optional byte range which returns file data only from the specified range. * @return {@link FileRange ranges} in the files that satisfy the requirements */ - public Iterable listRanges(FileRange range) { - return fileAsyncClient.listRanges(range).toIterable(); + public PagedIterable listRanges(FileRange range) { + return new PagedIterable<>(fileAsyncClient.listRanges(range)); } /** @@ -452,7 +643,7 @@ public Iterable listRanges(FileRange range) { * * @return {@link HandleItem handles} in the files that satisfy the requirements */ - public Iterable listHandles() { + public PagedIterable listHandles() { return listHandles(null); } @@ -471,14 +662,12 @@ public Iterable listHandles() { * @param maxResults Optional max number of results returned per page * @return {@link HandleItem handles} in the file that satisfy the requirements */ - public Iterable listHandles(Integer maxResults) { - return fileAsyncClient.listHandles(maxResults).toIterable(); + public PagedIterable listHandles(Integer maxResults) { + return new PagedIterable<>(fileAsyncClient.listHandles(maxResults)); } /** * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileClient#listHandles()} (Integer)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 * *

                    Code Samples

                    * @@ -492,8 +681,10 @@ public Iterable listHandles(Integer maxResults) { * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. * @return The counts of number of handles closed */ - public Iterable forceCloseHandles(String handleId) { - return fileAsyncClient.forceCloseHandles(handleId).toIterable(); + public PagedIterable forceCloseHandles(String handleId) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github Issue 4525 + return new PagedIterable<>(fileAsyncClient.forceCloseHandles(handleId)); } /** @@ -511,5 +702,75 @@ public Iterable forceCloseHandles(String handleId) { public String getShareSnapshotId() { return fileAsyncClient.getShareSnapshotId(); } + + /** + * Generates a SAS token with the specified parameters + * + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param permissions The {@code FileSASPermission} permission for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(OffsetDateTime expiryTime, FileSASPermission permissions) { + return this.fileAsyncClient.generateSAS(permissions, expiryTime); + } + + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier) { + return this.fileAsyncClient.generateSAS(identifier); + } + + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code FileSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, FileSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { + return this.fileAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange); + } + + /** + * Generates a SAS token with the specified parameters + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.FileClient.generateSAS#String-FileSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code FileSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @param cacheControl An optional {@code String} cache-control header for the SAS. + * @param contentDisposition An optional {@code String} content-disposition header for the SAS. + * @param contentEncoding An optional {@code String} content-encoding header for the SAS. + * @param contentLanguage An optional {@code String} content-language header for the SAS. + * @param contentType An optional {@code String} content-type header for the SAS. + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, FileSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { + return this.fileAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java index 24ae291a5048..dc75ad5096d5 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java @@ -3,44 +3,33 @@ package com.azure.storage.file; -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.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.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; import java.util.Arrays; -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 FileClient FileClients} - * and {@link FileAsyncClient FileAsyncClients}, calling {@link FileClientBuilder#buildClient() buildClient} - * constructs an instance of FileClient and calling {@link FileClientBuilder#buildAsyncClient() buildAsyncClient} - * constructs an instance of FileAsyncClient. + * This class provides a fluent builder API to help aid the configuration and instantiation of the + * {@link FileClient FileClients}, {@link FileAsyncClient FileAsyncClients}, {@link DirectoryClient DirectoryClients}, + * and {@link DirectoryAsyncClient DirectoryAsyncClients}. Calling {@link FileClientBuilder#buildFileClient() buildFileClient}, + * {@link FileClientBuilder#buildFileAsyncClient() buildFileAsyncClient}, + * {@link FileClientBuilder#buildDirectoryClient() buildDirectoryClient}, or + * {@link FileClientBuilder#buildDirectoryAsyncClient() buildDirectoryAsyncClient} constructs an instance of {@link FileClient}, + * {@link FileAsyncClient}, {@link DirectoryClient}, or {@link DirectoryAsyncClient} respectively. * *

                    The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. * {@link FileClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * {@link FileClientBuilder#shareName(String)}, {@link FileClientBuilder#filePath(String)} and a {@link SASTokenCredential} that authorizes the client.

                    + * {@link FileClientBuilder#shareName(String)}, {@link FileClientBuilder#resourcePath(String)} and a {@link SASTokenCredential} that authorizes the client.

                    * *

                    Instantiating a synchronous File Client with SAS token

                    * {@codesnippet com.azure.storage.file.fileClient.instantiation.sastoken} @@ -71,91 +60,98 @@ * @see SASTokenCredential * @see SharedKeyCredential */ -public class FileClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private final List policies; - private final RetryPolicy retryPolicy; +@ServiceClientBuilder(serviceClients = {FileClient.class, FileAsyncClient.class, DirectoryClient.class, + DirectoryAsyncClient.class}) +public class FileClientBuilder extends BaseFileClientBuilder { + + private final ClientLogger logger = new ClientLogger(FileClientBuilder.class); - private HttpLogDetailLevel logLevel; - private Configuration configuration; - private URL endpoint; private String shareName; - private String filePath; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private String snapshot; + private String shareSnapshot; + private String resourcePath; /** * Creates a builder instance that is able to configure and construct {@link FileClient FileClients} * and {@link FileAsyncClient FileAsyncClients}. */ - public FileClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); + public FileClientBuilder() { } + + private AzureFileStorageImpl constructImpl() { + Objects.requireNonNull(shareName); + Objects.requireNonNull(resourcePath); + + if (!super.hasCredential()) { + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); + } + + HttpPipeline pipeline = super.getPipeline(); + if (pipeline == null) { + pipeline = super.buildPipeline(); + } - configuration = ConfigurationManager.getConfiguration(); + return new AzureFileStorageBuilder() + .url(super.endpoint) + .pipeline(pipeline) + .build(); } /** - * Creates a {@link FileAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is - * called a new instance of {@link FileAsyncClient} is created. + * Creates a {@link DirectoryAsyncClient} based on options set in the builder. Every time {@code buildFileAsyncClient()} is + * called a new instance of {@link DirectoryAsyncClient} is created. * *

                    * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the - * {@link FileAsyncClient client}. All other builder settings are ignored. + * {@link DirectoryAsyncClient client}. All other builder settings are ignored. *

                    * * @return A ShareAsyncClient with the options set from the builder. - * @throws NullPointerException If {@code shareName} is {@code null} or the (@code filePath) is {@code null}. + * @throws NullPointerException If {@code shareName} is {@code null} or {@code shareName} is {@code null}. * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. */ - public FileAsyncClient buildAsyncClient() { - Objects.requireNonNull(shareName); - Objects.requireNonNull(filePath); - - if (pipeline != null) { - return new FileAsyncClient(endpoint, pipeline, shareName, filePath, snapshot); - } - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); + public DirectoryAsyncClient buildDirectoryAsyncClient() { + return new DirectoryAsyncClient(constructImpl(), shareName, resourcePath, shareSnapshot); + } - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); + /** + * Creates a {@link DirectoryClient} based on options set in the builder. Every time {@code buildDirectoryClient()} is + * called a new instance of {@link DirectoryClient} is created. + * + *

                    + * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the + * {@link DirectoryClient client}. All other builder settings are ignored. + *

                    + * + * @return A DirectoryClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code directoryPath} is {@code null}. + * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public DirectoryClient buildDirectoryClient() { + return new DirectoryClient(this.buildDirectoryAsyncClient()); + } - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); + /** + * Creates a {@link FileAsyncClient} based on options set in the builder. Every time {@code buildFileAsyncClient()} is + * called a new instance of {@link FileAsyncClient} is created. + * + *

                    + * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the + * {@link FileAsyncClient client}. All other builder settings are ignored. + *

                    + * + * @return A ShareAsyncClient with the options set from the builder. + * @throws NullPointerException If {@code shareName} is {@code null} or the (@code resourcePath) is {@code null}. + * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public FileAsyncClient buildFileAsyncClient() { - return new FileAsyncClient(endpoint, pipeline, shareName, filePath, snapshot); + return new FileAsyncClient(constructImpl(), shareName, resourcePath, shareSnapshot); } /** - * Creates a {@link FileClient} based on options set in the builder. Every time {@code buildClient()} is + * Creates a {@link FileClient} based on options set in the builder. Every time {@code buildFileClient()} is * called a new instance of {@link FileClient} is created. * *

                    @@ -165,11 +161,11 @@ public FileAsyncClient buildAsyncClient() { *

                    * * @return A FileClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code filePath} is {@code null}. + * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code resourcePath} is {@code null}. * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. */ - public FileClient buildClient() { - return new FileClient(this.buildAsyncClient()); + public FileClient buildFileClient() { + return new FileClient(this.buildFileAsyncClient()); } /** @@ -186,85 +182,31 @@ public FileClient buildClient() { * @return the updated FileClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL */ + @Override public FileClientBuilder endpoint(String 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 share name and file path from the URL passed String[] pathSegments = fullURL.getPath().split("/"); int length = pathSegments.length; this.shareName = length >= 2 ? pathSegments[1] : this.shareName; String[] filePathParams = length >= 3 ? Arrays.copyOfRange(pathSegments, 2, length) : null; - this.filePath = filePathParams != null ? String.join("/", filePathParams) : this.filePath; + this.resourcePath = filePathParams != null ? String.join("/", filePathParams) : this.resourcePath; // 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; + SASTokenCredential sasTokenCredential = SASTokenCredential.fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage File endpoint url is malformed.")); } return this; } - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public FileClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - return this; - } - - /** - * Sets the {@link SharedKeyCredential} used to authenticate requests sent to the File service. - * - * @param credential Shared key credential generated from the Storage account that authorizes requests - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public FileClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.sasTokenCredential = null; - return this; - } - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public FileClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map 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.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); - } - } - /** * Sets the share that the constructed clients will interact with * @@ -278,89 +220,27 @@ public FileClientBuilder shareName(String shareName) { } /** - * Sets the file that the constructed clients will interact with - * - * @param filePath Path of the file, mush end up with the file name. - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code filePath} is {@code null}. - */ - public FileClientBuilder filePath(String filePath) { - this.filePath = filePath; - return this; - } - - /** - * 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 FileClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public FileClientBuilder 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 FileClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public FileClientBuilder 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 FileClientBuilder object. - */ - public FileClientBuilder 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 FileClientBuilder#endpoint(String) endpoint}, - * {@link FileClientBuilder#shareName(String) shareName} @{link FileClientBuilder#filePath(String) filePath}, and {@link FileClientBuilder#snapshot(String) snaphotShot} - * when building clients.

                    + * Sets the shareSnapshot that the constructed clients will interact with. This shareSnapshot must be linked to the share + * that has been specified in the builder. * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated FileClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public FileClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(pipeline); - 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 builder, defaults to Configuration.NONE - * @param configuration configuration store + * @param snapshot Identifier of the shareSnapshot * @return the updated FileClientBuilder object + * @throws NullPointerException If {@code shareSnapshot} is {@code null}. */ - public FileClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; + public FileClientBuilder snapshot(String snapshot) { + this.shareSnapshot = snapshot; return this; } /** - * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share - * that has been specified in the builder. + * Sets the file that the constructed clients will interact with * - * @param snapshot Identifier of the snapshot + * @param resourcePath Path of the file (or directory). * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code snapshot} is {@code null}. + * @throws NullPointerException If {@code resourcePath} is {@code null}. */ - public FileClientBuilder snapshot(String snapshot) { - this.snapshot = snapshot; + public FileClientBuilder resourcePath(String resourcePath) { + this.resourcePath = resourcePath; return this; } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileConstants.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileConstants.java new file mode 100644 index 000000000000..1c736d4406d8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileConstants.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +/** + * Holds the Constants used for the File Service. + */ +public final class FileConstants { + /** + * Default header value for file permission. + */ + public static final String FILE_PERMISSION_INHERIT = "Inherit"; + + /** + * Default file attribute value for files. + */ + public static final String FILE_ATTRIBUTES_NONE = "None"; + + /** + * Default file creation and file last write time. + */ + public static final String FILE_TIME_NOW = "Now"; + + /** + * Default value for several SMB file headers. + */ + public static final String PRESERVE = "Preserve"; + + /** + * Stores a reference to the date/time pattern expected for File SMB properties + */ + public static final String SMB_DATE_STRING = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"; + + static final class HeaderConstants { + /** + * Header that specifies file permission key. + */ + public static final String FILE_PERMISSION_KEY = "x-ms-file-permission-key"; + + /** + * Header that specifies file attributes. + */ + public static final String FILE_ATTRIBUTES = "x-ms-file-attributes"; + + /** + * Header that specifies file creation time. + */ + public static final String FILE_CREATION_TIME = "x-ms-file-creation-time"; + + /** + * Header that specifies file last write time. + */ + public static final String FILE_LAST_WRITE_TIME = "x-ms-file-last-write-time"; + + /** + * Header that specifies file change time. + */ + public static final String FILE_CHANGE_TIME = "x-ms-file-change-time"; + + /** + * Header that specifies file id. + */ + public static final String FILE_ID = "x-ms-file-id"; + + /** + * Header that spcifies file parent id. + */ + public static final String FILE_PARENT_ID = "x-ms-file-parent-id"; + + private HeaderConstants() { + } + } + + static final class MessageConstants { + public static final String FILE_PERMISSION_FILE_PERMISSION_KEY_INVALID = "File permission and file permission key cannot both be set"; + + private MessageConstants() { + } + } +} + diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileExtensions.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileExtensions.java new file mode 100644 index 000000000000..d482611e5eca --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileExtensions.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +import com.azure.storage.common.Constants; +import com.azure.storage.common.Utility; + +import java.nio.charset.StandardCharsets; + +public class FileExtensions { + + /** + * Verifies that the file permission and file permission key are not both set and if the file permission is set, + * the file permission is of valid length. + * @param filePermission The file permission. + * @param filePermissionKey The file permission key. + * @throws IllegalArgumentException for invalid file permission or file permission keys. + */ + public static void filePermissionAndKeyHelper(String filePermission, String filePermissionKey) { + if (filePermission != null && filePermissionKey != null) { + throw new IllegalArgumentException(FileConstants.MessageConstants.FILE_PERMISSION_FILE_PERMISSION_KEY_INVALID); + } + + if (filePermission != null) { + Utility.assertInBounds("filePermission", filePermission.getBytes(StandardCharsets.UTF_8).length, 0, 8 * Constants.KB); + } + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileSASPermission.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileSASPermission.java new file mode 100644 index 000000000000..05f6fb5d5baa --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileSASPermission.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +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 file. + * 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 FileServiceSASSignatureValues} 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 FileSASPermission { + private boolean read; + + private boolean create; + + private boolean write; + + private boolean delete; + + /** + * Initializes an {@code FileSASPermission} object with all fields set to false. + */ + public FileSASPermission() { + } + + /** + * Creates an {@code FileSASPermission} 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 FileSASPermission}. + * @return A {@code FileSASPermission} generated from the given {@code String}. + * @throws IllegalArgumentException If {@code permString} contains a character other than r, c, w, or d. + */ + public static FileSASPermission parse(String permString) { + FileSASPermission permissions = new FileSASPermission(); + + for (int i = 0; i < permString.length(); i++) { + char c = permString.charAt(i); + switch (c) { + case 'r': + permissions.read = true; + break; + case 'c': + permissions.create = true; + break; + case 'w': + permissions.write = true; + break; + case 'd': + permissions.delete = 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 read() { + return read; + } + + /** + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated FileSASPermission object + */ + public FileSASPermission read(boolean read) { + this.read = read; + return this; + } + + /** + * @return the create permission status + */ + public boolean create() { + return create; + } + + /** + * Sets the create permission status. + * + * @param create Permission status to set + * @return the updated FileSASPermission object + */ + public FileSASPermission create(boolean create) { + this.create = create; + return this; + } + + /** + * @return the write permission status + */ + public boolean write() { + return write; + } + + /** + * Sets the write permission status. + * + * @param write Permission status to set + * @return the updated FileSASPermission object + */ + public FileSASPermission write(boolean write) { + this.write = write; + return this; + } + + /** + * @return the delete permission status + */ + public boolean delete() { + return delete; + } + + /** + * Sets the delete permission status. + * + * @param delete Permission status to set + * @return the updated FileSASPermission object + */ + public FileSASPermission delete(boolean delete) { + this.delete = delete; + 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 FileSASPermission}. + */ + @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.create) { + builder.append('c'); + } + + if (this.write) { + builder.append('w'); + } + + if (this.delete) { + builder.append('d'); + } + + return builder.toString(); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java index e545c18965a5..7c60912f1fb3 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java @@ -3,33 +3,45 @@ package com.azure.storage.file; -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.implementation.util.ImplUtils; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.common.AccountSASPermission; +import com.azure.storage.common.AccountSASResourceType; +import com.azure.storage.common.AccountSASService; +import com.azure.storage.common.AccountSASSignatureValues; +import com.azure.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; +import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.implementation.AzureFileStorageBuilder; import com.azure.storage.file.implementation.AzureFileStorageImpl; import com.azure.storage.file.models.CorsRule; import com.azure.storage.file.models.DeleteSnapshotsOptionType; import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.ListSharesIncludeType; import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.ListSharesResponse; -import com.azure.storage.file.models.ServicesListSharesSegmentResponse; import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; +import reactor.core.publisher.Mono; + import java.net.MalformedURLException; import java.net.URL; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; +import java.util.function.Function; + +import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.file.PostProcessor.postProcessResponse; /** * This class provides a azureFileStorageClient that contains all the operations for interacting with a file account in Azure Storage. @@ -48,19 +60,16 @@ * @see SASTokenCredential */ public final class FileServiceAsyncClient { + private final ClientLogger logger = new ClientLogger(FileServiceAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; /** - * Creates a FileServiceClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. + * Creates a FileServiceClient from the passed {@link AzureFileStorageImpl implementation client}. * - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that the HTTP requests and responses flow through + * @param azureFileStorage Client that interacts with the service interfaces. */ - FileServiceAsyncClient(URL endpoint, HttpPipeline httpPipeline) { - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); + FileServiceAsyncClient(AzureFileStorageImpl azureFileStorage) { + this.azureFileStorageClient = azureFileStorage; } /** @@ -72,8 +81,8 @@ public URL getFileServiceUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -87,7 +96,21 @@ public URL getFileServiceUrl() { * @return a ShareAsyncClient that interacts with the specified share */ public ShareAsyncClient getShareAsyncClient(String shareName) { - return new ShareAsyncClient(azureFileStorageClient, shareName); + return this.getShareAsyncClient(shareName, null); + } + + /** + * Constructs a ShareAsyncClient that interacts with the specified share. + * + *

                    If the share doesn't exist in the storage account {@link ShareAsyncClient#create() create} in the azureFileStorageClient will + * need to be called before interaction with the share can happen.

                    + * + * @param shareName Name of the share + * @param snapshot Snapshot ID of the share + * @return a ShareAsyncClient that interacts with the specified share + */ + public ShareAsyncClient getShareAsyncClient(String shareName, String snapshot) { + return new ShareAsyncClient(azureFileStorageClient, shareName, snapshot); } /** @@ -104,7 +127,7 @@ public ShareAsyncClient getShareAsyncClient(String shareName) { * * @return {@link ShareItem Shares} in the storage account without their metadata or snapshots */ - public Flux listShares() { + public PagedFlux listShares() { return listShares(null); } @@ -136,7 +159,7 @@ public Flux listShares() { * @param options Options for listing shares * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements */ - public Flux listShares(ListSharesOptions options) { + public PagedFlux listShares(ListSharesOptions options) { return listShares(null, options); } @@ -147,15 +170,12 @@ public Flux listShares(ListSharesOptions options) { * @param options Options for listing shares * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements */ - private Flux listShares(String marker, ListSharesOptions options) { - String prefix = null; - Integer maxResults = null; + private PagedFlux listShares(String marker, ListSharesOptions options) { + final String prefix = (options != null) ? options.prefix() : null; + final Integer maxResults = (options != null) ? options.maxResults() : null; List include = new ArrayList<>(); if (options != null) { - prefix = options.prefix(); - maxResults = options.maxResults(); - if (options.includeMetadata()) { include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.METADATA.toString())); } @@ -165,31 +185,36 @@ private Flux listShares(String marker, ListSharesOptions options) { } } - return azureFileStorageClient.services().listSharesSegmentWithRestResponseAsync(prefix, marker, maxResults, include, null, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value().shareItems())); - } + Function>> retriever = + nextMarker -> postProcessResponse(this.azureFileStorageClient.services() + .listSharesSegmentWithRestResponseAsync(prefix, nextMarker, maxResults, include, null, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value().shareItems(), + response.value().nextMarker(), + response.deserializedHeaders())); - /* - * Helper function used to auto-enumerate through paged responses - */ - private Flux listShares(ServicesListSharesSegmentResponse response, List include, Context context) { - ListSharesResponse value = response.value(); - Mono result = azureFileStorageClient.services() - .listSharesSegmentWithRestResponseAsync(value.prefix(), value.marker(), value.maxResults(), include, null, context); - - return result.flatMapMany(r -> extractAndFetchShares(r, include, context)); + return new PagedFlux<>(() -> retriever.apply(marker), retriever); } - /* - * Helper function used to auto-enumerate through paged responses + /** + * Retrieves the properties of the storage account's File service. The properties range from storage analytics and + * metrics to CORS (Cross-Origin Resource Sharing). + * + *

                    Code Samples

                    + * + *

                    Retrieve File service properties

                    + * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.getProperties} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @return Storage account {@link FileServiceProperties File service properties} */ - private Publisher extractAndFetchShares(ServicesListSharesSegmentResponse response, List include, Context context) { - String nextPageLink = response.value().nextMarker(); - if (ImplUtils.isNullOrEmpty(nextPageLink)) { - return Flux.fromIterable(response.value().shareItems()); - } - - return Flux.fromIterable(response.value().shareItems()).concatWith(listShares(response, include, context)); + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -200,18 +225,56 @@ private Publisher extractAndFetchShares(ServicesListSharesSegmentResp * *

                    Retrieve File service properties

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.getProperties} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse} * *

                    For more information, see the * Azure Docs.

                    * - * @return Storage account File service properties + * @return A response containing the Storage account {@link FileServiceProperties File service properties} */ - public Mono> getProperties() { - return azureFileStorageClient.services().getPropertiesWithRestResponseAsync(Context.NONE) + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.services().getPropertiesWithRestResponseAsync(context)) .map(response -> new SimpleResponse<>(response, response.value())); } + /** + * Sets the properties for the storage account's File 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 FileServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. + * + *

                    Code Sample

                    + * + *

                    Enable Minute and Hour Metrics

                    + * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param properties Storage account File 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#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
                    • + *
                    + */ + public Mono setProperties(FileServiceProperties properties) { + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); + } + /** * Sets the properties for the storage account's File service. The properties range from storage analytics and * metric to CORS (Cross-Origin Resource Sharing). @@ -223,18 +286,18 @@ public Mono> getProperties() { * *

                    Clear CORS in the File service

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties.clearCORS} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS} * *

                    Enable Minute and Hour Metrics

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties} * *

                    For more information, see the * Azure Docs.

                    * * @param properties Storage account File 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
                    • @@ -246,8 +309,13 @@ public Mono> getProperties() { *
                    • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                    • *
                    */ - public Mono setProperties(FileServiceProperties properties) { - return azureFileStorageClient.services().setPropertiesWithRestResponseAsync(properties, Context.NONE) + public Mono setPropertiesWithResponse(FileServiceProperties properties) { + return withContext(context -> setPropertiesWithResponse(properties, context)); + } + + Mono setPropertiesWithResponse(FileServiceProperties properties, Context context) { + return postProcessResponse(azureFileStorageClient.services() + .setPropertiesWithRestResponseAsync(properties, context)) .map(VoidResponse::new); } @@ -264,11 +332,11 @@ public Mono setProperties(FileServiceProperties properties) { * Azure Docs.

                    * * @param shareName Name of the share - * @return A response containing the ShareAsyncClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists + * @return The {@link ShareAsyncClient ShareAsyncClient} + * @throws StorageException If a share with the same name already exists */ - public Mono> createShare(String shareName) { - return createShare(shareName, null, null); + public Mono createShare(String shareName) { + return createShareWithResponse(shareName, null, null).flatMap(FluxUtil::toMono); } /** @@ -279,11 +347,11 @@ public Mono> createShare(String shareName) { * *

                    Create the share "test" with metadata "share:metadata"

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.metadata} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata} * *

                    Create the share "test" with a quota of 10 GB

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.quota} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota} * *

                    For more information, see the * Azure Docs.

                    @@ -292,14 +360,18 @@ public Mono> createShare(String shareName) { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing the ShareAsyncClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the + * @return A response containing the {@link ShareAsyncClient ShareAsyncClient} and the status of creating the share. + * @throws StorageException If a share with the same name already exists or {@code quotaInGB} is outside the * allowed range. */ - public Mono> createShare(String shareName, Map metadata, Integer quotaInGB) { - ShareAsyncClient shareAsyncClient = new ShareAsyncClient(azureFileStorageClient, shareName); + public Mono> createShareWithResponse(String shareName, Map metadata, Integer quotaInGB) { + return withContext(context -> createShareWithResponse(shareName, metadata, quotaInGB, context)); + } + + Mono> createShareWithResponse(String shareName, Map metadata, Integer quotaInGB, Context context) { + ShareAsyncClient shareAsyncClient = new ShareAsyncClient(azureFileStorageClient, shareName, null); - return shareAsyncClient.create(metadata, quotaInGB) + return postProcessResponse(shareAsyncClient.createWithResponse(metadata, quotaInGB, context)) .map(response -> new SimpleResponse<>(response, shareAsyncClient)); } @@ -316,11 +388,11 @@ public Mono> createShare(String shareName, MapAzure Docs.

                    * * @param shareName Name of the share - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist + * @return An empty response + * @throws StorageException If the share doesn't exist */ - public Mono deleteShare(String shareName) { - return deleteShare(shareName, null); + public Mono deleteShare(String shareName) { + return deleteShareWithResponse(shareName, null).flatMap(FluxUtil::toMono); } /** @@ -331,7 +403,7 @@ public Mono deleteShare(String shareName) { * *

                    Delete the snapshot of share "test" that was created at current time.

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.deleteShare#string-string} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string} * *

                    For more information, see the * Azure Docs.

                    @@ -339,15 +411,65 @@ public Mono deleteShare(String shareName) { * @param shareName Name of the share * @param snapshot Identifier of the snapshot * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist + * @throws StorageException If the share doesn't exist or the snapshot doesn't exist */ - public Mono deleteShare(String shareName, String snapshot) { + public Mono deleteShareWithResponse(String shareName, String snapshot) { + return withContext(context -> deleteShareWithResponse(shareName, snapshot, context)); + } + + Mono deleteShareWithResponse(String shareName, String snapshot, Context context) { DeleteSnapshotsOptionType deleteSnapshots = null; if (ImplUtils.isNullOrEmpty(snapshot)) { deleteSnapshots = DeleteSnapshotsOptionType.fromString(DeleteSnapshotsOptionType.INCLUDE.toString()); } - return azureFileStorageClient.shares().deleteWithRestResponseAsync(shareName, snapshot, null, deleteSnapshots, Context.NONE) + return postProcessResponse(azureFileStorageClient.shares() + .deleteWithRestResponseAsync(shareName, snapshot, null, deleteSnapshots, context)) .map(VoidResponse::new); } + /** + * 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.file.FileServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param accountSASService The {@code AccountSASService} services for the account SAS + * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS + * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS + * @param startTime The {@code OffsetDateTime} start time for the account SAS + * @param version The {@code String} version for the account SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @return A string that represents the SAS token + */ + public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, + AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + IPRange ipRange, SASProtocol sasProtocol) { + + SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureFileStorageClient.getHttpPipeline()); + Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); + + return AccountSASSignatureValues.generateAccountSAS(sharedKeyCredential, accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); + + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java index f1603d94c448..d7bea33f4eab 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java @@ -3,17 +3,26 @@ package com.azure.storage.file; +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.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.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.CorsRule; import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.ListSharesOptions; import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; + import java.net.URL; +import java.time.OffsetDateTime; import java.util.Map; /** @@ -80,7 +89,7 @@ public ShareClient getShareClient(String shareName) { * * @return {@link ShareItem Shares} in the storage account without their metadata or snapshots */ - public Iterable listShares() { + public PagedIterable listShares() { return listShares(null); } @@ -112,8 +121,8 @@ public Iterable listShares() { * @param options Options for listing shares * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements */ - public Iterable listShares(ListSharesOptions options) { - return fileServiceAsyncClient.listShares(options).toIterable(); + public PagedIterable listShares(ListSharesOptions options) { + return new PagedIterable<>(fileServiceAsyncClient.listShares(options)); } /** @@ -129,10 +138,30 @@ public Iterable listShares(ListSharesOptions options) { *

                    For more information, see the * Azure Docs.

                    * - * @return Storage account File service properties + * @return Storage account {@link FileServiceProperties File service properties} */ - public Response getProperties() { - return fileServiceAsyncClient.getProperties().block(); + public FileServiceProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the storage account's File service. The properties range from storage analytics and + * metrics to CORS (Cross-Origin Resource Sharing). + * + *

                    Code Samples

                    + * + *

                    Retrieve File service properties

                    + * + * {@codesnippet com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the Storage account {@link FileServiceProperties File service properties} with headers and response status code + */ + public Response getPropertiesWithResponse(Context context) { + return fileServiceAsyncClient.getPropertiesWithResponse(context).block(); } /** @@ -146,7 +175,7 @@ public Response getProperties() { * *

                    Clear CORS in the File service

                    * - * {@codesnippet com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties.clearCORS} + * {@codesnippet com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS} * *

                    Enable Minute and Hour Metrics

                    * @@ -156,8 +185,46 @@ public Response getProperties() { * Azure Docs.

                    * * @param properties Storage account File 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#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
                    • + *
                    + */ + public void setProperties(FileServiceProperties properties) { + setPropertiesWithResponse(properties, Context.NONE); + } + + /** + * Sets the properties for the storage account's File 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 FileServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. + * + *

                    Code Sample

                    + * + *

                    Clear CORS in the File service

                    + * + * {@codesnippet com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS} + * + *

                    Enable Minute and Hour Metrics

                    + * + * {@codesnippet com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param properties Storage account File service properties + * @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
                    • @@ -169,8 +236,8 @@ public Response getProperties() { *
                    • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                    • *
                    */ - public VoidResponse setProperties(FileServiceProperties properties) { - return fileServiceAsyncClient.setProperties(properties).block(); + public VoidResponse setPropertiesWithResponse(FileServiceProperties properties, Context context) { + return fileServiceAsyncClient.setPropertiesWithResponse(properties, context).block(); } /** @@ -186,11 +253,11 @@ public VoidResponse setProperties(FileServiceProperties properties) { * Azure Docs.

                    * * @param shareName Name of the share - * @return A response containing the ShareClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists + * @return The {@link ShareClient ShareClient} + * @throws StorageException If a share with the same name already exists */ - public Response createShare(String shareName) { - return createShare(shareName, null, null); + public ShareClient createShare(String shareName) { + return createShareWithResponse(shareName, null, null, Context.NONE).value(); } /** @@ -199,13 +266,9 @@ public Response createShare(String shareName) { * *

                    Code Samples

                    * - *

                    Create the share "test" with metadata "share:metadata"

                    - * - * {@codesnippet com.azure.storage.file.fileServiceClient.createShare#string-map-integer.metadata} - * *

                    Create the share "test" with a quota of 10 GB

                    * - * {@codesnippet com.azure.storage.file.fileServiceClient.createShare#string-map-integer.quota} + * {@codesnippet com.azure.storage.file.FileServiceClient.createShareWithResponse#String-Map-Integer-Context} * *

                    For more information, see the * Azure Docs.

                    @@ -214,13 +277,14 @@ public Response createShare(String shareName) { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing the ShareClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareClient ShareClient} and the status of creating the share. + * @throws StorageException If a share with the same name already exists or {@code quotaInGB} is outside the * allowed range. */ - public Response createShare(String shareName, Map metadata, Integer quotaInGB) { + public Response createShareWithResponse(String shareName, Map metadata, Integer quotaInGB, Context context) { ShareClient shareClient = getShareClient(shareName); - return new SimpleResponse<>(shareClient.create(metadata, quotaInGB), shareClient); + return new SimpleResponse<>(shareClient.createWithResponse(metadata, quotaInGB, context), shareClient); } /** @@ -236,11 +300,10 @@ public Response createShare(String shareName, Map m * Azure Docs.

                    * * @param shareName Name of the share - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist + * @throws StorageException If the share doesn't exist */ - public VoidResponse deleteShare(String shareName) { - return deleteShare(shareName, null); + public void deleteShare(String shareName) { + deleteShareWithResponse(shareName, null, Context.NONE); } /** @@ -251,17 +314,58 @@ public VoidResponse deleteShare(String shareName) { * *

                    Delete the snapshot of share "test" that was created at current time.

                    * - * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShare#string-string} + * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-Context} * *

                    For more information, see the * Azure Docs.

                    * * @param shareName Name of the share * @param snapshot Identifier of the snapshot + * @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 share doesn't exist or the snapshot doesn't exist + * @throws StorageException If the share doesn't exist or the snapshot doesn't exist + */ + public VoidResponse deleteShareWithResponse(String shareName, String snapshot, Context context) { + return fileServiceAsyncClient.deleteShareWithResponse(shareName, snapshot, context).block(); + } + + /** + * Generates an account SAS token with the specified parameters + * + * @param accountSASService The {@code AccountSASService} services for the account SAS + * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS + * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS + * @return A string that represents the SAS token + */ + public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, + AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) { + return this.fileServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); + } + + /** + * Generates an account SAS token with the specified parameters + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.FileServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param accountSASService The {@code AccountSASService} services for the account SAS + * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS + * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS + * @param startTime The {@code OffsetDateTime} start time for the account SAS + * @param version The {@code String} version for the account SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @return A string that represents the SAS token */ - public VoidResponse deleteShare(String shareName, String snapshot) { - return fileServiceAsyncClient.deleteShare(shareName, snapshot).block(); + public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, + AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + IPRange ipRange, SASProtocol sasProtocol) { + return this.fileServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java index a5563ba704c3..a98e1d652ea9 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java @@ -3,38 +3,23 @@ package com.azure.storage.file; -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.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.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; 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 FileServiceClient FileServiceClients} * and {@link FileServiceAsyncClient FileServiceAsyncClients}, calling {@link FileServiceClientBuilder#buildClient() buildClient} - * constructs an instance of FileServiceClient and calling {@link FileServiceClientBuilder#buildAsyncClient() buildAsyncClient} + * constructs an instance of FileServiceClient and calling {@link FileServiceClientBuilder#buildAsyncClient() buildFileAsyncClient} * constructs an instance of FileServiceAsyncClient. * *

                    The client needs the endpoint of the Azure Storage File service and authorization credential. @@ -70,32 +55,35 @@ * @see SASTokenCredential * @see SharedKeyCredential */ -public final class FileServiceClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private final List policies; +@ServiceClientBuilder(serviceClients = {FileServiceClient.class, FileServiceAsyncClient.class}) +public final class FileServiceClientBuilder extends BaseFileClientBuilder { - private URL endpoint; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; + private final ClientLogger logger = new ClientLogger(FileServiceClientBuilder.class); /** * Creates a builder instance that is able to configure and construct {@link FileServiceClient FileServiceClients} * and {@link FileServiceAsyncClient FileServiceAsyncClients}. */ - public FileServiceClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - configuration = ConfigurationManager.getConfiguration(); + public FileServiceClientBuilder() { } + + private AzureFileStorageImpl 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 AzureFileStorageBuilder() + .url(super.endpoint) + .pipeline(pipeline) + .build(); } /** - * Creates a {@link FileServiceAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is + * Creates a {@link FileServiceAsyncClient} based on options set in the builder. Every time this method is * called a new instance of {@link FileServiceAsyncClient} is created. * *

                    @@ -108,41 +96,7 @@ public FileServiceClientBuilder() { * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. */ public FileServiceAsyncClient buildAsyncClient() { - if (pipeline != null) { - return new FileServiceAsyncClient(endpoint, pipeline); - } - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - 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 FileServiceAsyncClient(endpoint, pipeline); + return new FileServiceAsyncClient(constructImpl()); } /** @@ -173,142 +127,21 @@ public FileServiceClient buildClient() { * @return the updated FileServiceClientBuilder object * @throws IllegalArgumentException If {@code endpoint} isn't a proper URL */ + @Override public FileServiceClientBuilder endpoint(String 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; + SASTokenCredential sasTokenCredential = SASTokenCredential.fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage File Service 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 FileServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public FileServiceClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - return this; - } - - /** - * Sets the {@link SharedKeyCredential} used to authenticate requests sent to the Queue service. - * - * @param credential Shared key credential generated from the Storage account that authorizes requests - * @return the updated FileServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public FileServiceClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.sasTokenCredential = null; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated FileServiceClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public FileServiceClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map 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.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint 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 FileServiceClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public FileServiceClientBuilder 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 FileServiceClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public FileServiceClientBuilder 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 FileServiceClientBuilder object. - */ - public FileServiceClientBuilder 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 FileServiceClientBuilder#endpoint(String) endpoint} - * when building clients. - * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated FileServiceClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public FileServiceClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(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 FileServiceClientBuilder object. - * @throws NullPointerException If {@code configuration} is {@code null}. - */ - public FileServiceClientBuilder configuration(Configuration configuration) { - this.configuration = Objects.requireNonNull(configuration); - return this; - } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSASQueryParameters.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSASQueryParameters.java new file mode 100644 index 000000000000..7fb0992d19b1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSASQueryParameters.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +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 FileServiceSASSignatureValues} type. Once generated, it can be set on a + * {@link FileClientBuilder} 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 FileServiceSASQueryParameters extends BaseSASQueryParameters { + + private final String identifier; + + 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 FileServiceSASQueryParameters} 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 FileServiceSASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { + super(queryParamsMap, removeSASParametersFromMap); + this.identifier = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, 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 FileServiceSASQueryParameters} 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 share or file (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. + */ + FileServiceSASQueryParameters(String version, SASProtocol protocol, OffsetDateTime startTime, OffsetDateTime expiryTime, + IPRange ipRange, String identifier, String resource, String permissions, String signature, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { + 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; + } + + /** + * @return The signed identifier (only for {@link FileServiceSASSignatureValues}) or {@code null}. Please see + * here + * for more information. + */ + public String identifier() { + return identifier; + } + + /** + * @return The storage share or file (only for {@link FileServiceSASSignatureValues}). + */ + public String resource() { + return resource; + } + + /** + * @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; + } + + /** + * 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_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-file/src/main/java/com/azure/storage/file/FileServiceSASSignatureValues.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSASSignatureValues.java new file mode 100644 index 000000000000..d3a0d9dfc400 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSASSignatureValues.java @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +import com.azure.storage.common.Constants; +import com.azure.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SharedKeyCredential; + +import java.time.OffsetDateTime; + +/** + * FileServiceSASSignatureValues 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 file urls. Note: that both this class and {@link FileServiceSASQueryParameters} 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 FileServiceSASSignatureValues { + + 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 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. + */ + FileServiceSASSignatureValues() { + } + + /** + * Creates an object with the specified expiry time and permissions + * + * @param expiryTime Time the SAS becomes valid + * @param permissions Permissions granted by the SAS + */ + FileServiceSASSignatureValues(OffsetDateTime expiryTime, String permissions) { + this.expiryTime = expiryTime; + this.permissions = permissions; + } + + /** + * Creates an object with the specified identifier + * + * @param identifier Identifier for the SAS + */ + FileServiceSASSignatureValues(String identifier) { + this.identifier = identifier; + } + + FileServiceSASSignatureValues(String version, SASProtocol sasProtocol, OffsetDateTime startTime, + OffsetDateTime expiryTime, String permission, IPRange ipRange, String identifier, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { + if (version != null) { + 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues expiryTime(OffsetDateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * @return the permissions string allowed by the SAS. Please refer to either {@link ShareSASPermission} or + * {@link FileSASPermission} depending on the resource being accessed for help determining the permissions allowed. + */ + public String permissions() { + return permissions; + } + + /** + * Sets the permissions string allowed by the SAS. Please refer to either {@link ShareSASPermission} or + * {@link FileSASPermission} depending on the resource being accessed for help constructing the permissions string. + * + * @param permissions Permissions string for the SAS + * @return the updated FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 + * "/file/{accountName}/{shareName}/{filePath}". + * + * @param shareName Name of the share + * @param filePath Name of the file + * @param accountName Name of the account that contains the object + * @return the updated FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues canonicalName(String shareName, String filePath, String accountName) { + this.canonicalName = String.format("/file/%s/%s/%s", accountName, shareName, filePath); + return this; + } + + /** + * Sets the canonical name of the object the SAS user may access. Constructs a canonical name of + * "/file/{accountName}/{shareName}". + * + * @param shareName Name of the share + * @param accountName Name of the account that contains the object + * @return the updated FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues canonicalName(String shareName, String accountName) { + this.canonicalName = String.format("/file/%s/%s", accountName, shareName); + return this; + } + + /** + * @return the name of the access policy on the share 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 share this SAS references if any. Please see + * here + * for more information. + * + * @param identifier Name of the access policy + * @return the updated FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASSignatureValues object + */ + public FileServiceSASSignatureValues 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 FileServiceSASQueryParameters} + * @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 FileServiceSASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { + Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); + assertGenerateOK(); + + // Signature is generated on the un-url-encoded values. + String signature = sharedKeyCredentials.computeHmac256(stringToSign()); + + return new FileServiceSASQueryParameters(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); + } + + /** + * Common assertions for generateSASQueryParameters overloads. + */ + private void assertGenerateOK() { + Utility.assertNotNull("version", this.version); + Utility.assertNotNull("canonicalName", this.canonicalName); + Utility.assertNotNull("resource", this.resource); + + // 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, + 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-file/src/main/java/com/azure/storage/file/FileSmbProperties.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileSmbProperties.java new file mode 100644 index 000000000000..0f404644e6a8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileSmbProperties.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +import com.azure.core.http.HttpHeaders; +import com.azure.storage.file.models.NtfsFileAttributes; + +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.EnumSet; + +public class FileSmbProperties { + + private String filePermissionKey; + private EnumSet ntfsFileAttributes; + private OffsetDateTime fileCreationTime; + private OffsetDateTime fileLastWriteTime; + private final OffsetDateTime fileChangeTime; + private final String fileId; + private final String parentId; + + /** + * Default constructor + */ + public FileSmbProperties() { + // Non user-settable properties + fileChangeTime = null; + fileId = null; + parentId = null; + } + + /** + * @return The file's permission key. + */ + public String filePermissionKey() { + return filePermissionKey; + } + + /** + * @return The file's {@link NtfsFileAttributes}. + */ + public EnumSet ntfsFileAttributes() { + return ntfsFileAttributes; + } + + /** + * @return The file's creation time. + */ + public OffsetDateTime fileCreationTime() { + return fileCreationTime; + } + + /** + * @return The file's last write time. + */ + public OffsetDateTime fileLastWriteTime() { + return fileLastWriteTime; + } + + /** + * @return The file's change time. + */ + public OffsetDateTime fileChangeTime() { + return fileChangeTime; + } + + /** + * @return The file's ID. + */ + public String fileId() { + return fileId; + } + + /** + * @return The file's parent ID. + */ + public String parentId() { + return parentId; + } + + /** + * Sets the file permission key. + * @param filePermissionKey The file permission key. + * @return the updated FileSmbProperties object. + */ + public FileSmbProperties filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Sets the ntfs file attributes. + * @param ntfsFileAttributes An enum set of the ntfs file attributes. + * @return the updated FileSmbProperties object. + */ + public FileSmbProperties ntfsFileAttributes(EnumSet ntfsFileAttributes) { + this.ntfsFileAttributes = ntfsFileAttributes; + return this; + } + + /** + * Sets the file creation time. + * @param fileCreationTime The file creation time. + * @return the updated FileSmbProperties object.. + */ + public FileSmbProperties fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Sets the file last write time. + * @param fileLastWriteTime The file last write time. + * @return the updated FileSmbProperties object. + */ + public FileSmbProperties fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + // HELPER METHODS + + /** + * Determines the value of the file permission header. + * @param filePermission The file permission. + * @param defaultValue The default file permission header value. + * @return The value of the file permission header + */ + String filePermission(String filePermission, String defaultValue) { + return (filePermission == null) && (filePermissionKey == null) + ? defaultValue + : filePermission; + } + + /** + * Determines the value of the ntfs attributes header. + * @param defaultValue The default ntfs attributes header value. + * @return The value of the ntfs attributes header + */ + String ntfsFileAttributes(String defaultValue) { + return ntfsFileAttributes == null + ? defaultValue + : NtfsFileAttributes.toString(ntfsFileAttributes); + } + + /** + * Determines the value of the creation time header. + * @param defaultValue The default creation time header value. + * @return The value of the creation time header + */ + String fileCreationTime(String defaultValue) { + return fileCreationTime == null + ? defaultValue + : parseFileSMBDate(fileCreationTime); + } + + /** + * Determines the value of the last write time header. + * @param defaultValue The default last write time header value. + * @return The value of the last write time header + */ + String fileLastWriteTime(String defaultValue) { + return fileLastWriteTime == null + ? defaultValue + : parseFileSMBDate(fileLastWriteTime); + } + + /** + * Given an OffsetDateTime, generates a {@code String} representing a date in the format needed for + * file SMB properties + * @param time the OffsetDateTime to be interpreted as a {@code String} + * @return The {@code String} representing the date + */ + private static String parseFileSMBDate(OffsetDateTime time) { + return time.format(DateTimeFormatter.ofPattern(FileConstants.SMB_DATE_STRING)); + } + + /** + * Creates a new FileSmbProperties object from HttpHeaders + * @param httpHeaders The headers to construct FileSmbProperties from + */ + FileSmbProperties(HttpHeaders httpHeaders) { + this.filePermissionKey = httpHeaders.value(FileConstants.HeaderConstants.FILE_PERMISSION_KEY); + this.ntfsFileAttributes = NtfsFileAttributes.toAttributes(httpHeaders.value(FileConstants.HeaderConstants.FILE_ATTRIBUTES)); + this.fileCreationTime = OffsetDateTime.parse(httpHeaders.value(FileConstants.HeaderConstants.FILE_CREATION_TIME)); + this.fileLastWriteTime = OffsetDateTime.parse(httpHeaders.value(FileConstants.HeaderConstants.FILE_LAST_WRITE_TIME)); + this.fileChangeTime = OffsetDateTime.parse(httpHeaders.value(FileConstants.HeaderConstants.FILE_CHANGE_TIME)); + this.fileId = httpHeaders.value(FileConstants.HeaderConstants.FILE_ID); + this.parentId = httpHeaders.value(FileConstants.HeaderConstants.FILE_PARENT_ID); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/PostProcessor.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/PostProcessor.java new file mode 100644 index 000000000000..da9870089e18 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/PostProcessor.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + +import com.azure.storage.common.Utility; +import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.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.response() + .bodyAsString() + .switchIfEmpty(Mono.just("")) + .flatMap(body -> Mono.error(new StorageException(resume, body))) + )); + } + + private PostProcessor() { + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java index 7d7b059f55cf..3aceadaa2b6e 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java @@ -4,19 +4,28 @@ package com.azure.storage.file; 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.DateTimeRfc1123; +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.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.file.implementation.AzureFileStorageBuilder; import com.azure.storage.file.implementation.AzureFileStorageImpl; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.ShareCreateSnapshotHeaders; import com.azure.storage.file.models.ShareGetPropertiesHeaders; import com.azure.storage.file.models.ShareInfo; +import com.azure.storage.file.models.SharePermission; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.ShareSnapshotInfo; import com.azure.storage.file.models.ShareStatistics; @@ -24,14 +33,20 @@ import com.azure.storage.file.models.SharesGetPropertiesResponse; import com.azure.storage.file.models.SharesGetStatisticsResponse; import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; +import reactor.core.publisher.Mono; + import java.net.MalformedURLException; import java.net.URL; import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; import java.util.List; import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; +import java.util.Objects; +import java.util.function.Function; + +import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.file.PostProcessor.postProcessResponse; /** * This class provides a azureFileStorageClient that contains all the operations for interacting with a share in Azure Storage Share. @@ -50,6 +65,8 @@ * @see SASTokenCredential */ public class ShareAsyncClient { + private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); + private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; @@ -61,29 +78,12 @@ public class ShareAsyncClient { * @param client Client that interacts with the service interfaces * @param shareName Name of the share */ - ShareAsyncClient(AzureFileStorageImpl client, String shareName) { - this.shareName = shareName; - this.snapshot = null; - - this.azureFileStorageClient = client; - } - - /** - * Creates a ShareAsyncClient that sends requests to the storage share at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that the HTTP requests and response flow through - * @param shareName Name of the share - * @param snapshot Optional specific snapshot of the share - */ - ShareAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String snapshot) { + ShareAsyncClient(AzureFileStorageImpl client, String shareName, String snapshot) { + Objects.requireNonNull(shareName); this.shareName = shareName; this.snapshot = snapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); + this.azureFileStorageClient = client; } /** @@ -95,8 +95,8 @@ public URL getShareUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -104,7 +104,7 @@ public URL getShareUrl() { /** * Constructs a {@link DirectoryAsyncClient} that interacts with the root directory in the share. * - *

                    If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the azureFileStorageClient will + *

                    If the directory doesn't exist in the share {@link DirectoryAsyncClient#create()} in the azureFileStorageClient will * need to be called before interaction with the directory can happen.

                    * * @return a {@link DirectoryAsyncClient} that interacts with the root directory in the share @@ -116,7 +116,7 @@ public DirectoryAsyncClient getRootDirectoryClient() { /** * Constructs a {@link DirectoryAsyncClient} that interacts with the specified directory. * - *

                    If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the azureFileStorageClient will + *

                    If the directory doesn't exist in the share {@link DirectoryAsyncClient#create() create} in the azureFileStorageClient will * need to be called before interaction with the directory can happen.

                    * * @param directoryName Name of the directory @@ -151,11 +151,11 @@ public FileAsyncClient getFileClient(String filePath) { *

                    For more information, see the * Azure Docs.

                    * - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata + * @return The information about the {@link ShareInfo share} + * @throws StorageException If the share already exists with different metadata */ - public Mono> create() { - return create(null, null); + public Mono create() { + return createWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -165,11 +165,11 @@ public Mono> create() { * *

                    Create the share with metadata "share:metadata"

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.create#map-integer.metadata} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata} * *

                    Create the share with a quota of 10 GB

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.create#map-integer.quota} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota} * *

                    For more information, see the * Azure Docs.

                    @@ -177,12 +177,17 @@ public Mono> create() { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the + * @return A response containing information about the {@link ShareInfo share} and the status its creation. + * @throws StorageException If the share already exists with different metadata or {@code quotaInGB} is outside the * allowed range. */ - public Mono> create(Map metadata, Integer quotaInGB) { - return azureFileStorageClient.shares().createWithRestResponseAsync(shareName, null, metadata, quotaInGB, Context.NONE) + public Mono> createWithResponse(Map metadata, Integer quotaInGB) { + return withContext(context -> createWithResponse(metadata, quotaInGB, context)); + } + + Mono> createWithResponse(Map metadata, Integer quotaInGB, Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .createWithRestResponseAsync(shareName, null, metadata, quotaInGB, context)) .map(this::mapToShareInfoResponse); } @@ -198,12 +203,12 @@ public Mono> create(Map metadata, Integer qu *

                    For more information, see the * Azure Docs.

                    * - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * @return The information about the {@link ShareSnapshotInfo snapshot of share}. + * @throws StorageException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Mono> createSnapshot() { - return createSnapshot(null); + public Mono createSnapshot() { + return createSnapshotWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -213,19 +218,24 @@ public Mono> createSnapshot() { * *

                    Create a snapshot with metadata "snapshot:metadata"

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshot#map} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map} * *

                    For more information, see the * Azure Docs.

                    * * @param metadata Optional metadata to associate with the snapshot. If {@code null} the metadata of the share * will be copied to the snapshot. - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * @return A response containing information about the {@link ShareSnapshotInfo snapshot of share}. + * @throws StorageException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Mono> createSnapshot(Map metadata) { - return azureFileStorageClient.shares().createSnapshotWithRestResponseAsync(shareName, null, metadata, Context.NONE) + public Mono> createSnapshotWithResponse(Map metadata) { + return withContext(context -> createSnapshotWithResponse(metadata, context)); + } + + Mono> createSnapshotWithResponse(Map metadata, Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .createSnapshotWithRestResponseAsync(shareName, null, metadata, context)) .map(this::mapCreateSnapshotResponse); } @@ -241,11 +251,35 @@ public Mono> createSnapshot(Map meta *

                    For more information, see the * Azure Docs.

                    * + * @return An empty response + * @throws StorageException If the share doesn't exist + */ + public Mono delete() { + return deleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Deletes the share in the storage account + * + *

                    Code Samples

                    + * + *

                    Delete the share

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteWithResponse} + * + *

                    For more information, see the + * Azure Docs.

                    + * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist + * @throws StorageException If the share doesn't exist */ - public Mono delete() { - return azureFileStorageClient.shares().deleteWithRestResponseAsync(shareName, snapshot, null, null, Context.NONE) + public Mono deleteWithResponse() { + return withContext(this::deleteWithResponse); + } + + Mono deleteWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .deleteWithRestResponseAsync(shareName, snapshot, null, null, context)) .map(VoidResponse::new); } @@ -262,11 +296,36 @@ public Mono delete() { *

                    For more information, see the * Azure Docs.

                    * - * @return the properties of the share - * @throws StorageErrorException If the share doesn't exist + * @return The {@link ShareProperties properties of the share} + * @throws StorageException If the share doesn't exist */ - public Mono> getProperties() { - return azureFileStorageClient.shares().getPropertiesWithRestResponseAsync(shareName, snapshot, null, Context.NONE) + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share + * is restricted to. + * + *

                    Code Samples

                    + * + *

                    Retrieve the share properties

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @return A response containing the {@link ShareProperties properties of the share} with headers and response status code + * @throws StorageException If the share doesn't exist + */ + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .getPropertiesWithRestResponseAsync(shareName, snapshot, null, context)) .map(this::mapGetPropertiesResponse); } @@ -277,17 +336,42 @@ public Mono> getProperties() { * *

                    Set the quota to 1024 GB

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.setQuota} + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setQuota#int} * *

                    For more information, see the * Azure Docs.

                    * * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + * @return The {@link ShareInfo information about the share} + * @throws StorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds */ - public Mono> setQuota(int quotaInGB) { - return azureFileStorageClient.shares().setQuotaWithRestResponseAsync(shareName, null, quotaInGB, Context.NONE) + public Mono setQuota(int quotaInGB) { + return setQuotaWithResponse(quotaInGB).flatMap(FluxUtil::toMono); + } + + /** + * Sets the maximum size in GB that the share is allowed to grow. + * + *

                    Code Samples

                    + * + *

                    Set the quota to 1024 GB

                    + * + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * @return A response containing the {@link ShareInfo information about the share} with headers and response status code + * @throws StorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + */ + public Mono> setQuotaWithResponse(int quotaInGB) { + return withContext(context -> setQuotaWithResponse(quotaInGB, context)); + } + + Mono> setQuotaWithResponse(int quotaInGB, Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .setQuotaWithRestResponseAsync(shareName, null, quotaInGB, context)) .map(this::mapToShareInfoResponse); } @@ -310,11 +394,42 @@ public Mono> setQuota(int quotaInGB) { * Azure Docs.

                    * * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys + * @return The {@link ShareInfo information about the share} + * @throws StorageException If the share doesn't exist or the metadata contains invalid keys */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.shares().setMetadataWithRestResponseAsync(shareName, null, metadata, Context.NONE) + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined metadata to associate to the share. + * + *

                    If {@code null} is passed for the metadata it will clear the metadata associated to the share.

                    + * + *

                    Code Samples

                    + * + *

                    Set the metadata to "share:updatedMetadata"

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.setMetadata#map} + * + *

                    Clear the metadata of the share

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.clearMetadata#map} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared + * @return A response containing the {@link ShareInfo information about the share} with headers and response status code + * @throws StorageException If the share doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono> setMetadataWithResponse(Map metadata, Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .setMetadataWithRestResponseAsync(shareName, null, metadata, context)) .map(this::mapToShareInfoResponse); } @@ -331,11 +446,20 @@ public Mono> setMetadata(Map metadata) { * Azure Docs.

                    * * @return The stored access policies specified on the queue. - * @throws StorageErrorException If the share doesn't exist + * @throws StorageException If the share doesn't exist */ - public Flux getAccessPolicy() { - return azureFileStorageClient.shares().getAccessPolicyWithRestResponseAsync(shareName, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value())); + public PagedFlux getAccessPolicy() { + Function>> retriever = + marker -> postProcessResponse(this.azureFileStorageClient.shares() + .getAccessPolicyWithRestResponseAsync(shareName, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value(), + null, + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -345,18 +469,64 @@ public Flux getAccessPolicy() { * *

                    Set a read only stored access policy

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.setAccessPolicy} + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setAccessPolicy#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 share doesn't exist, a stored access policy doesn't have all fields filled out, + * @return The {@link ShareInfo information about the share} + * @throws StorageException If the share doesn't exist, a stored access policy doesn't have all fields filled out, * or the share will have more than five policies. */ - public Mono> setAccessPolicy(List permissions) { - return azureFileStorageClient.shares().setAccessPolicyWithRestResponseAsync(shareName, permissions, null, Context.NONE) + + public Mono setAccessPolicy(List permissions) { + return setAccessPolicyWithResponse(permissions).flatMap(FluxUtil::toMono); + } + + /** + * Sets stored access policies for the share. + * + *

                    Code Samples

                    + * + *

                    Set a read only stored access policy

                    + * + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param permissions Access policies to set on the queue + * @return A response containing the {@link ShareInfo information about the share} with headers and response status code + * @throws StorageException If the share doesn't exist, a stored access policy doesn't have all fields filled out, + * or the share will have more than five policies. + */ + 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.accessPolicy() != null && permission.accessPolicy().start() != null) { + permission.accessPolicy().start( + permission.accessPolicy().start().truncatedTo(ChronoUnit.SECONDS)); + } + if (permission.accessPolicy() != null && permission.accessPolicy().expiry() != null) { + permission.accessPolicy().expiry( + permission.accessPolicy().expiry().truncatedTo(ChronoUnit.SECONDS)); + } + } + } + + return postProcessResponse(azureFileStorageClient.shares() + .setAccessPolicyWithRestResponseAsync(shareName, permissions, null, context)) .map(this::mapToShareInfoResponse); } @@ -372,10 +542,33 @@ public Mono> setAccessPolicy(List permissi *

                    For more information, see the * Azure Docs.

                    * - * @return the storage statistics of the share + * @return The storage {@link ShareStatistics statistics of the share} */ - public Mono> getStatistics() { - return azureFileStorageClient.shares().getStatisticsWithRestResponseAsync(shareName, Context.NONE) + public Mono getStatistics() { + return getStatisticsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves storage statistics about the share. + * + *

                    Code Samples

                    + * + *

                    Retrieve the storage statistics

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @return A response containing the storage {@link ShareStatistics statistics of the share} with headers and response status code + */ + public Mono> getStatisticsWithResponse() { + return withContext(this::getStatisticsWithResponse); + } + + Mono> getStatisticsWithResponse(Context context) { + return postProcessResponse(azureFileStorageClient.shares() + .getStatisticsWithRestResponseAsync(shareName, context)) .map(this::mapGetStatisticsResponse); } @@ -392,13 +585,12 @@ public Mono> getStatistics() { * Azure Docs.

                    * * @param directoryName Name of the directory - * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the - * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * @return The {@link DirectoryAsyncClient} to interact with the created directory. + * @throws StorageException If the share doesn't exist, the directory already exists or is in the process of * being deleted, or the parent directory for the new directory doesn't exist */ - public Mono> createDirectory(String directoryName) { - return createDirectory(directoryName, null); + public Mono createDirectory(String directoryName) { + return createDirectoryWithResponse(directoryName, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -408,22 +600,31 @@ public Mono> createDirectory(String directoryName * *

                    Create the directory "documents" with metadata "directory:metadata"

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createDirectory#string-map} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-filesmbproperties-string-map} * *

                    For more information, see the * Azure Docs.

                    * * @param directoryName Name of the directory + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. * @param metadata Optional metadata to associate with the directory * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * @throws StorageException If the share doesn't exist, the directory already exists or is in the process of * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal * key name */ - public Mono> createDirectory(String directoryName, Map metadata) { + public Mono> createDirectoryWithResponse(String directoryName, + FileSmbProperties smbProperties, String filePermission, Map metadata) { + return withContext(context -> createDirectoryWithResponse(directoryName, smbProperties, filePermission, metadata, context)); + } + + Mono> createDirectoryWithResponse(String directoryName, + FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { DirectoryAsyncClient directoryAsyncClient = getDirectoryClient(directoryName); - return directoryAsyncClient.create(metadata).map(response -> new SimpleResponse<>(response, directoryAsyncClient)); + return postProcessResponse(directoryAsyncClient.createWithResponse(smbProperties, filePermission, metadata)) + .map(response -> new SimpleResponse<>(response, directoryAsyncClient)); } /** @@ -440,9 +641,8 @@ public Mono> createDirectory(String directoryName * * @param fileName Name of the file. * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @return A response containing a {@link FileAsyncClient} to interact with the created file and the - * status of its creation. - * @throws StorageErrorException If one of the following cases happen: + * @return The {@link FileAsyncClient} to interact with the created file. + * @throws StorageException If one of the following cases happen: *
                      *
                    • * If the share or parent directory does not exist. @@ -452,29 +652,31 @@ public Mono> createDirectory(String directoryName *
                    • *
                    */ - public Mono> createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public Mono createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null, null, null).flatMap(FluxUtil::toMono); } /** - * Creates the file in the share with the given name, file max size and associates the passed httpHeaders and metadata to it. + * Creates the file in the share with the given name, file max size and associates the passed properties to it. * *

                    Code Samples

                    * - *

                    Create the file "myfile" with length of 1024 bytes, some headers and metadata

                    + *

                    Create the file "myfile" with length of 1024 bytes, some headers, file smb properties and metadata

                    * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map} * *

                    For more information, see the * Azure Docs.

                    * * @param fileName Name of the file. * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @param httpHeaders Additional parameters for the operation. - * @param metadata Optional metadata to associate with the file. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file. + * @param metadata Optional name-value pairs associated with the file as metadata. * @return A response containing a {@link FileAsyncClient} to interact with the created file and the * status of its creation. - * @throws StorageErrorException If one of the following cases happen: + * @throws StorageException If one of the following cases happen: *
                      *
                    • * If the share or parent directory does not exist. @@ -484,9 +686,37 @@ public Mono> createFile(String fileName, long maxSize) *
                    • *
                    */ - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + public Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Map metadata) { + return withContext(context -> createFileWithResponse(fileName, maxSize, httpHeaders, smbProperties, filePermission, + metadata, context)); + } + + Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); - return fileAsyncClient.create(maxSize, httpHeaders, metadata).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + return postProcessResponse(fileAsyncClient.createWithResponse(maxSize, httpHeaders, smbProperties, filePermission, + metadata, context)).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + } + + /** + * Deletes the specified directory in the share. + * + *

                    Code Samples

                    + * + *

                    Delete the directory "mydirectory"

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteDirectory#string} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param directoryName Name of the directory + * @return An empty response + * @throws StorageException If the share doesn't exist or the directory isn't empty + */ + public Mono deleteDirectory(String directoryName) { + return deleteDirectoryWithResponse(directoryName).flatMap(FluxUtil::toMono); } /** @@ -503,10 +733,35 @@ public Mono> createFile(String fileName, long maxSize, * * @param directoryName Name of the directory * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the directory isn't empty + * @throws StorageException If the share doesn't exist or the directory isn't empty + */ + public Mono deleteDirectoryWithResponse(String directoryName) { + return withContext(context -> deleteDirectoryWithResponse(directoryName, context)); + } + + Mono deleteDirectoryWithResponse(String directoryName, Context context) { + return postProcessResponse(getDirectoryClient(directoryName).deleteWithResponse(context)) + .map(VoidResponse::new); + } + + /** + * Deletes the specified file in the share. + * + *

                    Code Samples

                    + * + *

                    Delete the file "myfile"

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteFile#string} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param fileName Name of the file. + * @return A empty response + * @throws StorageException If the share or the file doesn't exist. */ - public Mono deleteDirectory(String directoryName) { - return getDirectoryClient(directoryName).delete().map(VoidResponse::new); + public Mono deleteFile(String fileName) { + return deleteFileWithResponse(fileName).flatMap(FluxUtil::toMono); } /** @@ -523,10 +778,85 @@ public Mono deleteDirectory(String directoryName) { * * @param fileName Name of the file. * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share or the file doesn't exist. + * @throws StorageException If the share or the file doesn't exist. + */ + public Mono deleteFileWithResponse(String fileName) { + return withContext(context -> deleteFileWithResponse(fileName, context)); + } + + Mono deleteFileWithResponse(String fileName, Context context) { + return postProcessResponse(getFileClient(fileName).deleteWithResponse(context)) + .map(VoidResponse::new); + } + + /** + * Creates a permission at the share level. If a permission already exists, it returns the key of it, + * else creates a new permission and returns the key. + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.createPermission#string} + * + * @param filePermission The file permission to get/create. + * @return The file permission key associated with the file permission. + */ + public Mono createPermission(String filePermission) { + return createPermissionWithResponse(filePermission).flatMap(FluxUtil::toMono); + } + + /** + * Creates a permission at the share level. If a permission already exists, it returns the key of it, + * else creates a new permission and returns the key. + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.createPermissionWithResponse#string} + * + * @param filePermission The file permission to get/create. + * @return A response that contains the file permission key associated with the file permission. + */ + public Mono> createPermissionWithResponse(String filePermission) { + return withContext(context -> createPermissionWithResponse(filePermission, context)); + } + + Mono> createPermissionWithResponse(String filePermission, Context context) { + // NOTE: Should we check for null or empty? + SharePermission sharePermission = new SharePermission().permission(filePermission); + return postProcessResponse(azureFileStorageClient.shares().createPermissionWithRestResponseAsync(shareName, sharePermission, null, context)) + .map(response -> new SimpleResponse<>(response, response.deserializedHeaders().filePermissionKey())); + } + + /** + * Gets a permission for a given key. + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.getPermission#string} + * + * @param filePermissionKey The file permission key. + * @return The file permission associated with the file permission key. */ - public Mono deleteFile(String fileName) { - return getFileClient(fileName).delete().map(VoidResponse::new); + public Mono getPermission(String filePermissionKey) { + return getPermissionWithResponse(filePermissionKey).flatMap(FluxUtil::toMono); + } + + /** + * Gets a permission for a given key. + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.getPermissionWithResponse#string} + * + * @param filePermissionKey The file permission key. + * @return A response that contains th file permission associated with the file permission key. + */ + public Mono> getPermissionWithResponse(String filePermissionKey) { + return withContext(context -> getPermissionWithResponse(filePermissionKey, context)); + } + + Mono> getPermissionWithResponse(String filePermissionKey, Context context) { + return postProcessResponse(azureFileStorageClient.shares().getPermissionWithRestResponseAsync(shareName, filePermissionKey, null, context)) + .map(response -> new SimpleResponse<>(response, response.value().permission())); } /** @@ -545,6 +875,110 @@ public String getSnapshotId() { return this.snapshot; } + /** + * Generates a SAS token with the specified parameters + * + * @param permissions The {@code ShareSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(ShareSASPermission permissions, OffsetDateTime expiryTime) { + return this.generateSAS(null, permissions, expiryTime, null /* startTime */, /* identifier */ null /* + version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* contentLanguage*/, + null /* contentEncoding */, null /* contentLanguage */, null /* contentType */); + } + + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier) { + return this.generateSAS(identifier, null /* permissions */, null /* expiryTime */, null /* startTime */, + null /* version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* + contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, null /* contentType */); + } + + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code ShareSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, ShareSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { + return this.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange, null + /* cacheControl */, null /* contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, + null /* contentType */); + } + + /** + * Generates a SAS token with the specified parameters + * + *

                    Code Samples

                    + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.generateSAS#String-ShareSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code ShareSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @param cacheControl An optional {@code String} cache-control header for the SAS. + * @param contentDisposition An optional {@code String} content-disposition header for the SAS. + * @param contentEncoding An optional {@code String} content-encoding header for the SAS. + * @param contentLanguage An optional {@code String} content-language header for the SAS. + * @param contentType An optional {@code String} content-type header for the SAS. + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, ShareSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { + + FileServiceSASSignatureValues fileServiceSASSignatureValues = new FileServiceSASSignatureValues(version, sasProtocol, + startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, identifier, + cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + + SharedKeyCredential sharedKeyCredential = + Utility.getSharedKeyCredential(this.azureFileStorageClient.getHttpPipeline()); + + Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); + + FileServiceSASSignatureValues values = configureServiceSASSignatureValues(fileServiceSASSignatureValues, + sharedKeyCredential.accountName()); + + FileServiceSASQueryParameters fileServiceSasQueryParameters = values.generateSASQueryParameters(sharedKeyCredential); + + return fileServiceSasQueryParameters.encode(); + } + + /** + * Sets fileServiceSASSignatureValues parameters dependent on the current file type + */ + FileServiceSASSignatureValues configureServiceSASSignatureValues(FileServiceSASSignatureValues fileServiceSASSignatureValues, + String accountName) { + + // Set canonical name + fileServiceSASSignatureValues.canonicalName(this.shareName, accountName); + + // Set resource + fileServiceSASSignatureValues.resource(Constants.UrlConstants.SAS_SHARE_CONSTANT); + + return fileServiceSASSignatureValues; + } + private Response mapToShareInfoResponse(Response response) { String eTag = response.headers().value("ETag"); OffsetDateTime lastModified = new DateTimeRfc1123(response.headers().value("Last-Modified")).dateTime(); diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java index 476b9a2187c1..28163f1ca911 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java @@ -3,9 +3,13 @@ package com.azure.storage.file; +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.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileHTTPHeaders; @@ -14,8 +18,9 @@ import com.azure.storage.file.models.ShareSnapshotInfo; import com.azure.storage.file.models.ShareStatistics; import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; import java.net.URL; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -54,7 +59,7 @@ public URL getShareUrl() { /** * Constructs a {@link DirectoryClient} that interacts with the root directory in the share. * - *

                    If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will + *

                    If the directory doesn't exist in the share {@link DirectoryClient#create() create} in the client will * need to be called before interaction with the directory can happen.

                    * * @return a {@link DirectoryClient} that interacts with the root directory in the share @@ -66,7 +71,7 @@ public DirectoryClient getRootDirectoryClient() { /** * Constructs a {@link DirectoryClient} that interacts with the specified directory. * - *

                    If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will + *

                    If the directory doesn't exist in the share {@link DirectoryClient#create() create} in the client will * need to be called before interaction with the directory can happen.

                    * * @param directoryName Name of the directory @@ -101,11 +106,11 @@ public FileClient getFileClient(String filePath) { *

                    For more information, see the * Azure Docs.

                    * - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata + * @return The {@link ShareInfo information about the share}. + * @throws StorageException If the share already exists with different metadata */ - public Response create() { - return create(null, null); + public ShareInfo create() { + return createWithResponse(null, null, Context.NONE).value(); } /** @@ -115,11 +120,11 @@ public Response create() { * *

                    Create the share with metadata "share:metadata"

                    * - * {@codesnippet com.azure.storage.file.shareClient.create#map-integer.metadata} + * {@codesnippet com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.metadata} * *

                    Create the share with a quota of 10 GB

                    * - * {@codesnippet com.azure.storage.file.shareClient.create#map-integer.quota} + * {@codesnippet com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.quota} * *

                    For more information, see the * Azure Docs.

                    @@ -127,12 +132,13 @@ public Response create() { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareInfo information about the share} and the status its creation. + * @throws StorageException If the share already exists with different metadata or {@code quotaInGB} is outside the * allowed range. */ - public Response create(Map metadata, Integer quotaInGB) { - return client.create(metadata, quotaInGB).block(); + public Response createWithResponse(Map metadata, Integer quotaInGB, Context context) { + return client.createWithResponse(metadata, quotaInGB, context).block(); } /** @@ -142,16 +148,17 @@ public Response create(Map metadata, Integer quotaInG * *

                    Create a snapshot

                    * + * {@codesnippet com.azure.storage.file.shareClient.createSnapshot} * *

                    For more information, see the * Azure Docs.

                    * - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * @return The {@link ShareSnapshotInfo information about snapshot of share} + * @throws StorageException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Response createSnapshot() { - return createSnapshot(null); + public ShareSnapshotInfo createSnapshot() { + return createSnapshotWithResponse(null, Context.NONE).value(); } /** @@ -161,19 +168,20 @@ public Response createSnapshot() { * *

                    Create a snapshot with metadata "snapshot:metadata"

                    * - * {@codesnippet com.azure.storage.file.shareClient.createSnapshot#map} + * {@codesnippet com.azure.storage.file.shareClient.createSnapshotWithResponse#map-Context} * *

                    For more information, see the * Azure Docs.

                    * * @param metadata Optional metadata to associate with the snapshot. If {@code null} the metadata of the share * will be copied to the snapshot. - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareSnapshotInfo information about snapshot of the share} and status of creation. + * @throws StorageException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Response createSnapshot(Map metadata) { - return client.createSnapshot(metadata).block(); + public Response createSnapshotWithResponse(Map metadata, Context context) { + return client.createSnapshotWithResponse(metadata, context).block(); } /** @@ -188,11 +196,30 @@ public Response createSnapshot(Map metadata) *

                    For more information, see the * Azure Docs.

                    * + * @throws StorageException If the share doesn't exist + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + /** + * Deletes the share in the storage account + * + *

                    Code Samples

                    + * + *

                    Delete the share

                    + * + * {@codesnippet com.azure.storage.file.shareClient.deleteWithResponse#Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @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 share doesn't exist + * @throws StorageException If the share doesn't exist */ - public VoidResponse delete() { - return client.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return client.deleteWithResponse(context).block(); } /** @@ -208,11 +235,32 @@ public VoidResponse delete() { *

                    For more information, see the * Azure Docs.

                    * - * @return the properties of the share - * @throws StorageErrorException If the share doesn't exist + * @return The {@link ShareProperties properties of the share} + * @throws StorageException If the share doesn't exist + */ + public ShareProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share + * is restricted to. + * + *

                    Code Samples

                    + * + *

                    Retrieve the share properties

                    + * + * {@codesnippet com.azure.storage.file.shareClient.getPropertiesWithResponse#Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing {@link ShareProperties properties of the share} with response status code + * @throws StorageException If the share doesn't exist */ - public Response getProperties() { - return client.getProperties().block(); + public Response getPropertiesWithResponse(Context context) { + return client.getPropertiesWithResponse(context).block(); } /** @@ -222,17 +270,38 @@ public Response getProperties() { * *

                    Set the quota to 1024 GB

                    * - * {@codesnippet com.azure.storage.file.shareClient.setQuota} + * {@codesnippet com.azure.storage.file.ShareClient.setQuota#int} * *

                    For more information, see the * Azure Docs.

                    * * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + * @return The {@link ShareProperties properties of the share} + * @throws StorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds */ - public Response setQuota(int quotaInGB) { - return client.setQuota(quotaInGB).block(); + public ShareInfo setQuota(int quotaInGB) { + return setQuotaWithResponse(quotaInGB, Context.NONE).value(); + } + + /** + * Sets the maximum size in GB that the share is allowed to grow. + * + *

                    Code Samples

                    + * + *

                    Set the quota to 1024 GB

                    + * + * {@codesnippet com.azure.storage.file.shareClient.setQuotaWithResponse#int-Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing {@link ShareProperties properties of the share} with response status code + * @throws StorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + */ + public Response setQuotaWithResponse(int quotaInGB, Context context) { + return client.setQuotaWithResponse(quotaInGB, context).block(); } /** @@ -254,11 +323,34 @@ public Response setQuota(int quotaInGB) { * Azure Docs.

                    * * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys + * @return The {@link ShareProperties properties of the share} + * @throws StorageException If the share doesn't exist or the metadata contains invalid keys */ - public Response setMetadata(Map metadata) { - return client.setMetadata(metadata).block(); + public ShareInfo setMetadata(Map metadata) { + return setMetadataWithResponse(metadata, Context.NONE).value(); + } + + /** + * Sets the user-defined metadata to associate to the share. + * + *

                    If {@code null} is passed for the metadata it will clear the metadata associated to the share.

                    + * + *

                    Code Samples

                    + * + *

                    Set the metadata to "share:updatedMetadata"

                    + * + * {@codesnippet com.azure.storage.file.shareClient.setMetadataWithResponse#map-Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing {@link ShareProperties properties of the share} with response status code + * @throws StorageException If the share doesn't exist or the metadata contains invalid keys + */ + public Response setMetadataWithResponse(Map metadata, Context context) { + return client.setMetadataWithResponse(metadata, context).block(); } /** @@ -274,10 +366,10 @@ public Response setMetadata(Map metadata) { * Azure Docs.

                    * * @return The stored access policies specified on the queue. - * @throws StorageErrorException If the share doesn't exist + * @throws StorageException If the share doesn't exist */ - public Iterable getAccessPolicy() { - return client.getAccessPolicy().toIterable(); + public PagedIterable getAccessPolicy() { + return new PagedIterable<>(client.getAccessPolicy()); } /** @@ -287,18 +379,40 @@ public Iterable getAccessPolicy() { * *

                    Set a read only stored access policy

                    * - * {@codesnippet com.azure.storage.file.shareClient.setAccessPolicy} + * {@codesnippet com.azure.storage.file.ShareClient.setAccessPolicy#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 share doesn't exist, a stored access policy doesn't have all fields filled out, + * @return The {@link ShareInfo information of the share} + * @throws StorageException If the share doesn't exist, a stored access policy doesn't have all fields filled out, * or the share will have more than five policies. */ - public Response setAccessPolicy(List permissions) { - return client.setAccessPolicy(permissions).block(); + public ShareInfo setAccessPolicy(List permissions) { + return setAccessPolicyWithResponse(permissions, Context.NONE).value(); + } + + /** + * Sets stored access policies for the share. + * + *

                    Code Samples

                    + * + *

                    Set a read only stored access policy

                    + * + * {@codesnippet com.azure.storage.file.shareClient.setAccessPolicyWithResponse#List-Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param permissions Access policies to set on the queue + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareInfo information of the share} with headers and response status code + * @throws StorageException If the share doesn't exist, a stored access policy doesn't have all fields filled out, + * or the share will have more than five policies. + */ + public Response setAccessPolicyWithResponse(List permissions, Context context) { + return client.setAccessPolicyWithResponse(permissions, context).block(); } /** @@ -313,10 +427,29 @@ public Response setAccessPolicy(List permissions) { *

                    For more information, see the * Azure Docs.

                    * - * @return the storage statistics of the share + * @return The storage {@link ShareStatistics statistics of the share} */ - public Response getStatistics() { - return client.getStatistics().block(); + public ShareStatistics getStatistics() { + return getStatisticsWithResponse(Context.NONE).value(); + } + + /** + * Retrieves storage statistics about the share. + * + *

                    Code Samples

                    + * + *

                    Retrieve the storage statistics

                    + * + * {@codesnippet com.azure.storage.file.shareClient.getStatisticsWithResponse#Context} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareStatistics statistics of the share} + */ + public Response getStatisticsWithResponse(Context context) { + return client.getStatisticsWithResponse(context).block(); } /** @@ -332,13 +465,12 @@ public Response getStatistics() { * Azure Docs.

                    * * @param directoryName Name of the directory - * @return A response containing a {@link DirectoryClient} to interact with the created directory and the - * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * @return A response containing a {@link DirectoryClient} to interact with the created directory. + * @throws StorageException If the share doesn't exist, the directory already exists or is in the process of * being deleted, or the parent directory for the new directory doesn't exist */ - public Response createDirectory(String directoryName) { - return createDirectory(directoryName, null); + public DirectoryClient createDirectory(String directoryName) { + return createDirectoryWithResponse(directoryName, null, null, null, Context.NONE).value(); } /** @@ -348,22 +480,26 @@ public Response createDirectory(String directoryName) { * *

                    Create the directory "documents" with metadata "directory:metadata"

                    * - * {@codesnippet com.azure.storage.file.shareClient.createDirectory#string-map} + * {@codesnippet com.azure.storage.file.shareClient.createDirectoryWithResponse#string-filesmbproperties-string-map-context} * *

                    For more information, see the * Azure Docs.

                    * * @param directoryName Name of the directory + * @param smbProperties The SMB properties of the directory. + * @param filePermission The file permission of the directory. * @param metadata Optional metadata to associate with the directory + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * @throws StorageException If the share doesn't exist, the directory already exists or is in the process of * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal * key name */ - public Response createDirectory(String directoryName, Map metadata) { + public Response createDirectoryWithResponse(String directoryName, FileSmbProperties smbProperties, + String filePermission, Map metadata, Context context) { DirectoryClient directoryClient = getDirectoryClient(directoryName); - return new SimpleResponse<>(directoryClient.create(metadata), directoryClient); + return new SimpleResponse<>(directoryClient.createWithResponse(smbProperties, filePermission, metadata, context), directoryClient); } /** @@ -380,9 +516,8 @@ public Response createDirectory(String directoryName, Map *
                  • * If the share or parent directory does not exist. @@ -392,29 +527,32 @@ public Response createDirectory(String directoryName, Map *
                  */ - public Response createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public FileClient createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null, null, null, Context.NONE).value(); } /** - * Creates the file in the share with the given name, file max size and associates the passed httpHeaders and metadata to it. + * Creates the file in the share with the given name, file max size and associates the passed properties to it. * *

                  Code Samples

                  * - *

                  Create the file "myfile" with length of 1024 bytes, some headers and metadata

                  + *

                  Create the file "myfile" with length of 1024 bytes, some headers, file smb properties and metadata

                  * - * {@codesnippet com.azure.storage.file.shareClient.createFile#string-long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map-context} * *

                  For more information, see the * Azure Docs.

                  * * @param fileName Name of the file. * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @param httpHeaders Additional parameters for the operation. - * @param metadata Optional metadata to associate with the file. + * @param httpHeaders The user settable file http headers. + * @param smbProperties The user settable file smb properties. + * @param filePermission The file permission of the file + * @param metadata Optional name-value pairs associated with the file as metadata. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing a {@link FileClient} to interact with the created file and the * status of its creation. - * @throws StorageErrorException If one of the following cases happen: + * @throws StorageException If one of the following cases happen: *
                    *
                  • * If the share or parent directory does not exist. @@ -424,9 +562,11 @@ public Response createFile(String fileName, long maxSize) { *
                  • *
                  */ - public Response createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + public Response createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { FileClient fileClient = getFileClient(fileName); - return new SimpleResponse<>(fileClient.create(maxSize, httpHeaders, metadata), fileClient); + return new SimpleResponse<>(fileClient.createWithResponse(maxSize, httpHeaders, smbProperties, filePermission, + metadata, context), fileClient); } /** @@ -442,11 +582,32 @@ public Response createFile(String fileName, long maxSize, FileHTTPHe * Azure Docs.

                  * * @param directoryName Name of the directory + * @throws StorageException If the share doesn't exist or the directory isn't empty + */ + public void deleteDirectory(String directoryName) { + deleteDirectoryWithResponse(directoryName, Context.NONE); + } + + + /** + * Deletes the specified directory in the share. + * + *

                  Code Samples

                  + * + *

                  Delete the directory "mydirectory"

                  + * + * {@codesnippet com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param directoryName Name of the directory + * @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 share doesn't exist or the directory isn't empty + * @throws StorageException If the share doesn't exist or the directory isn't empty */ - public VoidResponse deleteDirectory(String directoryName) { - return client.deleteDirectory(directoryName).block(); + public VoidResponse deleteDirectoryWithResponse(String directoryName, Context context) { + return client.deleteDirectoryWithResponse(directoryName, context).block(); } /** @@ -462,11 +623,91 @@ public VoidResponse deleteDirectory(String directoryName) { * Azure Docs.

                  * * @param fileName Name of the file + * @throws StorageException If the share or the file doesn't exist. + */ + public void deleteFile(String fileName) { + deleteFileWithResponse(fileName, Context.NONE); + } + + /** + * Deletes the specified file in the share. + * + *

                  Code Samples

                  + * + *

                  Delete the file "myfile"

                  + * + * {@codesnippet com.azure.storage.file.shareClient.deleteFileWithResponse#string-Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param fileName Name of the file + * @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 share or the file doesn't exist. + * @throws StorageException If the share or the file doesn't exist. + */ + public VoidResponse deleteFileWithResponse(String fileName, Context context) { + return client.deleteFileWithResponse(fileName, context).block(); + } + + /** + * Creates a permission at the share level. If a permission already exists, it returns the key of it, + * else creates a new permission and returns the key. + * + *

                  Code Samples

                  + * + * {@codesnippet com.azure.storage.file.shareClient.createPermission#string} + * + * @param filePermission The file permission to get/create. + * @return The file permission key associated with the file permission. + */ + public String createPermission(String filePermission) { + return createPermissionWithResponse(filePermission, Context.NONE).value(); + } + + /** + * Creates a permission t the share level. If a permission already exists, it returns the key of it, + * else creates a new permission and returns the key. + * + *

                  Code Samples

                  + * + * {@codesnippet com.azure.storage.file.shareClient.createPermissionWithResponse#string-context} + * + * @param filePermission The file permission to get/create. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response that contains the file permission key associated with the file permission. */ - public VoidResponse deleteFile(String fileName) { - return client.deleteFile(fileName).block(); + public Response createPermissionWithResponse(String filePermission, Context context) { + return client.createPermissionWithResponse(filePermission, context).block(); + } + + /** + * Gets a permission for a given key + * + *

                  Code Samples

                  + * + * {@codesnippet com.azure.storage.file.shareClient.getPermission#string} + * + * @param filePermissionKey The file permission key. + * @return The file permission associated with the file permission key. + */ + public String getPermission(String filePermissionKey) { + return getPermissionWithResponse(filePermissionKey, Context.NONE).value(); + } + + /** + * Gets a permission for a given key. + * + *

                  Code Samples

                  + * + * {@codesnippet com.azure.storage.file.shareClient.getPermissionWithResponse#string-context} + * + * @param filePermissionKey The file permission key. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response that contains th file permission associated with the file permission key. + */ + public Response getPermissionWithResponse(String filePermissionKey, Context context) { + return client.getPermissionWithResponse(filePermissionKey, context).block(); } /** @@ -484,4 +725,74 @@ public VoidResponse deleteFile(String fileName) { public String getSnapshotId() { return client.getSnapshotId(); } + + /** + * Generates a SAS token with the specified parameters + * + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param permissions The {@code ShareSASPermission} permission for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(OffsetDateTime expiryTime, ShareSASPermission permissions) { + return this.client.generateSAS(permissions, expiryTime); + } + + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier) { + return this.client.generateSAS(identifier); + } + + /** + * Generates a SAS token with the specified parameters + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code ShareSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, ShareSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { + return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange); + } + + /** + * Generates a SAS token with the specified parameters + * + *

                  Code Samples

                  + * + * {@codesnippet com.azure.storage.file.ShareClient.generateSAS#String-ShareSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param identifier The {@code String} name of the access policy on the share this SAS references if any + * @param permissions The {@code ShareSASPermission} permission for the SAS + * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * @param startTime An optional {@code OffsetDateTime} start time for the SAS + * @param version An optional {@code String} version for the SAS + * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS + * @param ipRange An optional {@code IPRange} ip address range for the SAS + * @param cacheControl An optional {@code String} cache-control header for the SAS. + * @param contentDisposition An optional {@code String} content-disposition header for the SAS. + * @param contentEncoding An optional {@code String} content-encoding header for the SAS. + * @param contentLanguage An optional {@code String} content-language header for the SAS. + * @param contentType An optional {@code String} content-type header for the SAS. + * @return A string that represents the SAS token + */ + public String generateSAS(String identifier, ShareSASPermission permissions, OffsetDateTime expiryTime, + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { + return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java index e175993d7579..46f7df48ea1f 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java @@ -3,39 +3,25 @@ package com.azure.storage.file; -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.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.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; 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 ShareClient ShareClients} - * and {@link ShareAsyncClient SahreAsyncClients}, calling {@link ShareClientBuilder#buildClient() buildClient} + * and {@link ShareAsyncClient ShareAsyncClients}, calling {@link ShareClientBuilder#buildClient() buildClient} * constructs an instance of ShareClient and calling {@link ShareClientBuilder#buildAsyncClient() buildAsyncClient} - * constructs an instance of SahreAsyncClient. + * constructs an instance of ShareAsyncClient. * *

                  The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. * {@link ShareClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the @@ -70,30 +56,35 @@ * @see SASTokenCredential * @see SharedKeyCredential */ -public class ShareClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private final List policies; +@ServiceClientBuilder(serviceClients = {ShareClient.class, ShareAsyncClient.class}) +public class ShareClientBuilder extends BaseFileClientBuilder { - private URL endpoint; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; + private final ClientLogger logger = new ClientLogger(ShareClientBuilder.class); private String shareName; private String snapshot; - 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 ShareClient ShareClients} * and {@link ShareAsyncClient ShareAsyncClients}. */ - public ShareClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - configuration = ConfigurationManager.getConfiguration(); + public ShareClientBuilder() { } + + private AzureFileStorageImpl constructImpl() { + Objects.requireNonNull(shareName); + + 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 AzureFileStorageBuilder() + .url(super.endpoint) + .pipeline(pipeline) + .build(); } /** @@ -111,43 +102,7 @@ public ShareClientBuilder() { * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. */ public ShareAsyncClient buildAsyncClient() { - Objects.requireNonNull(shareName); - - if (pipeline != null) { - return new ShareAsyncClient(endpoint, pipeline, shareName, snapshot); - } - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - 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 ShareAsyncClient(endpoint, pipeline, shareName, snapshot); + return new ShareAsyncClient(constructImpl(), shareName, snapshot); } /** @@ -181,79 +136,33 @@ public ShareClient buildClient() { * @return the updated ShareClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL */ + @Override public ShareClientBuilder endpoint(String 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 share name from the URL passed + String[] pathSegments = fullURL.getPath().split("/"); + int length = pathSegments.length; + if (length >= 3) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Cannot accept a URL to a file or directory to construct a file share client")); + } + this.shareName = length >= 2 ? pathSegments[1] : this.shareName; // 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; + SASTokenCredential sasTokenCredential = SASTokenCredential.fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed.")); } return this; } - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public ShareClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - return this; - } - - /** - * Sets the {@link SharedKeyCredential} used to authenticate requests sent to the File service. - * - * @param credential Shared key credential generated from the Storage account that authorizes requests - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public ShareClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.sasTokenCredential = null; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public ShareClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map 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.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); - } - } - /** * Sets the share that the constructed clients will interact with * @@ -272,77 +181,9 @@ public ShareClientBuilder shareName(String shareName) { * * @param snapshot Identifier of the snapshot * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code snapshot} is {@code null}. */ public ShareClientBuilder snapshot(String snapshot) { - this.snapshot = Objects.requireNonNull(snapshot); - return this; - } - - /** - * 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 ShareClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public ShareClientBuilder 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 ShareClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public ShareClientBuilder 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 ShareClientBuilder object. - */ - public ShareClientBuilder 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 ShareClientBuilder#endpoint(String) endpoint}, - * {@link ShareClientBuilder#shareName(String) shareName}, and {@link ShareClientBuilder#snapshot(String) snaphotShot} - * when building clients.

                  - * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated ShareClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public ShareClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(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 ShareClientBuilder object. - * @throws NullPointerException If {@code configuration} is {@code null}. - */ - public ShareClientBuilder configuration(Configuration configuration) { - this.configuration = Objects.requireNonNull(configuration); + this.snapshot = snapshot; return this; } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareSASPermission.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareSASPermission.java new file mode 100644 index 000000000000..4daf1addd87f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareSASPermission.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file; + + +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 share. + * 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 FileServiceSASSignatureValues} 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 ShareSASPermission { + private boolean read; + + private boolean create; + + private boolean write; + + private boolean delete; + + private boolean list; + + /** + * Initializes an {@code ShareSASPermission} object with all fields set to false. + */ + public ShareSASPermission() { + } + + /** + * Creates an {@code ShareSASPermission} 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 ShareSASPermission}. + * + * @return A {@code ShareSASPermission} generated from the given {@code String}. + * @throws IllegalArgumentException If {@code permString} contains a character other than r, c, w, d, or l. + */ + public static ShareSASPermission parse(String permString) { + ShareSASPermission permissions = new ShareSASPermission(); + + for (int i = 0; i < permString.length(); i++) { + char c = permString.charAt(i); + switch (c) { + case 'r': + permissions.read = true; + break; + case 'c': + permissions.create = true; + break; + case 'w': + permissions.write = true; + break; + case 'd': + permissions.delete = true; + break; + case 'l': + permissions.list = 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 read() { + return read; + } + + /** + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated ShareSASPermission object + */ + public ShareSASPermission read(boolean read) { + this.read = read; + return this; + } + + /** + * @return the create permission status + */ + public boolean create() { + return create; + } + + /** + * Sets the create permission status. + * + * @param create Permission status to set + * @return the updated ShareSASPermission object + */ + public ShareSASPermission create(boolean create) { + this.create = create; + return this; + } + + /** + * @return the write permission status + */ + public boolean write() { + return write; + } + + /** + * Sets the write permission status. + * + * @param write Permission status to set + * @return the updated ShareSASPermission object + */ + public ShareSASPermission write(boolean write) { + this.write = write; + return this; + } + + /** + * @return the delete permission status + */ + public boolean delete() { + return delete; + } + + /** + * Sets the delete permission status. + * + * @param delete Permission status to set + * @return the updated ShareSASPermission object + */ + public ShareSASPermission delete(boolean delete) { + this.delete = delete; + return this; + } + + /** + * @return the list permission status + */ + public boolean list() { + return list; + } + + /** + * Sets the list permission status. + * + * @param list Permission status to set + * @return the updated ShareSASPermission object + */ + public ShareSASPermission list(boolean list) { + this.list = list; + 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 ShareSASPermission}. + */ + @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.create) { + builder.append('c'); + } + + if (this.write) { + builder.append('w'); + } + + if (this.delete) { + builder.append('d'); + } + + if (this.list) { + builder.append('l'); + } + + return builder.toString(); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java index 39584a1738f9..b4c6646822aa 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java @@ -74,7 +74,7 @@ public AzureFileStorageImpl build() { if (this.version != null) { client.setVersion(this.version); } else { - client.setVersion("2018-11-09"); + client.setVersion("2019-02-02"); } if (this.url != null) { client.setUrl(this.url); diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java index 4d6953cdd9d0..d1f49570b6ff 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java @@ -26,6 +26,7 @@ import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; import com.azure.storage.file.models.DirectorysListHandlesResponse; import com.azure.storage.file.models.DirectorysSetMetadataResponse; +import com.azure.storage.file.models.DirectorysSetPropertiesResponse; import com.azure.storage.file.models.StorageErrorException; import java.util.Map; import reactor.core.publisher.Mono; @@ -65,7 +66,7 @@ private interface DirectorysService { @Put("{shareName}/{directoryPath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono create(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("restype") String restype, Context context); @Get("{shareName}/{directoryPath}") @ExpectedResponses({200}) @@ -77,6 +78,11 @@ private interface DirectorysService { @UnexpectedResponseExceptionType(StorageErrorException.class) Mono delete(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + @Put("{shareName}/{directoryPath}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono setProperties(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + @Put("{shareName}/{directoryPath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) @@ -103,16 +109,21 @@ private interface DirectorysService { * * @param shareName The name of the target share. * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @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 shareName, String directoryPath, Context context) { + public Mono createWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final Map metadata = null; + final String filePermission = null; + final String filePermissionKey = null; final String restype = "directory"; - return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), restype, context); + return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, context); } /** @@ -120,16 +131,21 @@ public Mono createWithRestResponseAsync(String shareNa * * @param shareName The name of the target share. * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. * @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 shareName, String directoryPath, Integer timeout, Map metadata, Context context) { + public Mono createWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Map metadata, String filePermission, String filePermissionKey, Context context) { final String restype = "directory"; - return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), restype, context); + return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, context); } /** @@ -198,6 +214,50 @@ public Mono deleteWithRestResponseAsync(String shareNa return service.delete(shareName, directoryPath, this.client.getUrl(), timeout, this.client.getVersion(), restype, context); } + /** + * Sets properties on the directory. + * + * @param shareName The name of the target share. + * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. + * @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 setPropertiesWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { + final Integer timeout = null; + final String filePermission = null; + final String filePermissionKey = null; + final String restype = "directory"; + final String comp = "properties"; + return service.setProperties(shareName, directoryPath, this.client.getUrl(), timeout, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, comp, context); + } + + /** + * Sets properties on the directory. + * + * @param shareName The name of the target share. + * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @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 setPropertiesWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, String filePermission, String filePermissionKey, Context context) { + final String restype = "directory"; + final String comp = "properties"; + return service.setProperties(shareName, directoryPath, this.client.getUrl(), timeout, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, comp, context); + } + /** * Updates user defined metadata for the specified directory. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java index 5a3ea58d911c..0b41902369f2 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java @@ -35,9 +35,11 @@ import com.azure.storage.file.models.FilesSetHTTPHeadersResponse; import com.azure.storage.file.models.FilesSetMetadataResponse; import com.azure.storage.file.models.FilesStartCopyResponse; +import com.azure.storage.file.models.FilesUploadRangeFromURLResponse; import com.azure.storage.file.models.FilesUploadRangeResponse; +import com.azure.storage.file.models.SourceModifiedAccessConditions; import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; +import java.nio.ByteBuffer; import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -77,7 +79,7 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono create(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); @Get("{shareName}/{filePath}") @ExpectedResponses({200, 206}) @@ -96,7 +98,7 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setHTTPHeaders(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono setHTTPHeaders(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); @Put("{shareName}/{filePath}") @ExpectedResponses({200}) @@ -106,7 +108,12 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadRange(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono uploadRange(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + + @Put("{shareName}/{filePath}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono uploadRangeFromURL(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-write") String fileRangeWriteFromUrl, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-source-content-crc64") String sourceContentCrc64, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, @HeaderParam("x-ms-source-if-match-crc64") String sourceIfMatchCrc64, @HeaderParam("x-ms-source-if-none-match-crc64") String sourceIfNoneMatchCrc64, Context context); @Get("{shareName}/{filePath}") @ExpectedResponses({200}) @@ -140,22 +147,27 @@ private interface FilesService { * @param shareName The name of the target share. * @param filePath The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @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 shareName, String filePath, long fileContentLength, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final String fileTypeConstant = "file"; final Map metadata = null; + final String filePermission = null; + final String filePermissionKey = null; final String fileContentType = null; final String fileContentEncoding = null; final String fileContentLanguage = null; final String fileCacheControl = null; final String fileContentDisposition = null; String fileContentMD5Converted = null; - return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -164,15 +176,20 @@ public Mono createWithRestResponseAsync(String shareName, S * @param shareName The name of the target share. * @param filePath The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. * @param fileHTTPHeaders 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 shareName, String filePath, long fileContentLength, Integer timeout, Map metadata, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Map metadata, String filePermission, String filePermissionKey, FileHTTPHeaders fileHTTPHeaders, Context context) { final String fileTypeConstant = "file"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -199,7 +216,7 @@ public Mono createWithRestResponseAsync(String shareName, S fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); } String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -303,14 +320,19 @@ public Mono deleteWithRestResponseAsync(String shareName, S * * @param shareName The name of the target share. * @param filePath The path of the target file. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @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 setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Context context) { + public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final Long fileContentLength = null; + final String filePermission = null; + final String filePermissionKey = null; final String comp = "properties"; final String fileContentType = null; final String fileContentEncoding = null; @@ -318,7 +340,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str final String fileCacheControl = null; final String fileContentDisposition = null; String fileContentMD5Converted = null; - return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -326,15 +348,20 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * * @param shareName The name of the target share. * @param filePath The path of the target file. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param fileContentLength Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. * @param fileHTTPHeaders 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 setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Integer timeout, Long fileContentLength, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Long fileContentLength, String filePermission, String filePermissionKey, FileHTTPHeaders fileHTTPHeaders, Context context) { final String comp = "properties"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -361,7 +388,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); } String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -412,7 +439,7 @@ public Mono setMetadataWithRestResponseAsync(String sh */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Context context) { - final Flux optionalbody = null; + final Flux optionalbody = null; final Integer timeout = null; final String comp = "range"; String contentMD5Converted = null; @@ -435,12 +462,70 @@ public Mono uploadRangeWithRestResponseAsync(String sh * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { + public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { final String comp = "range"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); return service.uploadRange(shareName, filePath, this.client.getUrl(), optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), comp, context); } + /** + * Upload a range of bytes to a file where the contents are read from a URL. + * + * @param shareName The name of the target share. + * @param filePath The path of the target file. + * @param range Writes data to the specified byte range in the file. + * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. + * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. + * @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 uploadRangeFromURLWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Context context) { + final Integer timeout = null; + final String sourceRange = null; + final String fileRangeWriteFromUrl = "update"; + final String comp = "range"; + String sourceContentCrc64Converted = null; + String sourceIfMatchCrc64Converted = null; + String sourceIfNoneMatchCrc64Converted = null; + return service.uploadRangeFromURL(shareName, filePath, this.client.getUrl(), timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, this.client.getVersion(), comp, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, context); + } + + /** + * Upload a range of bytes to a file where the contents are read from a URL. + * + * @param shareName The name of the target share. + * @param filePath The path of the target file. + * @param range Writes data to the specified byte range in the file. + * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. + * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentCrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. + * @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 uploadRangeFromURLWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Integer timeout, String sourceRange, byte[] sourceContentCrc64, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + final String fileRangeWriteFromUrl = "update"; + final String comp = "range"; + byte[] sourceIfMatchCrc64 = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatchCrc64 = sourceModifiedAccessConditions.sourceIfMatchCrc64(); + } + byte[] sourceIfNoneMatchCrc64 = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatchCrc64 = sourceModifiedAccessConditions.sourceIfNoneMatchCrc64(); + } + String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); + String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); + String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); + return service.uploadRangeFromURL(shareName, filePath, this.client.getUrl(), timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, this.client.getVersion(), comp, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, context); + } + /** * Returns the list of valid ranges for a file. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java index d847d3ecd9ff..d300e7703ef0 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java @@ -21,10 +21,13 @@ import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.util.Context; import com.azure.storage.file.models.DeleteSnapshotsOptionType; +import com.azure.storage.file.models.SharePermission; +import com.azure.storage.file.models.SharesCreatePermissionResponse; import com.azure.storage.file.models.SharesCreateResponse; import com.azure.storage.file.models.SharesCreateSnapshotResponse; import com.azure.storage.file.models.SharesDeleteResponse; import com.azure.storage.file.models.SharesGetAccessPolicyResponse; +import com.azure.storage.file.models.SharesGetPermissionResponse; import com.azure.storage.file.models.SharesGetPropertiesResponse; import com.azure.storage.file.models.SharesGetStatisticsResponse; import com.azure.storage.file.models.SharesSetAccessPolicyResponse; @@ -88,6 +91,16 @@ private interface SharesService { @UnexpectedResponseExceptionType(StorageErrorException.class) Mono createSnapshot(@PathParam("shareName") String shareName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + @Put("{shareName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono createPermission(@PathParam("shareName") String shareName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @BodyParam("application/json; charset=utf-8") SharePermission sharePermission, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + + @Get("{shareName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono getPermission(@PathParam("shareName") String shareName, @HostParam("url") String url, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + @Put("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) @@ -248,6 +261,74 @@ public Mono createSnapshotWithRestResponseAsync(St return service.createSnapshot(shareName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), restype, comp, context); } + /** + * Create a permission (a security descriptor). + * + * @param shareName The name of the target share. + * @param sharePermission A permission (a security descriptor) at the share level. + * @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 createPermissionWithRestResponseAsync(String shareName, SharePermission sharePermission, Context context) { + final Integer timeout = null; + final String restype = "share"; + final String comp = "filepermission"; + return service.createPermission(shareName, this.client.getUrl(), timeout, this.client.getVersion(), sharePermission, restype, comp, context); + } + + /** + * Create a permission (a security descriptor). + * + * @param shareName The name of the target share. + * @param sharePermission A permission (a security descriptor) at the share level. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @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 createPermissionWithRestResponseAsync(String shareName, SharePermission sharePermission, Integer timeout, Context context) { + final String restype = "share"; + final String comp = "filepermission"; + return service.createPermission(shareName, this.client.getUrl(), timeout, this.client.getVersion(), sharePermission, restype, comp, context); + } + + /** + * Returns the permission (security descriptor) for a given key. + * + * @param shareName The name of the target share. + * @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 getPermissionWithRestResponseAsync(String shareName, Context context) { + final String filePermissionKey = null; + final Integer timeout = null; + final String restype = "share"; + final String comp = "filepermission"; + return service.getPermission(shareName, this.client.getUrl(), filePermissionKey, timeout, this.client.getVersion(), restype, comp, context); + } + + /** + * Returns the permission (security descriptor) for a given key. + * + * @param shareName The name of the target share. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @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 getPermissionWithRestResponseAsync(String shareName, String filePermissionKey, Integer timeout, Context context) { + final String restype = "share"; + final String comp = "filepermission"; + return service.getPermission(shareName, this.client.getUrl(), filePermissionKey, timeout, this.client.getVersion(), restype, comp, context); + } + /** * Sets quota for the specified share. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/CustomFileAndDirectoryListingDeserializer.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/CustomFileAndDirectoryListingDeserializer.java new file mode 100644 index 000000000000..ce7606f4658f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/CustomFileAndDirectoryListingDeserializer.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.models; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +import java.io.IOException; +import java.util.ArrayList; + +final class CustomFileAndDirectoryListingDeserializer extends JsonDeserializer { + @Override + public FilesAndDirectoriesListSegment deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + ArrayList directoryItems = new ArrayList<>(); + ArrayList fileItems = new ArrayList<>(); + + JsonDeserializer directoryItemDeserializer = + ctxt.findRootValueDeserializer(ctxt.constructType(DirectoryItem.class)); + JsonDeserializer fileItemDeserializer = + ctxt.findRootValueDeserializer(ctxt.constructType(FileItem.class)); + + for (JsonToken currentToken = p.nextToken(); !currentToken.name().equals("END_OBJECT"); + currentToken = p.nextToken()) { + // Get to the root element of the next item. + p.nextToken(); + + if (p.getCurrentName().equals("Directory")) { + directoryItems.add((DirectoryItem) directoryItemDeserializer.deserialize(p, ctxt)); + } else if (p.getCurrentName().equals("File")) { + fileItems.add((FileItem) fileItemDeserializer.deserialize(p, ctxt)); + } + } + + return new FilesAndDirectoriesListSegment().directoryItems(directoryItems).fileItems(fileItems); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java index 2d9e1b99dda5..2ffa84d00254 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java @@ -60,6 +60,48 @@ public final class DirectoryCreateHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; + /* + * Key of the permission set for the directory. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the directory. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the directory. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the directory. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the directory. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -218,6 +260,148 @@ public DirectoryCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the directory. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the directory. + * + * @param fileAttributes the fileAttributes value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the directory. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the directory. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the directory. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the directory. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the directory. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the directory. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java index 3e42c0318f67..0656e0fd3a8e 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java @@ -67,6 +67,48 @@ public final class DirectoryGetPropertiesHeaders { @JsonProperty(value = "x-ms-server-encrypted") private Boolean isServerEncrypted; + /* + * Attributes set for the directory. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the directory. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the directory. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the directory. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * Key of the permission set for the directory. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -243,6 +285,148 @@ public DirectoryGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted return this; } + /** + * Get the fileAttributes property: Attributes set for the directory. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the directory. + * + * @param fileAttributes the fileAttributes value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the directory. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the directory. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the directory. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the directory. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the directory. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the directory. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java index d651cbdb0e89..9fb20b346320 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java @@ -3,6 +3,8 @@ package com.azure.storage.file.models; +import com.azure.storage.file.FileSmbProperties; + import java.time.OffsetDateTime; /** @@ -11,16 +13,19 @@ public final class DirectoryInfo { private final String eTag; private final OffsetDateTime lastModified; + private final FileSmbProperties smbProperties; /** * Creates an instance of information about a specific Directory. * * @param eTag Entity tag that corresponds to the directory. * @param lastModified Last time the directory was modified. + * @param smbProperties The SMB properties of the directory. */ - public DirectoryInfo(final String eTag, final OffsetDateTime lastModified) { + public DirectoryInfo(final String eTag, final OffsetDateTime lastModified, final FileSmbProperties smbProperties) { this.eTag = eTag; this.lastModified = lastModified; + this.smbProperties = smbProperties; } /** @@ -36,4 +41,11 @@ public String eTag() { public OffsetDateTime lastModified() { return lastModified; } + + /** + * @return The SMB Properties of the directory. + */ + public FileSmbProperties smbProperties() { + return smbProperties; + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java index 5ce45d09456b..6a6823e5fb43 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java @@ -3,6 +3,8 @@ package com.azure.storage.file.models; +import com.azure.storage.file.FileSmbProperties; + import java.time.OffsetDateTime; import java.util.Map; @@ -14,6 +16,7 @@ public final class DirectoryProperties { private final String eTag; private final OffsetDateTime lastModified; private final boolean isServerEncrypted; + private final FileSmbProperties smbProperties; /** * Creates an instance of properties information about a specific Directory. @@ -22,12 +25,14 @@ public final class DirectoryProperties { * @param eTag Entity tag that corresponds to the directory. * @param lastModified Last time the directory was modified. * @param isServerEncrypted The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false. + * @param smbProperties The SMB properties of the directory. */ - public DirectoryProperties(final Map metadata, final String eTag, final OffsetDateTime lastModified, final boolean isServerEncrypted) { + public DirectoryProperties(final Map metadata, final String eTag, final OffsetDateTime lastModified, final boolean isServerEncrypted, final FileSmbProperties smbProperties) { this.metadata = metadata; this.eTag = eTag; this.lastModified = lastModified; this.isServerEncrypted = isServerEncrypted; + this.smbProperties = smbProperties; } /** @@ -57,4 +62,11 @@ public OffsetDateTime lastModified() { public boolean isServerEncrypted() { return isServerEncrypted; } + + /** + * @return The SMB Properties of the directory. + */ + public FileSmbProperties smbProperties() { + return smbProperties; + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorySetPropertiesHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorySetPropertiesHeaders.java new file mode 100644 index 000000000000..f6a7c522af40 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorySetPropertiesHeaders.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.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 SetProperties operation. + */ +@JacksonXmlRootElement(localName = "Directory-SetProperties-Headers") +@Fluent +public final class DirectorySetPropertiesHeaders { + /* + * The ETag contains a value which represents the version of the file, in + * quotes. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * 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; + + /* + * Returns the date and time the directory was last modified. Any operation + * that modifies the directory or its properties updates the last modified + * time. Operations on files do not affect the last modified time of the + * directory. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * Indicates the version of the File service used to execute 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; + + /* + * 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. + */ + @JsonProperty(value = "x-ms-request-server-encrypted") + private Boolean isServerEncrypted; + + /* + * Key of the permission set for the directory. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the directory. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the directory. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the directory. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the directory. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @param eTag the eTag value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders eTag(String eTag) { + this.eTag = eTag; + 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 DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the directory or its + * properties updates the last modified time. Operations on files do not + * affect the last modified time of the directory. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the directory or its + * properties updates the last modified time. Operations on files do not + * affect the last modified time of the directory. + * + * @param lastModified the lastModified value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders version(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + 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 + * specified algorithm, and false otherwise. + * + * @return the isServerEncrypted value. + */ + public Boolean isServerEncrypted() { + return this.isServerEncrypted; + } + + /** + * Set the isServerEncrypted property: 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. + * + * @param isServerEncrypted the isServerEncrypted value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { + this.isServerEncrypted = isServerEncrypted; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the directory. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the directory. + * + * @param fileAttributes the fileAttributes value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the directory. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the directory. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the directory. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the directory. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the directory. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the directory. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + 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 DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java index a65683e6cfc8..30428f1ff523 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the create operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java index 239dcaba95e5..d876b3f39247 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the delete operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java index c3aaa1f5ce71..3aac63c6d101 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the forceCloseHandles operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java index 1e2295bf6f6f..d8753cf12931 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the getProperties operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java index cd8966e8fbf4..cd78ea8994af 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the listFilesAndDirectoriesSegment operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java index 267a2615ae5e..a41229655b46 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the listHandles operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java index e3eee5271a13..cc3393de4d38 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setMetadata operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetPropertiesResponse.java new file mode 100644 index 000000000000..1381e0fa86c7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetPropertiesResponse.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.util.Map; + +/** + * Contains all response data for the setProperties operation. + */ +public final class DirectorysSetPropertiesResponse extends ResponseBase { + /** + * Creates an instance of DirectorysSetPropertiesResponse. + * + * @param request the request which resulted in this DirectorysSetPropertiesResponse. + * @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 DirectorysSetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectorySetPropertiesHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java index 581e232cc3ce..1cbd74988f7d 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java @@ -60,6 +60,48 @@ public final class FileCreateHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the file. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the file. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -218,6 +260,148 @@ public FileCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the file. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the file. + * + * @param fileId the fileId value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the file. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the file. + * + * @param fileParentId the fileParentId value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java index 7ac009d11d0c..2506f470e547 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java @@ -187,6 +187,48 @@ public final class FileDownloadHeaders { @JsonProperty(value = "x-ms-server-encrypted") private Boolean isServerEncrypted; + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The fileId of the file. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the file. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -762,6 +804,148 @@ public FileDownloadHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileId property: The fileId of the file. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the file. + * + * @param fileId the fileId value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the file. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the file. + * + * @param fileParentId the fileParentId value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java index 74ce72c7315e..a4a88dea82cb 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java @@ -3,10 +3,12 @@ package com.azure.storage.file.models; -import io.netty.buffer.ByteBuf; +import com.azure.storage.file.FileSmbProperties; +import reactor.core.publisher.Flux; + +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; -import reactor.core.publisher.Flux; /** * Contains download information about a File in the storage File service. @@ -18,7 +20,8 @@ public final class FileDownloadInfo { private final Long contentLength; private final String contentType; private final String contentRange; - private final Flux body; + private final Flux body; + private final FileSmbProperties smbProperties; /** * Creates an instance of download information about a specific File. @@ -30,8 +33,9 @@ public final class FileDownloadInfo { * @param contentType The content type specified for the file. The default content type is application/octet-stream. * @param contentRange Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header. * @param body The download request body. + * @param smbProperties The SMB properties of the file. */ - public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, final Map metadata, final Long contentLength, final String contentType, final String contentRange, final Flux body) { + public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, final Map metadata, final Long contentLength, final String contentType, final String contentRange, final Flux body, final FileSmbProperties smbProperties) { this.eTag = eTag; this.lastModified = lastModified; this.metadata = metadata; @@ -39,6 +43,7 @@ public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, fi this.contentType = contentType; this.contentRange = contentRange; this.body = body; + this.smbProperties = smbProperties; } /** @@ -86,7 +91,14 @@ public String contentRange() { /** * @return The download request body. */ - public Flux body() { + public Flux body() { return body; } + + /** + * @return The SMB properties of the file. + */ + public FileSmbProperties smbProperties() { + return smbProperties; + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java index 05059ba57cc4..2f3f28906ead 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java @@ -170,6 +170,48 @@ public final class FileGetPropertiesHeaders { @JsonProperty(value = "x-ms-server-encrypted") private Boolean isServerEncrypted; + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The fileId of the file. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the file. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -689,6 +731,148 @@ public FileGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileId property: The fileId of the file. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the file. + * + * @param fileId the fileId value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the file. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the file. + * + * @param fileParentId the fileParentId value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileInfo.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileInfo.java index 4f421f0b7934..a9e6cda51a84 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileInfo.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileInfo.java @@ -3,6 +3,8 @@ package com.azure.storage.file.models; +import com.azure.storage.file.FileSmbProperties; + import java.time.OffsetDateTime; /** @@ -12,6 +14,7 @@ public final class FileInfo { private final String eTag; private final OffsetDateTime lastModified; private final Boolean isServerEncrypted; + private final FileSmbProperties smbProperties; /** * Creates an instance of information about a specific Directory. @@ -19,11 +22,13 @@ public final class FileInfo { * @param eTag Entity tag that corresponds to the directory. * @param lastModified Last time the directory was modified. * @param isServerEncrypted The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false. + * @param smbProperties The SMB properties of the file. */ - public FileInfo(final String eTag, final OffsetDateTime lastModified, final Boolean isServerEncrypted) { + public FileInfo(final String eTag, final OffsetDateTime lastModified, final Boolean isServerEncrypted, final FileSmbProperties smbProperties) { this.eTag = eTag; this.lastModified = lastModified; this.isServerEncrypted = isServerEncrypted; + this.smbProperties = smbProperties; } /** @@ -46,4 +51,11 @@ public OffsetDateTime lastModified() { public Boolean isServerEncrypted() { return isServerEncrypted; } + + /** + * @return The SMB Properties of the file. + */ + public FileSmbProperties smbProperties() { + return smbProperties; + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileProperties.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileProperties.java index 670057a600b7..203db66133bc 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileProperties.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileProperties.java @@ -4,6 +4,8 @@ package com.azure.storage.file.models; import com.azure.core.implementation.util.ImplUtils; +import com.azure.storage.file.FileSmbProperties; + import java.time.OffsetDateTime; import java.util.Map; @@ -28,6 +30,7 @@ public final class FileProperties { private final String copySource; private final CopyStatusType copyStatus; private final Boolean isServerEncrypted; + private final FileSmbProperties smbProperties; /** * Creates an instance of property information about a specific File. @@ -53,12 +56,14 @@ public final class FileProperties { * - aborted: Copy was ended by Abort Copy File. * - failed: Copy failed. See x-ms-copy-status-description for failure details. * @param isServerEncrypted The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false. + * @param smbProperties The SMB properties of the file. */ public FileProperties(final String eTag, final OffsetDateTime lastModified, final Map metadata, final String fileType, final Long contentLength, final String contentType, final byte[] contentMD5, final String contentEncoding, final String cacheControl, final String contentDisposition, final OffsetDateTime copyCompletionTime, final String copyStatusDescription, final String copyId, - final String copyProgress, final String copySource, final CopyStatusType copyStatus, final Boolean isServerEncrypted) { + final String copyProgress, final String copySource, final CopyStatusType copyStatus, + final Boolean isServerEncrypted, final FileSmbProperties smbProperties) { this.eTag = eTag; this.lastModified = lastModified; this.metadata = metadata; @@ -76,6 +81,7 @@ public FileProperties(final String eTag, final OffsetDateTime lastModified, fina this.copySource = copySource; this.copyStatus = copyStatus; this.isServerEncrypted = isServerEncrypted; + this.smbProperties = smbProperties; } /** @@ -199,4 +205,11 @@ public CopyStatusType copyStatus() { public Boolean isServerEncrypted() { return isServerEncrypted; } + + /** + * @return The SMB properties of the file. + */ + public FileSmbProperties smbProperties() { + return smbProperties; + } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java index 9c264f3f4f8f..187ff0bd81b4 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java @@ -22,6 +22,16 @@ public FileRange(final long start, final Long end) { this.end = end; } + /** + * Creates an instance of the range of a file from the passed {@link Range}. + * + * @param range Range object containing start and end of the file. + */ + public FileRange(final Range range) { + this.start = range.start(); + this.end = range.end(); + } + /** * @return The start of bytes to be written. */ diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java index 8ed977bee61c..b4f7456608f0 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java @@ -3,9 +3,12 @@ package com.azure.storage.file.models; +import com.azure.core.implementation.annotation.Immutable; + /** * Contains file or directory reference information in the storage File service. */ +@Immutable public final class FileRef { private final String name; private final boolean isDirectory; @@ -24,7 +27,6 @@ public FileRef(final String name, final boolean isDirectory, final FileProperty this.fileProperty = fileProperty; } - /** * @return Name of the file or the directory. */ diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java index 6d50bff6a3ca..7ae2e8e0c7b4 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java @@ -60,6 +60,48 @@ public final class FileSetHTTPHeadersHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -218,6 +260,148 @@ public FileSetHTTPHeadersHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileUploadRangeFromURLHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileUploadRangeFromURLHeaders.java new file mode 100644 index 000000000000..8cf6f922ce03 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileUploadRangeFromURLHeaders.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.util.ImplUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for UploadRangeFromURL operation. + */ +@JacksonXmlRootElement(localName = "File-UploadRangeFromURL-Headers") +@Fluent +public final class FileUploadRangeFromURLHeaders { + /* + * The ETag contains a value which represents the version of the file, in + * quotes. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * Returns the date and time the directory was last modified. Any operation + * that modifies the share or its properties or metadata updates the last + * modified time. Operations on files do not affect the last modified time + * of the share. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the File service; it + * is not necessarily the same value as may have been 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. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the File service used to execute 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; + + /* + * 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. + */ + @JsonProperty(value = "x-ms-request-server-encrypted") + private Boolean isServerEncrypted; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @param eTag the eTag value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the share or its + * properties or metadata updates the last modified time. Operations on + * files do not affect the last modified time of the share. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the share or its + * properties or metadata updates the last modified time. Operations on + * files do not affect the last modified time of the share. + * + * @param lastModified the lastModified value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + 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 File service; it is not necessarily the same value as + * may have been specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + 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 File service; it is not necessarily the same value as + * may have been specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders xMsContentCrc64(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() { + 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 FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders version(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + 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 + * specified algorithm, and false otherwise. + * + * @return the isServerEncrypted value. + */ + public Boolean isServerEncrypted() { + return this.isServerEncrypted; + } + + /** + * Set the isServerEncrypted property: 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. + * + * @param isServerEncrypted the isServerEncrypted value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders isServerEncrypted(Boolean isServerEncrypted) { + this.isServerEncrypted = isServerEncrypted; + 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 FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java index c34ccb2996d0..09db7ab35b46 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the abortCopy operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java index 8888fe5a155c..5f9e165dea64 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java @@ -6,6 +6,7 @@ import com.azure.core.implementation.annotation.Fluent; 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; @@ -15,6 +16,7 @@ */ @JacksonXmlRootElement(localName = "Entries") @Fluent +@JsonDeserialize(using = CustomFileAndDirectoryListingDeserializer.class) public final class FilesAndDirectoriesListSegment { /* * The directoryItems property. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java index 01e483722bd1..d71c106eb42c 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the create operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java index cfeb40f49cac..79181f817eb3 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the delete operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java index b9a1d0270c15..d1261f5d0ce1 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java @@ -7,14 +7,15 @@ 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 java.util.Map; import reactor.core.publisher.Flux; /** * Contains all response data for the download operation. */ -public final class FilesDownloadResponse extends ResponseBase> implements Closeable { +public final class FilesDownloadResponse extends ResponseBase> implements Closeable { /** * Creates an instance of FilesDownloadResponse. * @@ -24,7 +25,7 @@ public final class FilesDownloadResponse extends ResponseBase value, FileDownloadHeaders headers) { + public FilesDownloadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, FileDownloadHeaders headers) { super(request, statusCode, rawHeaders, value, headers); } @@ -32,7 +33,7 @@ public FilesDownloadResponse(HttpRequest request, int statusCode, HttpHeaders ra * @return the response content stream. */ @Override - public Flux value() { + public Flux value() { return super.value(); } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java index 2d4b04103b29..1e9d6401f6e7 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the forceCloseHandles operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java index 82f13783a111..ae753a1e3359 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the getProperties operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java index ed71044cd06b..73a916bf4e3c 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; import java.util.List; +import java.util.Map; /** * Contains all response data for the getRangeList operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java index 20a1d9d78e51..f4615e29ae60 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the listHandles operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java index c21fdbfe0199..124ebcc7e2c5 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setHTTPHeaders operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java index c46035850b21..691711afae39 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setMetadata operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java index c19c3285eb5b..1824a11821ff 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the startCopy operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeFromURLResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeFromURLResponse.java new file mode 100644 index 000000000000..e4c345083631 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeFromURLResponse.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.util.Map; + +/** + * Contains all response data for the uploadRangeFromURL operation. + */ +public final class FilesUploadRangeFromURLResponse extends ResponseBase { + /** + * Creates an instance of FilesUploadRangeFromURLResponse. + * + * @param request the request which resulted in this FilesUploadRangeFromURLResponse. + * @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 FilesUploadRangeFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileUploadRangeFromURLHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java index 1ed359c9e70b..2afc6cbbc012 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the uploadRange operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/NtfsFileAttributes.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/NtfsFileAttributes.java new file mode 100644 index 000000000000..c91f43cf8b83 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/NtfsFileAttributes.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.models; + +import com.azure.storage.common.Constants; + +import java.util.EnumSet; + +/** + * Specifies options for NTFS File Attributes. + */ +public enum NtfsFileAttributes { + + /** + * The file is read-only. + */ + READ_ONLY, + + /** + * The file is hidden, and thus is not included in ordinary directory listing. + */ + HIDDEN, + + /** + * The file is a system file. That is, the file is part of the operating system + * or is used exclusively by the operating system. + */ + SYSTEM, + + /** + * The file is a standard file that has no special attributes. + */ + NORMAL, + + /** + * The file is a directory. + */ + DIRECTORY, + + /** + * The file is a candidate for backup or removal. + */ + ARCHIVE, + + /** + * The file is temporary. A temporary file contains data that is needed while an + * application is executing but is not needed after the application is finished. + * File systems try to keep all the data in memory for quicker access rather than + * flushing the data back to mass storage. A temporary file should be deleted by + * the application as soon as it is no longer needed. + */ + TEMPORARY, + + /** + * The file is offline. The data of the file is not immediately available. + */ + OFFLINE, + + /** + * The file will not be indexed by the operating system's content indexing service. + */ + NOT_CONTENT_INDEXED, + + /** + * The file or directory is excluded from the data integrity scan. When this value + * is applied to a directory, by default, all new files and subdirectories within + * that directory are excluded from data integrity. + */ + NO_SCRUB_DATA; + + /** + * Converts an enum set of {@code NtfsFileAttributes} to a string. + * + * @return A String that represents the NTFS Attributes in the correct format delimited by | + * which is described at {@link #toAttributes(String)}. + */ + public static String toString(EnumSet ntfsAttributes) { + if (ntfsAttributes == null) { + return Constants.EMPTY_STRING; + } + + final StringBuilder builder = new StringBuilder(); + + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.READ_ONLY, "ReadOnly|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.HIDDEN, "ReadOnly|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.READ_ONLY, "Hidden|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.SYSTEM, "System|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.NORMAL, "None|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.DIRECTORY, "Directory|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.ARCHIVE, "Archive|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.TEMPORARY, "Temporary|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.OFFLINE, "Offline|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.NOT_CONTENT_INDEXED, "NotContentIndexed|"); + toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.NO_SCRUB_DATA, "NoScrubData|"); + + builder.deleteCharAt(builder.lastIndexOf("|")); + + return builder.toString(); + } + + private static void toStringHelper(StringBuilder sb, EnumSet ntfsAttributes, + NtfsFileAttributes attributes, String toAdd) { + if (ntfsAttributes.contains(attributes)) { + sb.append(toAdd); + } + } + + /** + * Creates an enum set of {@code NtfsFileAttributes} from a valid String . + * + * @param ntfsAttributes + * A String that represents the ntfs attributes. The string must contain one or + * more of the following values delimited by a |. Note they are case sensitive. + *
                    + *
                  • ReadOnly
                  • + *
                  • Hidden
                  • + *
                  • System
                  • + *
                  • None
                  • + *
                  • Directory
                  • + *
                  • Archive
                  • + *
                  • Temporary
                  • + *
                  • Offline
                  • + *
                  • NotContentIndexed
                  • + *
                  • NoScrubData
                  • + *
                  + */ + public static EnumSet toAttributes(String ntfsAttributes) { + EnumSet attributes = EnumSet.noneOf(NtfsFileAttributes.class); + String[] splitAttributes = ntfsAttributes.split("\\|"); + + for(String sa: splitAttributes) { + if (sa.equals("ReadOnly")) { + attributes.add(NtfsFileAttributes.READ_ONLY); + } else if (sa.equals("Hidden")) { + attributes.add(NtfsFileAttributes.HIDDEN); + } else if (sa.equals("System")) { + attributes.add(NtfsFileAttributes.SYSTEM); + } else if (sa.equals("None")) { + attributes.add(NtfsFileAttributes.NORMAL); + } else if (sa.equals("Directory")) { + attributes.add(NtfsFileAttributes.DIRECTORY); + } else if (sa.equals("Archive")) { + attributes.add(NtfsFileAttributes.ARCHIVE); + } else if (sa.equals("Temporary")) { + attributes.add(NtfsFileAttributes.TEMPORARY); + } else if (sa.equals("Offline")) { + attributes.add(NtfsFileAttributes.OFFLINE); + } else if (sa.equals("NotContentIndexed")) { + attributes.add(NtfsFileAttributes.NOT_CONTENT_INDEXED); + } else if (sa.equals("NoScrubData")) { + attributes.add(NtfsFileAttributes.NO_SCRUB_DATA); + } else { + throw new IllegalArgumentException("value"); + } + } + + return attributes; + } + + + +} + diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java index 92a15ab7d889..6e447ba62a23 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the getProperties operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java index 62c1b74d4824..af07430ba8c3 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the listSharesSegment operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java index db07375b93e7..5e32f25cbcb5 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setProperties operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareCreatePermissionHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareCreatePermissionHeaders.java new file mode 100644 index 000000000000..d84436426198 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareCreatePermissionHeaders.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.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 CreatePermission operation. + */ +@JacksonXmlRootElement(localName = "Share-CreatePermission-Headers") +@Fluent +public final class ShareCreatePermissionHeaders { + /* + * 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 File service used to execute 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; + + /* + * Key of the permission set for the directory/file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * 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 ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders version(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory/file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory/file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + 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 ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareGetPermissionHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareGetPermissionHeaders.java new file mode 100644 index 000000000000..ac36522215ad --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareGetPermissionHeaders.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.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 GetPermission operation. + */ +@JacksonXmlRootElement(localName = "Share-GetPermission-Headers") +@Fluent +public final class ShareGetPermissionHeaders { + /* + * 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 File service used to execute 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; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * 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 ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders version(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 dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * 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 ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders 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 ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharePermission.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharePermission.java new file mode 100644 index 000000000000..f1e05d7faa00 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharePermission.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.file.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * A permission (a security descriptor) at the share level. + */ +@JacksonXmlRootElement(localName = "SharePermission") +@Fluent +public final class SharePermission { + /* + * The permission in the Security Descriptor Definition Language (SDDL). + */ + @JsonProperty(value = "permission", required = true) + private String permission; + + /** + * Get the permission property: The permission in the Security Descriptor + * Definition Language (SDDL). + * + * @return the permission value. + */ + public String permission() { + return this.permission; + } + + /** + * Set the permission property: The permission in the Security Descriptor + * Definition Language (SDDL). + * + * @param permission the permission value to set. + * @return the SharePermission object itself. + */ + public SharePermission permission(String permission) { + this.permission = permission; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreatePermissionResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreatePermissionResponse.java new file mode 100644 index 000000000000..5e5c9c993ccf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreatePermissionResponse.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.util.Map; + +/** + * Contains all response data for the createPermission operation. + */ +public final class SharesCreatePermissionResponse extends ResponseBase { + /** + * Creates an instance of SharesCreatePermissionResponse. + * + * @param request the request which resulted in this SharesCreatePermissionResponse. + * @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 SharesCreatePermissionResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareCreatePermissionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java index 240af8232a16..dd7bfe90bd26 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the create operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java index b9f9d375c280..dae88450af74 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the createSnapshot operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java index 9477ce4c7e8b..336c6741051b 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the delete operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java index a48f3b3b3083..e6b59c2b3ccd 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; import java.util.List; +import java.util.Map; /** * Contains all response data for the getAccessPolicy operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPermissionResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPermissionResponse.java new file mode 100644 index 000000000000..1d0ba98eb43a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPermissionResponse.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.util.Map; + +/** + * Contains all response data for the getPermission operation. + */ +public final class SharesGetPermissionResponse extends ResponseBase { + /** + * Creates an instance of SharesGetPermissionResponse. + * + * @param request the request which resulted in this SharesGetPermissionResponse. + * @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 SharesGetPermissionResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, SharePermission value, ShareGetPermissionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the deserialized response body. + */ + @Override + public SharePermission value() { + return super.value(); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java index 9716a989187a..84f1cb86e534 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the getProperties operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java index ff9d976a0606..ebe12acf07a5 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the getStatistics operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java index e510ad67fc75..92d9f5f73ec7 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setAccessPolicy operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java index ee0c5437446a..521ed909bd4c 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setMetadata operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java index af406592123d..3e2583011a63 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; +import java.util.Map; /** * Contains all response data for the setQuota operation. diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SourceModifiedAccessConditions.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SourceModifiedAccessConditions.java new file mode 100644 index 000000000000..3a259ab6687d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SourceModifiedAccessConditions.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.util.ImplUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for uploadRangeFromURL operation. + */ +@JacksonXmlRootElement(localName = "source-modified-access-conditions") +@Fluent +public final class SourceModifiedAccessConditions { + /* + * Specify the crc64 value to operate only on range with a matching crc64 + * checksum. + */ + @JsonProperty(value = "sourceIfMatchCrc64") + private byte[] sourceIfMatchCrc64; + + /* + * Specify the crc64 value to operate only on range without a matching + * crc64 checksum. + */ + @JsonProperty(value = "sourceIfNoneMatchCrc64") + private byte[] sourceIfNoneMatchCrc64; + + /** + * Get the sourceIfMatchCrc64 property: Specify the crc64 value to operate + * only on range with a matching crc64 checksum. + * + * @return the sourceIfMatchCrc64 value. + */ + public byte[] sourceIfMatchCrc64() { + return ImplUtils.clone(this.sourceIfMatchCrc64); + } + + /** + * Set the sourceIfMatchCrc64 property: Specify the crc64 value to operate + * only on range with a matching crc64 checksum. + * + * @param sourceIfMatchCrc64 the sourceIfMatchCrc64 value to set. + * @return the SourceModifiedAccessConditions object itself. + */ + public SourceModifiedAccessConditions sourceIfMatchCrc64(byte[] sourceIfMatchCrc64) { + this.sourceIfMatchCrc64 = ImplUtils.clone(sourceIfMatchCrc64); + return this; + } + + /** + * Get the sourceIfNoneMatchCrc64 property: Specify the crc64 value to + * operate only on range without a matching crc64 checksum. + * + * @return the sourceIfNoneMatchCrc64 value. + */ + public byte[] sourceIfNoneMatchCrc64() { + return ImplUtils.clone(this.sourceIfNoneMatchCrc64); + } + + /** + * Set the sourceIfNoneMatchCrc64 property: Specify the crc64 value to + * operate only on range without a matching crc64 checksum. + * + * @param sourceIfNoneMatchCrc64 the sourceIfNoneMatchCrc64 value to set. + * @return the SourceModifiedAccessConditions object itself. + */ + public SourceModifiedAccessConditions sourceIfNoneMatchCrc64(byte[] sourceIfNoneMatchCrc64) { + this.sourceIfNoneMatchCrc64 = ImplUtils.clone(sourceIfNoneMatchCrc64); + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageErrorCode.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageErrorCode.java index 682ff493c191..1a661545ebc8 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageErrorCode.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageErrorCode.java @@ -247,6 +247,11 @@ public final class StorageErrorCode extends ExpandableStringEnumSample 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.response(), e); + this.errorCode = StorageErrorCode.fromString(e.response().headers().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode errorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String serviceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int statusCode() { + return super.response().statusCode(); + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java index 10fa11d5728f..6d95d9d79fe2 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java @@ -27,7 +27,7 @@ public static void main(String[] args) { .buildAsyncClient(); // Create a share String shareName = generateRandomName(); - fileServiceAsyncClient.createShare(shareName).subscribe( + fileServiceAsyncClient.createShareWithResponse(shareName, null, null).subscribe( response -> { System.out.printf("Successfully created a share with status code: %d.", response.statusCode()); }, diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..89b8b9783c38 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.NtfsFileAttributes; + +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.EnumSet; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link DirectoryClient} and {@link DirectoryAsyncClient}. + */ +public class DirectoryAsyncJavaDocCodeSamples { + + /** + * Generates code sample for {@link DirectoryAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation + DirectoryAsyncClient client = new FileClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildDirectoryAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link DirectoryAsyncClient} + */ + public DirectoryAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken + DirectoryAsyncClient directoryAsyncClient = new FileClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .shareName("myshare") + .resourcePath("mydirectory") + .buildDirectoryAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken + return directoryAsyncClient; + } + + /** + * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link DirectoryAsyncClient} + */ + public DirectoryAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.credential + DirectoryAsyncClient direcotryAsyncClient = new FileClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .shareName("myshare") + .resourcePath("mydirectory") + .buildDirectoryAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation.credential + return direcotryAsyncClient; + } + + /** + * Generates code sample for creating a {@link DirectoryAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link DirectoryAsyncClient} + */ + public DirectoryAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + DirectoryAsyncClient directoryAsyncClient = new FileClientBuilder() + .connectionString(connectionString).shareName("myshare").resourcePath("mydirectory") + .buildDirectoryAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring + return directoryAsyncClient; + } + + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#create} + */ + public void createDirectoryAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.create + directoryAsyncClient.create().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Completed creating the directory!") + ); + // END: com.azure.storage.file.directoryAsyncClient.create + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createWithResponse(FileSmbProperties, String, Map)} + */ + public void createDirectoryWithResponseAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createWithResponse#filesmbproperties-string-map + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + Map metadata = Collections.singletonMap("directory", "metadata"); + directoryAsyncClient.createWithResponse(smbProperties, filePermission, metadata).subscribe( + response -> + System.out.println("Completed creating the directory with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.directoryAsyncClient.createWithResponse#filesmbproperties-string-map + } + + /** + * Generates code sample for creating a subdirectory with {@link DirectoryAsyncClient} + */ + public void createSubDirectory() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string + directoryAsyncClient.createSubDirectory("subdir") + .doOnSuccess(response -> System.out.println("Completed creating the subdirectory.")); + // END: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectoryWithResponse(String, FileSmbProperties, String, Map)} + */ + public void createSubDirectoryAsyncMaxOverload() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + Map metadata = Collections.singletonMap("directory", "metadata"); + directoryAsyncClient.createSubDirectoryWithResponse("subdir", smbProperties, filePermission, metadata).subscribe( + response -> + System.out.println("Successfully creating the subdirectory with status code: " + + response.statusCode()), + error -> System.err.println(error.toString()) + ); + // END: com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long)} + */ + public void createFileAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long + directoryAsyncClient.createFile("myfile", 1024).subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed creating the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.createFile#string-long + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createFileWithResponse(String, long, FileHTTPHeaders, FileSmbProperties, String, Map)} + */ + public void createFileWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + directoryAsyncClient.createFileWithResponse("myFile", 1024, httpHeaders, smbProperties, filePermission, + Collections.singletonMap("directory", "metadata")).subscribe( + response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed creating the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories()} + */ + public void listDirectoriesAndFilesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories + directoryAsyncClient.listFilesAndDirectories().subscribe( + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", + fileRef.isDirectory(), fileRef.name()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed listing the directories and files.") + ); + // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories(String, Integer)} + */ + public void listDirectoriesAndFilesAsyncMaxOverload() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer + directoryAsyncClient.listFilesAndDirectories("subdir", 10).subscribe( + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", + fileRef.isDirectory(), fileRef.name()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed listing the directories and files.") + ); + // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteFile(String)} ()} + */ + public void deleteFileAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFile#string + directoryAsyncClient.deleteFile("myfile").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteFile#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteFileWithResponse(String)} + */ + public void deleteFileWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string + directoryAsyncClient.deleteFileWithResponse("myfile").subscribe( + response -> System.out.printf("Delete file completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectory(String)} ()} + */ + public void deleteSubDirectoryAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string + directoryAsyncClient.deleteSubDirectory("mysubdirectory").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the subdirectory.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectoryWithResponse(String)} ()} + */ + public void deleteSubDirectoryWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string + directoryAsyncClient.deleteSubDirectoryWithResponse("mysubdirectory").subscribe( + response -> System.out.printf("Delete subdirectory completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the subdirectory.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#delete()} + */ + public void deleteDirectoryAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.delete + directoryAsyncClient.delete().subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.delete + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteWithResponse + directoryAsyncClient.deleteWithResponse().subscribe( + response -> System.out.printf("Delete completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()) + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.getProperties + directoryAsyncClient.getProperties().subscribe(properties -> { + System.out.printf("Directory latest modified date is %s.", properties.lastModified()); + }); + // END: com.azure.storage.file.directoryAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse + directoryAsyncClient.getPropertiesWithResponse().subscribe(properties -> { + System.out.printf("Directory latest modified date is %s:", properties.value().lastModified()); + }); + // END: com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setProperties(FileSmbProperties, String)} + */ + public void setPropertiesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setProperties#filesmbproperties-string + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + directoryAsyncClient.setProperties(smbProperties, filePermission).subscribe(properties -> { + System.out.printf("Directory latest modified date is %s:", properties.lastModified()); + }); + // END: com.azure.storage.file.directoryAsyncClient.setProperties#filesmbproperties-string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setPropertiesWithResponse(FileSmbProperties, String)} + */ + public void setPropertiesWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setPropertiesWithResponse#filesmbproperties-string + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + directoryAsyncClient.setPropertiesWithResponse(smbProperties, filePermission).subscribe(properties -> { + System.out.printf("Directory latest modified date is %s:", properties.value().lastModified()); + }); + // END: com.azure.storage.file.directoryAsyncClient.setPropertiesWithResponse#filesmbproperties-string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} + */ + public void setMetadataAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map + directoryAsyncClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")) + .subscribe(response -> System.out.println("Setting the directory metadata completed.")); + // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} to clear the metadata. + */ + public void setMetadataClear() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata + directoryAsyncClient.setMetadata(null) + .doOnSuccess(response -> System.out.println("Clearing the directory metadata completed")); + // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadataWithResponse(Map)} to clear the metadata. + */ + public void setMetadataWithResponseClear() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata + directoryAsyncClient.setMetadataWithResponse(null).subscribe( + response -> System.out.printf("Clearing the directory metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadataWithResponse(Map)} + */ + public void setMetadataWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map + directoryAsyncClient.setMetadataWithResponse(Collections.singletonMap("directory", "updatedMetadata")) + .subscribe(response -> System.out.println("Setting the directory metadata completed with status code:" + + response.statusCode())); + // END: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#listHandles(Integer, boolean)} + */ + public void listHandlesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean + directoryAsyncClient.listHandles(10, true) + .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", + handleItem.handleId())); + // END: com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#forceCloseHandles(String, boolean)} + */ + public void forceCloseHandlesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.forceCloseHandles + directoryAsyncClient.listHandles(10, true) + .subscribe(handleItem -> directoryAsyncClient.forceCloseHandles(handleItem.handleId(), true) + .subscribe(numOfClosedHandles -> System.out.printf("Closed %d handles.", numOfClosedHandles))); + // END: com.azure.storage.file.directoryAsyncClient.forceCloseHandles + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#getShareSnapshotId()} + */ + public void getShareSnapshotIdAsync() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId + OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + DirectoryAsyncClient directoryAsyncClient = new FileClientBuilder() + .endpoint("https://${accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) + .shareName("myshare") + .resourcePath("mydirectory") + .snapshot(currentTime.toString()) + .buildDirectoryAsyncClient(); + + System.out.printf("Snapshot ID: %s%n", directoryAsyncClient.getShareSnapshotId()); + // END: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java index 1a557f412941..84db9349cd35 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; 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.file.models.DirectoryInfo; @@ -12,71 +13,50 @@ import com.azure.storage.file.models.DirectorySetMetadataInfo; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.HandleItem; +import com.azure.storage.file.models.NtfsFileAttributes; import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.Collections; +import java.util.EnumSet; import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link DirectoryClient} and {@link DirectoryAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link DirectoryClient}. */ public class DirectoryJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link DirectoryClient} instantiation. */ public void initialization() { // BEGIN: com.azure.storage.file.directoryClient.instantiation - DirectoryClient client = new DirectoryClientBuilder() + DirectoryClient client = new FileClientBuilder() .connectionString("${connectionString}") .endpoint("${endpoint}") - .buildClient(); + .buildDirectoryClient(); // END: com.azure.storage.file.directoryClient.instantiation } - /** - * Generates code sample for {@link DirectoryAsyncClient} instantiation. - */ - public void asyncInitialization() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation - DirectoryAsyncClient client = new DirectoryClientBuilder() - .connectionString("${connectionString}") - .endpoint("${endpoint}") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link DirectoryClient} with {@link SASTokenCredential} * @return An instance of {@link DirectoryClient} */ public DirectoryClient createClientWithSASToken() { // BEGIN: com.azure.storage.file.directoryClient.instantiation.sastoken - DirectoryClient directoryClient = new DirectoryClientBuilder() + DirectoryClient directoryClient = new FileClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") .shareName("myshare") - .directoryPath("mydirectory") - .buildClient(); + .resourcePath("mydirectory") + .buildDirectoryClient(); // END: com.azure.storage.file.directoryClient.instantiation.sastoken return directoryClient; } - /** - * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link DirectoryAsyncClient} - */ - public DirectoryAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken - DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .shareName("myshare") - .directoryPath("mydirectory") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken - return directoryAsyncClient; - } - /** * Generates code sample for creating a {@link DirectoryClient} with {@link SASTokenCredential} * @return An instance of {@link DirectoryClient} @@ -84,32 +64,16 @@ public DirectoryAsyncClient createAsyncClientWithSASToken() { public DirectoryClient createClientWithCredential() { // BEGIN: com.azure.storage.file.directoryClient.instantiation.credential - DirectoryClient directoryClient = new DirectoryClientBuilder() + DirectoryClient directoryClient = new FileClientBuilder() .endpoint("https://${accountName}.file.core.windows.net") .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) .shareName("myshare") - .directoryPath("mydirectory") - .buildClient(); + .resourcePath("mydirectory") + .buildDirectoryClient(); // END: com.azure.storage.file.directoryClient.instantiation.credential return directoryClient; } - /** - * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link DirectoryAsyncClient} - */ - public DirectoryAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.credential - DirectoryAsyncClient direcotryAsyncClient = new DirectoryClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .shareName("myshare") - .directoryPath("mydirectory") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation.credential - return direcotryAsyncClient; - } - /** * Generates code sample for creating a {@link DirectoryClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link DirectoryClient} @@ -118,128 +82,63 @@ public DirectoryClient createClientWithConnectionString() { // BEGIN: com.azure.storage.file.directoryClient.instantiation.connectionstring String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key}" + ";EndpointSuffix={core.windows.net}"; - DirectoryClient directoryClient = new DirectoryClientBuilder() - .connectionString(connectionString).shareName("myshare").directoryPath("mydirectory") - .buildClient(); + DirectoryClient directoryClient = new FileClientBuilder() + .connectionString(connectionString) + .shareName("myshare") + .resourcePath("mydirectory") + .buildDirectoryClient(); // END: com.azure.storage.file.directoryClient.instantiation.connectionstring return directoryClient; } - /** - * Generates code sample for creating a {@link DirectoryAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link DirectoryAsyncClient} - */ - public DirectoryAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() - .connectionString(connectionString).shareName("myshare").directoryPath("mydirectory") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring - return directoryAsyncClient; - } - /** * Generates a code sample for using {@link DirectoryClient#create()} */ public void createDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.createDirectory - Response response = directoryClient.create(); - System.out.println("Complete creating the directory with status code: " + response.statusCode()); + directoryClient.create(); + System.out.println("Completed creating the directory. "); // END: com.azure.storage.file.directoryClient.createDirectory } /** - * Generates a code sample for using {@link DirectoryAsyncClient#create} - */ - public void createDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.create - directoryAsyncClient.create().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.directoryAsyncClient.create - } - - /** - * Generates a code sample for using {@link DirectoryClient#create(Map)} + * Generates a code sample for using {@link DirectoryClient#createWithResponse(FileSmbProperties, String, Map, Context)} */ - public void createDirectoryWithOverload() { + public void createWithResponse() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.create#map - Response response = directoryClient.create(Collections.singletonMap("directory", "metadata")); - System.out.println("Complete creating the directory with status code: " + response.statusCode()); - // END: com.azure.storage.file.directoryClient.create#map + // BEGIN: com.azure.storage.file.directoryClient.createWithResponse#filesmbproperties-string-map-context + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + Response response = directoryClient.createWithResponse(smbProperties, filePermission, + Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); + System.out.println("Completed creating the directory with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.createWithResponse#filesmbproperties-string-map-context } /** - * Generates a code sample for using {@link DirectoryAsyncClient#create(Map)} - */ - public void createDirectoryAsyncWithOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.create#map - directoryAsyncClient.create(Collections.singletonMap("directory", "metadata")).subscribe( - response -> System.out.printf("Creating the directory completed with status code %d", - response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.directoryAsyncClient.create#map - } - - /** - * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String) + * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String)} */ public void createSubDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.createSubDirectory#string - Response response = directoryClient.createSubDirectory("subdir"); - System.out.println("Complete creating the subdirectory with status code " + response.statusCode()); + directoryClient.createSubDirectory("subdir"); + System.out.println("Completed creating the subdirectory."); // END: com.azure.storage.file.directoryClient.createSubDirectory#string } /** - * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectory(String)} - */ - public void createSubDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string - directoryAsyncClient.createSubDirectory("subdir").subscribe( - response -> System.out.println("Successfully creating the subdirectory with status code: " - + response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the sub directory.") - ); - // END: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string - } - - /** - * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String, Map)} + * Generates a code sample for using {@link DirectoryClient#createSubDirectoryWithResponse(String, FileSmbProperties, String, Map, Context)} */ public void createSubDirectoryMaxOverload() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.createSubDirectory#string-map - Response response = directoryClient.createSubDirectory("subdir", - Collections.singletonMap("directory", "metadata")); + // BEGIN: com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map-context + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + Response response = directoryClient.createSubDirectoryWithResponse("subdir", + smbProperties, filePermission, Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); System.out.printf("Creating the sub directory completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.directoryClient.createSubDirectory#string-map - } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectory(String, Map)} - */ - public void createSubDirectoryAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string-map - directoryAsyncClient.createSubDirectory("subdir", - Collections.singletonMap("directory", "metadata")) - .subscribe(response -> System.out.printf("Creating the subdirectory completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string-map + // END: com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map-context } /** @@ -248,52 +147,35 @@ public void createSubDirectoryAsyncMaxOverload() { public void createFile() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long - Response response = directoryClient.createFile("myfile", 1024); - System.out.println("Complete creating the file with status code: " + response.statusCode()); + FileClient response = directoryClient.createFile("myfile", 1024); + System.out.println("Completed creating the file: " + response); // END: com.azure.storage.file.directoryClient.createFile#string-long } /** - * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long)} - */ - public void createFileAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long - directoryAsyncClient.createFile("myfile", 1024).subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.createFile#string-long - } - - /** - * Generates a code sample for using {@link DirectoryClient#createFile(String, long, FileHTTPHeaders, Map)} + * Generates a code sample for using {@link DirectoryClient#createFileWithResponse(String, long, FileHTTPHeaders, FileSmbProperties, String, Map, Context)} */ public void createFileMaxOverload() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = directoryClient.createFile("myFile", 1024, - httpHeaders, Collections.singletonMap("directory", "metadata")); - System.out.println("Complete creating the file with status code: " + response.statusCode()); - // END: com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map - } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long, FileHTTPHeaders, Map)} - */ - public void createFileAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long-fileHTTPHeaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - directoryAsyncClient.createFile("myFile", 1024, httpHeaders, - Collections.singletonMap("directory", "metadata")).subscribe( - response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.createFile#string-long-fileHTTPHeaders-map + // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long-filehttpheaders-filesmbproperties-string-map-context + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + Response response = directoryClient.createFileWithResponse("myFile", 1024, + httpHeaders, smbProperties, filePermission, Collections.singletonMap("directory", "metadata"), + new Context(key1, value1)); + System.out.println("Completed creating the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.createFile#string-long-filehttpheaders-filesmbproperties-string-map-context } /** @@ -309,21 +191,6 @@ public void listDirectoriesAndFiles() { // END: com.azure.storage.file.directoryClient.listFilesAndDirectories } - /** - * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories()} - */ - public void listDirectoriesAndFilesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories - directoryAsyncClient.listFilesAndDirectories().subscribe( - fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", - fileRef.isDirectory(), fileRef.name()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete listing the directories and files.") - ); - // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories - } - /** * Generates a code sample for using {@link DirectoryClient#listFilesAndDirectories(String, Integer)} */ @@ -337,45 +204,26 @@ public void listDirectoriesAndFilesMaxOverload() { // END: com.azure.storage.file.directoryClient.listFilesAndDirectories#string-integer } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories(String, Integer)} - */ - public void listDirectoriesAndFilesAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer - directoryAsyncClient.listFilesAndDirectories("subdir", 10).subscribe( - fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", - fileRef.isDirectory(), fileRef.name()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete listing the directories and files.") - ); - // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer - } - /** * Generates a code sample for using {@link DirectoryClient#deleteFile(String)} ()} */ public void deleteFile() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.deleteFile#string - VoidResponse response = directoryClient.deleteFile("myfile"); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); - // END: com.azure.storage.file.directoryClient.deleteFile#string + // BEGIN: com.azure.storage.file.DirectoryClient.deleteFileWithResponse#String-Context + directoryClient.deleteFile("myfile"); + System.out.println("Completed deleting the file."); + // END: com.azure.storage.file.DirectoryClient.deleteFileWithResponse#String-Context } /** - * Generates a code sample for using {@link DirectoryAsyncClient#deleteFile(String)} ()} + * Generates a code sample for using {@link DirectoryClient#deleteFileWithResponse(String, Context)} */ - public void deleteFileAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFile#string - directoryAsyncClient.deleteFile("myfile").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.deleteFile#string + public void deleteFileWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.deleteFileWithResponse#string-Context + VoidResponse response = directoryClient.deleteFileWithResponse("myfile", new Context(key1, value1)); + System.out.println("Completed deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.deleteFileWithResponse#string-Context } /** @@ -384,48 +232,43 @@ public void deleteFileAsync() { public void deleteSubDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.deleteSubDirectory#string - VoidResponse response = directoryClient.deleteSubDirectory("mysubdirectory"); - System.out.println("Complete deleting the subdirectory with status code: " + response.statusCode()); + directoryClient.deleteSubDirectory("mysubdirectory"); + System.out.println("Complete deleting the subdirectory."); // END: com.azure.storage.file.directoryClient.deleteSubDirectory#string } /** - * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectory(String)} ()} + * Generates a code sample for using {@link DirectoryClient#deleteSubDirectoryWithResponse(String, Context)} */ - public void deleteSubDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string - directoryAsyncClient.deleteSubDirectory("mysubdirectory").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the subdirectory.") - ); - // END: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string + public void deleteSubDirectoryWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-Context + VoidResponse response = directoryClient.deleteSubDirectoryWithResponse("mysubdirectory", + new Context(key1, value1)); + System.out.println("Completed deleting the subdirectory with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-Context } /** - * Generates a code sample for using {@link DirectoryClient#delete()} ()} + * Generates a code sample for using {@link DirectoryClient#delete()} */ public void deleteDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.delete - VoidResponse response = directoryClient.delete(); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); + directoryClient.delete(); + System.out.println("Completed deleting the file."); // END: com.azure.storage.file.directoryClient.delete } /** - * Generates a code sample for using {@link DirectoryAsyncClient#delete()} + * Generates a code sample for using {@link DirectoryClient#deleteWithResponse(Context)} */ - public void deleteDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.delete - directoryAsyncClient.delete().subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.delete + public void deleteWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.DirectoryClient.deleteWithResponse#Context + VoidResponse response = directoryClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Completed deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.DirectoryClient.deleteWithResponse#Context } /** @@ -434,23 +277,47 @@ public void deleteDirectoryAsync() { public void getProperties() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.getProperties - Response response = directoryClient.getProperties(); - System.out.printf("Directory latest modified date is %s.", response.value().lastModified()); + DirectoryProperties response = directoryClient.getProperties(); + System.out.printf("Directory latest modified date is %s.", response.lastModified()); // END: com.azure.storage.file.directoryClient.getProperties } /** - * Generates a code sample for using {@link DirectoryAsyncClient#getProperties()} + * Generates a code sample for using {@link DirectoryClient#getPropertiesWithResponse(Context)} + */ + public void getPropertiesWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.getPropertiesWithResponse#Context + Response response = directoryClient.getPropertiesWithResponse(new Context(key1, value1)); + System.out.printf("Directory latest modified date is %s.", response.value().lastModified()); + // END: com.azure.storage.file.directoryClient.getPropertiesWithResponse#Context + } + + /** + * Generates a code sample for using {@link DirectoryClient#setProperties(FileSmbProperties, String)} */ - public void getPropertiesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.getProperties - directoryAsyncClient.getProperties() - .subscribe(response -> { - DirectoryProperties properties = response.value(); - System.out.printf("Directory latest modified date is %s.", properties.lastModified()); - }); - // END: com.azure.storage.file.directoryAsyncClient.getProperties + public void setProperties() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.setProperties#filesmbproperties-string + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + DirectoryInfo response = directoryClient.setProperties(smbProperties, filePermission); + System.out.printf("Directory latest modified date is %s.", response.lastModified()); + // END: com.azure.storage.file.directoryClient.setProperties#filesmbproperties-string + } + + /** + * Generates a code sample for using {@link DirectoryClient#setPropertiesWithResponse(FileSmbProperties, String,Context)} + */ + public void setPropertiesWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.setPropertiesWithResponse#filesmbproperties-string-Context + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + Response response = directoryClient.setPropertiesWithResponse(smbProperties, filePermission, + new Context(key1, value1)); + System.out.printf("Directory latest modified date is %s.", response.value().lastModified()); + // END: com.azure.storage.file.directoryClient.setPropertiesWithResponse#filesmbproperties-string-Context } /** @@ -459,68 +326,57 @@ public void getPropertiesAsync() { public void setMetadata() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadata#map - Response response = + DirectorySetMetadataInfo response = directoryClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")); - System.out.printf("Setting the directory metadata completed with status code %d", response.statusCode()); + System.out.printf("Setting the directory metadata completed with updated etag %d", response.eTag()); // END: com.azure.storage.file.directoryClient.setMetadata#map } /** - * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} + * Generates a code sample for using {@link DirectoryClient#setMetadataWithResponse(Map, Context)} */ - public void setMetadataAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map - directoryAsyncClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")) - .subscribe(response -> System.out.printf("Setting the directory metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.setMetadataWithResponse#map-Context + Response response = + directoryClient.setMetadataWithResponse(Collections.singletonMap("directory", "updatedMetadata"), + new Context(key1, value1)); + System.out.printf("Setting the directory metadata completed with updated etag %d", response.statusCode()); + // END: com.azure.storage.file.directoryClient.setMetadataWithResponse#map-Context } /** * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} to clear the metadata. */ - public void clearMetadata() { + public void clearSetMetadata() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadata#map.clearMetadata - Response response = directoryClient.setMetadata(null); - System.out.printf("Directory latest modified date is %s.", response.statusCode()); + DirectorySetMetadataInfo response = directoryClient.setMetadata(null); + System.out.printf("Cleared metadata."); // END: com.azure.storage.file.directoryClient.setMetadata#map.clearMetadata } /** - * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} to clear the metadata. + * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} to clear the metadata. */ - public void clearMetadataAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata - directoryAsyncClient.setMetadata(null) - .subscribe(response -> System.out.printf("Clearing the directory metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata + public void clearMetadata() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.DirectoryClient.setMetadataWithResponse#Map-Context.clearMetadata + Response response = directoryClient.setMetadataWithResponse(null, + new Context(key1, value1)); + System.out.printf("Directory latest modified date is %s.", response.statusCode()); + // END: com.azure.storage.file.DirectoryClient.setMetadataWithResponse#Map-Context.clearMetadata } /** - * Generates a code sample for using {@link DirectoryClient#getHandles(Integer, boolean)} + * Generates a code sample for using {@link DirectoryClient#listHandles(Integer, boolean)} */ - public void getHandles() { + public void listHandles() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.getHandles - Iterable result = directoryClient.getHandles(10, true); + // BEGIN: com.azure.storage.file.directoryClient.listHandles#Integer-boolean + Iterable result = directoryClient.listHandles(10, true); System.out.printf("Get handles completed with handle id %s", result.iterator().next().handleId()); - // END: com.azure.storage.file.directoryClient.getHandles - } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#getHandles(Integer, boolean)} - */ - public void getHandlesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.getHandles - directoryAsyncClient.getHandles(10, true) - .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", - handleItem.handleId())); - // END: com.azure.storage.file.directoryAsyncClient.getHandles + // END: com.azure.storage.file.directoryClient.listHandles#Integer-boolean } /** @@ -529,7 +385,7 @@ public void getHandlesAsync() { public void forceCloseHandles() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.forceCloseHandles - Iterable result = directoryClient.getHandles(10, true); + Iterable result = directoryClient.listHandles(10, true); result.forEach(handleItem -> { directoryClient.forceCloseHandles(handleItem.handleId(), true).forEach(numOfClosedHandles -> System.out.printf("Get handles completed with handle id %s", handleItem.handleId())); @@ -537,52 +393,21 @@ public void forceCloseHandles() { // END: com.azure.storage.file.directoryClient.forceCloseHandles } - /** - * Generates a code sample for using {@link DirectoryAsyncClient#forceCloseHandles(String, boolean)} - */ - public void forceCloseHandlesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.forceCloseHandles - directoryAsyncClient.getHandles(10, true) - .subscribe(handleItem -> { - directoryAsyncClient.forceCloseHandles(handleItem.handleId(), true) - .subscribe(numOfClosedHandles -> - System.out.printf("Close %d handles.", numOfClosedHandles)); - }); - // END: com.azure.storage.file.directoryAsyncClient.forceCloseHandles - } - /** * Generates a code sample for using {@link DirectoryClient#getShareSnapshotId()} */ public void getShareSnapshotId() { // BEGIN: com.azure.storage.file.directoryClient.getShareSnapshotId OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - DirectoryClient directoryClient = new DirectoryClientBuilder() + DirectoryClient directoryClient = new FileClientBuilder() .endpoint("https://${accountName}.file.core.windows.net") .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) .shareName("myshare") - .directoryPath("mydirectory") + .resourcePath("mydirectory") .snapshot(currentTime.toString()) - .buildClient(); - directoryClient.getShareSnapshotId(); - // END: com.azure.storage.file.directoryClient.getShareSnapshotId - } + .buildDirectoryClient(); - /** - * Generates a code sample for using {@link DirectoryAsyncClient#getShareSnapshotId()} - */ - public void getShareSnapshotIdAsync() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId - OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() - .endpoint("https://${accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) - .shareName("myshare") - .directoryPath("mydirectory") - .snapshot(currentTime.toString()) - .buildAsyncClient(); - directoryAsyncClient.getShareSnapshotId(); - // END: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId + System.out.printf("Snapshot ID: %s%n", directoryClient.getShareSnapshotId()); + // END: com.azure.storage.file.directoryClient.getShareSnapshotId } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java index 4e7193286232..4fd3bc301854 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java @@ -2,10 +2,9 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.DirectoryProperties; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; import java.util.UUID; @@ -30,13 +29,13 @@ public static void main(String[] args) { ShareClient shareClient = new ShareClientBuilder().endpoint(ENDPOINT).shareName(shareName).buildClient(); shareClient.create(); // Build up a directory client - DirectoryClient directoryClient = new DirectoryClientBuilder().endpoint(ENDPOINT).shareName(generateRandomName()) + DirectoryClient directoryClient = new FileClientBuilder().endpoint(ENDPOINT).shareName(generateRandomName()) .shareName(shareName) - .directoryPath(generateRandomName()).buildClient(); + .resourcePath(generateRandomName()).buildDirectoryClient(); // Create a parent directory try { directoryClient.create(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create a directory. Reasons: " + e.getMessage()); } @@ -44,65 +43,61 @@ public static void main(String[] args) { String childDirectoryName = generateRandomName(); try { directoryClient.createSubDirectory(childDirectoryName); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create sub directory. Reasons: " + e.getMessage()); } // Create a 1KB file under the child directory. - DirectoryClient childDirClient = null; + DirectoryClient childDirClient = directoryClient.getSubDirectoryClient(childDirectoryName); String fileName = generateRandomName(); try { - childDirClient = directoryClient.getSubDirectoryClient(childDirectoryName); childDirClient.createFile(fileName, 1024); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create a file under the child directory. Reasons: " + e.getMessage()); } // Delete the child directory. The operation will fail because storage service only allowed to delete the empty directory. try { childDirClient.delete(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("This is expected as the child directory is not empty."); } // List all the sub directories and files. try { directoryClient.listFilesAndDirectories().forEach( - fileRef -> { - System.out.printf("Is the resource a directory? %b. The resource name is: ", fileRef.isDirectory(), - fileRef.name()); - } - ); - } catch (StorageErrorException e) { + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s%n", + fileRef.isDirectory(), fileRef.name())); + } catch (StorageException e) { System.out.println("Failed to list all the subdirectories and files. Reasons: " + e.getMessage()); } // Get the parent directory properties. try { - Response propertiesResponse = directoryClient.getProperties(); - System.out.printf("This is the eTag %s of the directory: ", propertiesResponse.value().eTag()); - } catch (StorageErrorException e) { + DirectoryProperties propertiesResponse = directoryClient.getProperties(); + System.out.printf("This is the eTag of the directory: %s%n", propertiesResponse.eTag()); + } catch (StorageException e) { System.out.println("Failed to get the properties of the parent directory"); } // Delete the file. try { childDirClient.deleteFile(fileName); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the file. Reasons: " + e.getMessage()); } // Delete the child folder try { directoryClient.deleteSubDirectory(childDirectoryName); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the child directory. Reasons: " + e.getMessage()); } // Delete the parent folder try { directoryClient.delete(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the parent directory. Reasons: " + e.getMessage()); } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..d47f88da6df0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java @@ -0,0 +1,659 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Constants; +import com.azure.storage.common.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.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileProperties; +import com.azure.storage.file.models.FileRange; +import com.azure.storage.file.models.NtfsFileAttributes; +import reactor.core.publisher.Flux; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.EnumSet; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link FileClient} and {@link FileAsyncClient}. + */ +public class FileAsyncJavaDocCodeSamples { + + /** + * Generates code sample for {@link FileAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation + FileAsyncClient client = new FileClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildFileAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation + } + + + /** + * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileAsyncClient} + */ + public FileAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.sastoken + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .shareName("myshare") + .resourcePath("myfilepath") + .buildFileAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation.sastoken + return fileAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileAsyncClient} + */ + public FileAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.credential + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .shareName("myshare") + .resourcePath("myfilepath") + .buildFileAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation.credential + return fileAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileAsyncClient} with {@code connectionString} + * which turns into {@link SharedKeyCredential} + * @return An instance of {@link FileAsyncClient} + */ + public FileAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .connectionString(connectionString).shareName("myshare").resourcePath("myfilepath") + .buildFileAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring + return fileAsyncClient; + } + + + /** + * Generates a code sample for using {@link FileAsyncClient#create(long)} + */ + public void createFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.create + fileAsyncClient.create(1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.create + } + + /** + * Generates a code sample for using {@link FileAsyncClient#create(long)} + */ + public void createFileAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + fileAsyncClient.create(1024) + .doOnSuccess(response -> System.out.println("Creating the file completed.")); + // END: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#createWithResponse(long, FileHTTPHeaders, FileSmbProperties, String, Map)} + */ + public void createWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + fileAsyncClient.createWithResponse(1024, httpHeaders, smbProperties, filePermission, + Collections.singletonMap("directory", "metadata")) + .subscribe(response -> System.out.printf("Creating the file completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#startCopy(String, Map)} + */ + public void copyFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.startCopy#string-map + fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata")).subscribe( + response -> System.out.println("Successfully copied the file;"), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete copying the file.") + ); + // END: com.azure.storage.file.fileAsyncClient.startCopy#string-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#startCopyWithResponse(String, Map)} + */ + public void startCopyWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map + fileAsyncClient.startCopyWithResponse("https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata")).subscribe( + response -> + System.out.println("Successfully copying the file with status code: " + response.statusCode()), + error -> System.err.println(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#abortCopy(String)} + */ + public void abortCopyFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopy#string + fileAsyncClient.abortCopy("someCopyId") + .doOnSuccess(response -> System.out.println("Abort copying the file completed.")); + // END: com.azure.storage.file.fileAsyncClient.abortCopy#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#abortCopyWithResponse(String)} + */ + public void abortCopyWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string + fileAsyncClient.abortCopyWithResponse("someCopyId") + .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} + */ + public void uploadDataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.upload(Flux.just(defaultData), defaultData.remaining()).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.upload#flux-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long, long)} + */ + public void uploadDataMaxOverloadAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.upload(Flux.just(defaultData), defaultData.remaining()).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.upload#flux-long-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#uploadWithResponse(Flux, long)} + */ + public void uploadWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.uploadWithResponse(Flux.just(defaultData), defaultData.remaining()).subscribe( + response -> System.out.println("Complete deleting the file with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#uploadWithResponse(Flux, long, long)} + */ + public void uploadWithResponseOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.uploadWithResponse(Flux.just(defaultData), defaultData.remaining(), 1024).subscribe( + response -> System.out.println("Complete deleting the file with status code" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#clearRange(long)} + */ + public void clearRangeAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.clearRange#long + fileAsyncClient.clearRange(1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete clearing the range!") + ); + // END: com.azure.storage.file.fileAsyncClient.clearRange#long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#clearRangeWithResponse(long, long)} + */ + public void clearRangeAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.clearRange#long-long + fileAsyncClient.clearRangeWithResponse(1024, 1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete clearing the range!") + ); + // END: com.azure.storage.file.fileAsyncClient.clearRange#long-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String)} + */ + public void uploadFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string + fileAsyncClient.uploadFromFile("someFilePath").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.uploadFromFile#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties()} + */ + public void downloadDataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties + fileAsyncClient.downloadWithProperties().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the data!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadWithPropertiesWithResponse(FileRange, Boolean)} + */ + public void downloadDataAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean + fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false). + subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the data!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadWithPropertiesWithResponse(FileRange, Boolean)} + */ + public void downloadWithPropertiesWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean + fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false) + .subscribe( + response -> System.out.println("Complete downloading the data with status code: " + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String)} + */ + public void downloadFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string + fileAsyncClient.downloadToFile("somelocalfilepath").subscribe( + response -> { + if (Files.exists(Paths.get("somelocalfilepath"))) { + System.out.println("Successfully downloaded the file."); + } + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String, FileRange)} + */ + public void downloadFileAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange + fileAsyncClient.downloadToFile("somelocalfilepath", new FileRange(1024, 2047L)).subscribe( + response -> { + if (Files.exists(Paths.get("somelocalfilepath"))) { + System.out.println("Successfully downloaded the file."); + } + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange + } + + /** + * Generates a code sample for using {@link FileAsyncClient#delete()} + */ + public void deleteFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.delete + fileAsyncClient.delete().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.delete + } + + /** + * Generates a code sample for using {@link FileAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.deleteWithResponse + fileAsyncClient.deleteWithResponse().subscribe( + response -> System.out.println("Complete deleting the file with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link FileAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.getProperties + fileAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("File latest modified date is %s.", properties.lastModified()); + }); + // END: com.azure.storage.file.fileAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link FileAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse + fileAsyncClient.getPropertiesWithResponse() + .subscribe(response -> { + FileProperties properties = response.value(); + System.out.printf("File latest modified date is %s.", properties.lastModified()); + }); + // END: com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} + */ + public void setMetadataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map + fileAsyncClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")) + .doOnSuccess(response -> System.out.println("Setting the file metadata completed.")); + // END: com.azure.storage.file.fileAsyncClient.setMetadata#map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} + */ + public void setMetadataWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map + fileAsyncClient.setMetadataWithResponse(Collections.singletonMap("file", "updatedMetadata")) + .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadataWithResponse(Map)} to clear metadata. + */ + public void clearMetadataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata + fileAsyncClient.setMetadataWithResponse(null).subscribe( + response -> System.out.printf("Setting the file metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} to clear metadata. + */ + public void clearMetadata() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata + fileAsyncClient.setMetadata(null).subscribe( + response -> System.out.println("Setting the file metadata completed.") + ); + // END: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + */ + public void setFilePropertiesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + fileAsyncClient.setProperties(1024, httpHeaders, smbProperties, filePermission) + .doOnSuccess(response -> System.out.println("Setting the file properties completed.")); + // END: com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String)} + */ + public void setHttpHeadersWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + fileAsyncClient.setPropertiesWithResponse(1024, httpHeaders, smbProperties, filePermission) + .subscribe(response -> System.out.printf("Setting the file properties completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String)} + * to clear httpHeaders. + */ + public void clearHTTPHeadersAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties + fileAsyncClient.setPropertiesWithResponse(1024, null, null, null) + .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + * to clear httpHeaders. + */ + public void clearHTTPHeaders() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties + fileAsyncClient.setProperties(1024, null, null, null) + .subscribe(response -> System.out.println("Setting the file httpHeaders completed.")); + // END: com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listRanges()} + */ + public void listRangesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges + fileAsyncClient.listRanges().subscribe(range -> + System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end())); + // END: com.azure.storage.file.fileAsyncClient.listRanges + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listRanges(FileRange)} + */ + public void listRangesAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges#filerange + fileAsyncClient.listRanges(new FileRange(1024, 2048L)) + .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", + result.start(), result.end())); + // END: com.azure.storage.file.fileAsyncClient.listRanges#filerange + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listHandles()} + */ + public void listHandlesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles + fileAsyncClient.listHandles() + .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); + // END: com.azure.storage.file.fileAsyncClient.listHandles + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listHandles(Integer)} + */ + public void listHandlesAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles#integer + fileAsyncClient.listHandles(10) + .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); + // END: com.azure.storage.file.fileAsyncClient.listHandles#integer + } + + /** + * Generates a code sample for using {@link FileAsyncClient#forceCloseHandles(String)} + */ + public void forceCloseHandlesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string + fileAsyncClient.listHandles(10) + .subscribe(result -> { + fileAsyncClient.forceCloseHandles(result.handleId()).subscribe(numOfClosedHandles -> + System.out.printf("Close %d handles.", numOfClosedHandles)); + }); + // END: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#generateSAS(String, FileSASPermission, OffsetDateTime, + * OffsetDateTime, String, SASProtocol, IPRange, String, String, String, String, String)} + */ + public void generateSASAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.generateSAS#String-FileSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + String identifier = "identifier"; + FileSASPermission permissions = new FileSASPermission() + .read(true) + .create(true) + .delete(true) + .write(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String cacheControl = "cache"; + String contentDisposition = "disposition"; + String contentEncoding = "encoding"; + String contentLanguage = "language"; + String contentType = "type"; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + String sas = fileAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + // END: com.azure.storage.file.fileAsyncClient.generateSAS#String-FileSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** + * Generates a code sample for using {@link FileAsyncClient#getShareSnapshotId()} + */ + public void getShareSnapshotIdAsync() { + // BEGIN: com.azure.storage.file.fileAsyncClient.getShareSnapshotId + OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .endpoint("https://${accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) + .shareName("myshare") + .resourcePath("myfiile") + .snapshot(currentTime.toString()) + .buildFileAsyncClient(); + + System.out.printf("Snapshot ID: %s%n", fileAsyncClient.getShareSnapshotId()); + // END: com.azure.storage.file.fileAsyncClient.getShareSnapshotId + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java index bbbb206f09c8..4ad9ee3019f7 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java @@ -4,7 +4,11 @@ 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.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.file.models.FileCopyInfo; @@ -14,12 +18,10 @@ import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; import com.azure.storage.file.models.FileRange; -import com.azure.storage.file.models.FileRangeWriteType; import com.azure.storage.file.models.FileUploadInfo; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import reactor.core.publisher.Flux; +import com.azure.storage.file.models.NtfsFileAttributes; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; @@ -27,12 +29,17 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.Collections; +import java.util.EnumSet; import java.util.Map; /** * Contains code snippets when generating javadocs through doclets for {@link FileClient} and {@link FileAsyncClient}. */ public class FileJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link FileClient} instantiation. */ @@ -41,22 +48,10 @@ public void initialization() { FileClient client = new FileClientBuilder() .connectionString("${connectionString}") .endpoint("${endpoint}") - .buildClient(); + .buildFileClient(); // END: com.azure.storage.file.fileClient.instantiation } - /** - * Generates code sample for {@link FileAsyncClient} instantiation. - */ - public void asyncInitialization() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation - FileAsyncClient client = new FileClientBuilder() - .connectionString("${connectionString}") - .endpoint("${endpoint}") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link FileClient} with {@link SASTokenCredential} * @return An instance of {@link FileClient} @@ -67,26 +62,12 @@ public FileClient createClientWithSASToken() { FileClient fileClient = new FileClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") .shareName("myshare") - .filePath("myfilepath") - .buildClient(); + .resourcePath("myfilepath") + .buildFileClient(); // END: com.azure.storage.file.fileClient.instantiation.sastoken return fileClient; } - /** - * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileAsyncClient} - */ - public FileAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.sastoken - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .shareName("myshare") - .filePath("myfilepath") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation.sastoken - return fileAsyncClient; - } /** * Generates code sample for creating a {@link FileClient} with {@link SASTokenCredential} @@ -99,30 +80,15 @@ public FileClient createClientWithCredential() { .endpoint("https://${accountName}.file.core.windows.net") .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) .shareName("myshare") - .filePath("myfilepath") - .buildClient(); + .resourcePath("myfilepath") + .buildFileClient(); // END: com.azure.storage.file.fileClient.instantiation.credential return fileClient; } /** - * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileAsyncClient} - */ - public FileAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.credential - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .shareName("myshare") - .filePath("myfilepath") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation.credential - return fileAsyncClient; - } - - /** - * Generates code sample for creating a {@link FileClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * Generates code sample for creating a {@link FileClient} with {@code connectionString} + * which turns into {@link SharedKeyCredential} * @return An instance of {@link FileClient} */ public FileClient createClientWithConnectionString() { @@ -130,104 +96,72 @@ public FileClient createClientWithConnectionString() { String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + "EndpointSuffix={core.windows.net}"; FileClient fileClient = new FileClientBuilder() - .connectionString(connectionString).shareName("myshare").filePath("myfilepath") - .buildClient(); + .connectionString(connectionString).shareName("myshare").resourcePath("myfilepath") + .buildFileClient(); // END: com.azure.storage.file.fileClient.instantiation.connectionstring return fileClient; } - /** - * Generates code sample for creating a {@link FileAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link FileAsyncClient} - */ - public FileAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .connectionString(connectionString).shareName("myshare").filePath("myfilepath") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring - return fileAsyncClient; - } - /** * Generates a code sample for using {@link FileClient#create(long)} */ public void createFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.create - Response response = fileClient.create(1024); - System.out.println("Complete creating the file with status code: " + response.statusCode()); + FileInfo response = fileClient.create(1024); + System.out.println("Complete creating the file."); // END: com.azure.storage.file.fileClient.create } /** - * Generates a code sample for using {@link FileAsyncClient#create(long)} - */ - public void createFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.create - fileAsyncClient.create(1024).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.create - } - - /** - * Generates a code sample for using {@link FileClient#create(long, FileHTTPHeaders, Map)} + * Generates a code sample for using {@link FileClient#createWithResponse(long, FileHTTPHeaders, FileSmbProperties, String, Map, Context)} */ - public void createFileMaxOverload() { + public void createWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.create#long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = fileClient.create(1024, httpHeaders, - Collections.singletonMap("file", "updatedMetadata")); + // BEGIN: com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map-context + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + Response response = fileClient.createWithResponse(1024, httpHeaders, smbProperties, filePermission, + Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); System.out.printf("Creating the file completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.create#long-filehttpheaders-map - } - - /** - * Generates a code sample for using {@link FileAsyncClient#create(long, FileHTTPHeaders, Map)} - */ - public void createFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - fileAsyncClient.create(1024, httpHeaders, Collections.singletonMap("file", "updatedMetadata")) - .subscribe(response -> System.out.printf("Creating the file completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map + // END: com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map-context } /** * Generates a code sample for using {@link FileClient#startCopy(String, Map)} */ - public void copyFile() { + public void startCopy() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.startCopy#string-map - Response response = fileClient.startCopy( + FileCopyInfo response = fileClient.startCopy( "https://{accountName}.file.core.windows.net?{SASToken}", Collections.singletonMap("file", "metadata")); - System.out.println("Complete copying the file with status code: " + response.statusCode()); + System.out.println("Complete copying the file with copy Id: " + response.copyId()); // END: com.azure.storage.file.fileClient.startCopy#string-map } /** - * Generates a code sample for using {@link FileClient#startCopy(String, Map)} + * Generates a code sample for using {@link FileClient#startCopyWithResponse(String, Map, Context)} */ - public void copyFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.startCopy#string-map - fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", - Collections.singletonMap("file", "metadata")).subscribe( - response -> System.out.println("Successfully copying the file with status code: " + response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete copying the file.") - ); - // END: com.azure.storage.file.fileAsyncClient.startCopy#string-map + public void startCopyWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.startCopyWithResponse#string-map-Context + Response response = fileClient.startCopyWithResponse( + "https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata"), new Context(key1, value1)); + System.out.println("Complete copying the file with copy Id: " + response.value().copyId()); + // END: com.azure.storage.file.fileClient.startCopyWithResponse#string-map-Context } /** @@ -236,77 +170,81 @@ public void copyFileAsync() { public void abortCopyFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.abortCopy#string - VoidResponse response = fileClient.abortCopy("someCopyId"); - System.out.printf("Abort copying the file completed with status code %d", response.statusCode()); + fileClient.abortCopy("someCopyId"); + System.out.printf("Abort copying the file completed."); // END: com.azure.storage.file.fileClient.abortCopy#string } /** - * Generates a code sample for using {@link FileClient#abortCopy(String)} + * Generates a code sample for using {@link FileClient#abortCopyWithResponse(String, Context)} */ - public void abortCopyFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopy#string - fileAsyncClient.abortCopy("someCopyId") - .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.abortCopy#string + public void abortCopyWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.abortCopyWithResponse#string-Context + VoidResponse response = fileClient.abortCopyWithResponse("someCopyId", new Context(key1, value1)); + System.out.printf("Abort copying the file completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileClient.abortCopyWithResponse#string-Context } /** - * Generates a code sample for using {@link FileClient#upload(ByteBuf, long)} + * Generates a code sample for using {@link FileClient#upload(ByteBuffer, long)} */ public void uploadData() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.upload#flux-long - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - Response response = fileClient.upload(defaultData, defaultData.readableBytes()); - System.out.println("Complete uploading the data with status code: " + response.statusCode()); - // END: com.azure.storage.file.fileClient.upload#flux-long + // BEGIN: com.azure.storage.file.fileClient.upload#bytebuffer-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + FileUploadInfo response = fileClient.upload(defaultData, defaultData.remaining()); + System.out.println("Complete uploading the data with eTag: " + response.eTag()); + // END: com.azure.storage.file.fileClient.upload#bytebuffer-long } /** - * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} + * Generates a code sample for using {@link FileClient#uploadWithResponse(ByteBuffer, long, Context)} */ - public void uploadDataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes()).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.upload#flux-long + public void uploadWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-Context + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + Response response = fileClient.uploadWithResponse(defaultData, defaultData.remaining(), + new Context(key1, value1)); + System.out.println("Complete uploading the data with status code: " + response.statusCode()); + // END: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-Context } /** - * Generates a code sample for using {@link FileClient#upload(ByteBuf, long, int, FileRangeWriteType)} + * Generates a code sample for using {@link FileClient#uploadWithResponse(ByteBuffer, long, long, Context)} */ - public void uploadDataMaxOverload() { + public void uploadWithResponseMaxOverload() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.upload#bytebuf-long-int-filerangewritetype - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - Response response = fileClient.upload(defaultData, defaultData.readableBytes(), 1024, - FileRangeWriteType.UPDATE); + // BEGIN: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-long-Context + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + Response response = fileClient.uploadWithResponse(defaultData, defaultData.remaining(), + 1024, new Context(key1, value1)); System.out.println("Complete uploading the data with status code: " + response.statusCode()); - // END: com.azure.storage.file.fileClient.upload#bytebuf-long-int-filerangewritetype + // END: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-long-Context } /** - * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} + * Generates a code sample for using {@link FileClient#clearRange(long)} */ - public void uploadDataAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.upload#bytebuf-long-int-filerangewritetype - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes(), 1024, - FileRangeWriteType.UPDATE).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.upload#bytebuf-long-int-filerangewritetype + public void clearRange() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.clearRange#long + FileUploadInfo response = fileClient.clearRange(1024); + System.out.println("Complete clearing the range with eTag: " + response.eTag()); + // END: com.azure.storage.file.fileClient.clearRange#long + } + + /** + * Generates a code sample for using {@link FileClient#clearRangeWithResponse(long, long, Context)} + */ + public void clearRangeMaxOverload() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.clearRangeWithResponse#long-long-Context + Response response = fileClient.clearRangeWithResponse(1024, 1024, + new Context(key1, value1)); + System.out.println("Complete clearing the range with status code: " + response.statusCode()); + // END: com.azure.storage.file.fileClient.clearRangeWithResponse#long-long-Context } /** @@ -320,60 +258,30 @@ public void uploadFile() { } /** - * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String)} - */ - public void uploadFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string - fileAsyncClient.uploadFromFile("someFilePath").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.uploadFromFile#string - } - - /** - * Generates a code sample for using {@link FileClient#uploadFromFile(String, FileRangeWriteType)} + * Generates a code sample for using {@link FileClient#uploadFromFile(String)} */ public void uploadFileMaxOverload() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype - fileClient.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE); + fileClient.uploadFromFile("someFilePath"); if (fileClient.getProperties() != null) { System.out.printf("Upload the file with length of %d completed", - fileClient.getProperties().value().contentLength()); + fileClient.getProperties().contentLength()); } // END: com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype } - /** - * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String, FileRangeWriteType)} - */ - public void uploadFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string-filerangewritetype - fileAsyncClient.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE) - .subscribe(response -> { - if (fileAsyncClient.getProperties() != null) { - System.out.printf("Upload the file with length of %d completed", - fileAsyncClient.getProperties().block().value().contentLength()); - } - }); - // END: com.azure.storage.file.fileAsyncClient.uploadFromFile#string-filerangewritetype - } - /** * Generates a code sample for using {@link FileClient#downloadWithProperties()} */ public void downloadData() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.downloadWithProperties - Response response = fileClient.downloadWithProperties(); - System.out.println("Complete downloading the data with status code: " + response.statusCode()); - response.value().body().subscribe( - byteBuf -> System.out.println("Complete downloading the data with body: " - + byteBuf.toString(StandardCharsets.UTF_8)), + FileDownloadInfo response = fileClient.downloadWithProperties(); + System.out.println("Complete downloading the data."); + response.body().subscribe( + byteBuffer -> System.out.println("Complete downloading the data with body: " + + new String(byteBuffer.array(), StandardCharsets.UTF_8)), error -> System.err.print(error.toString()), () -> System.out.println("Complete downloading the data!") ); @@ -381,49 +289,22 @@ public void downloadData() { } /** - * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties()} + * Generates a code sample for using {@link FileClient#downloadWithPropertiesWithResponse( + * FileRange, Boolean, Context)} */ - public void downloadDataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties - fileAsyncClient.downloadWithProperties().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the data!") - ); - // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties - } - - /** - * Generates a code sample for using {@link FileClient#downloadWithProperties(FileRange, Boolean)} - */ - public void downloadDataMaxOverload() { + public void downloadWithPropertiesWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.downloadWithProperties#filerange-boolean - Response response = fileClient.downloadWithProperties(new FileRange(1024, 2047L), - false); + // BEGIN: com.azure.storage.file.fileClient.downloadWithPropertiesWithResponse#filerange-boolean-Context + Response response = fileClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), + false, new Context(key1, value1)); System.out.println("Complete downloading the data with status code: " + response.statusCode()); response.value().body().subscribe( - byteBuf -> System.out.println("Complete downloading the data with body: " - + byteBuf.toString(StandardCharsets.UTF_8)), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the data!") - ); - // END: com.azure.storage.file.fileClient.downloadWithProperties#filerange-boolean - } - - /** - * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties(FileRange, Boolean)} - */ - public void downloadDataAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean - fileAsyncClient.downloadWithProperties(new FileRange(1024, 2047L), false).subscribe( - response -> { }, + byteBuffer -> System.out.println("Complete downloading the data with body: " + + new String(byteBuffer.array(), StandardCharsets.UTF_8)), error -> System.err.print(error.toString()), () -> System.out.println("Complete downloading the data!") ); - // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean + // END: com.azure.storage.file.fileClient.downloadWithPropertiesWithResponse#filerange-boolean-Context } /** @@ -439,24 +320,6 @@ public void downloadFile() { // END: com.azure.storage.file.fileClient.downloadToFile#string } - /** - * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String)} - */ - public void downloadFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string - fileAsyncClient.downloadToFile("somelocalfilepath").subscribe( - response -> { - if (Files.exists(Paths.get("somelocalfilepath"))) { - System.out.println("Successfully downloaded the file."); - } - }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string - } - /** * Generates a code sample for using {@link FileClient#downloadToFile(String, FileRange)} */ @@ -470,47 +333,26 @@ public void downloadFileMaxOverload() { // END: com.azure.storage.file.fileClient.downloadToFile#string-filerange } - /** - * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String, FileRange)} - */ - public void downloadFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange - fileAsyncClient.downloadToFile("somelocalfilepath", new FileRange(1024, 2047L)).subscribe( - response -> { - if (Files.exists(Paths.get("somelocalfilepath"))) { - System.out.println("Successfully downloaded the file."); - } - }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange - } - /** * Generates a code sample for using {@link FileClient#delete()} */ public void deleteFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.delete - VoidResponse response = fileClient.delete(); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); + fileClient.delete(); + System.out.println("Complete deleting the file."); // END: com.azure.storage.file.fileClient.delete } /** - * Generates a code sample for using {@link FileAsyncClient#delete()} + * Generates a code sample for using {@link FileClient#deleteWithResponse(Context)} */ - public void deleteFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.delete - fileAsyncClient.delete().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.delete + public void deleteWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.deleteWithResponse#Context + VoidResponse response = fileClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Complete deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.fileClient.deleteWithResponse#Context } /** @@ -519,24 +361,20 @@ public void deleteFileAsync() { public void getProperties() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.getProperties - Response response = fileClient.getProperties(); - FileProperties properties = response.value(); + FileProperties properties = fileClient.getProperties(); System.out.printf("File latest modified date is %s.", properties.lastModified()); // END: com.azure.storage.file.fileClient.getProperties } /** - * Generates a code sample for using {@link FileAsyncClient#getProperties()} + * Generates a code sample for using {@link FileClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.getProperties - fileAsyncClient.getProperties() - .subscribe(response -> { - FileProperties properties = response.value(); - System.out.printf("File latest modified date is %s.", properties.lastModified()); - }); - // END: com.azure.storage.file.fileAsyncClient.getProperties + public void getPropertiesWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.getPropertiesWithResponse#Context + Response response = fileClient.getPropertiesWithResponse(new Context(key1, value1)); + System.out.printf("File latest modified date is %s.", response.value().lastModified()); + // END: com.azure.storage.file.fileClient.getPropertiesWithResponse#Context } /** @@ -545,93 +383,118 @@ public void getPropertiesAsync() { public void setMetadata() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.setMetadata#map - Response response = fileClient.setMetadata( - Collections.singletonMap("file", "updatedMetadata")); - System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()); + fileClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")); + System.out.printf("Setting the file metadata completed."); // END: com.azure.storage.file.fileClient.setMetadata#map } /** - * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} + * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Context)} */ - public void setMetadataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map - fileAsyncClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")) - .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context + Response response = fileClient.setMetadataWithResponse( + Collections.singletonMap("file", "updatedMetadata"), new Context(key1, value1)); + System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context } /** - * Generates a code sample for using {@link FileClient#setMetadata(Map)} to clear metadata. + * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Context)} to clear metadata. */ - public void clearMetadata() { + public void clearMetadataWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata - Response response = fileClient.setMetadata(null); + // BEGIN: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context.clearMetadata + Response response = fileClient.setMetadataWithResponse(null, + new Context(key1, value1)); System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata + // END: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context.clearMetadata } /** - * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} to clear metadata. + * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Context)} to clear metadata. */ - public void clearMetadataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata - fileAsyncClient.setMetadata(null) - .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata + public void clearMetadata() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata + fileClient.setMetadata(null); + System.out.printf("Setting the file metadata completed."); + // END: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata } /** - * Generates a code sample for using {@link FileClient#setHttpHeaders(long, FileHTTPHeaders)} + * Generates a code sample for using {@link FileClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} */ public void setHTTPHeaders() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = fileClient.setHttpHeaders(1024, httpHeaders); - System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders + // BEGIN: com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + fileClient.setProperties(1024, httpHeaders, smbProperties, filePermission); + System.out.printf("Setting the file httpHeaders completed."); + // END: com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string + } + + /** + * Generates a code sample for using {@link FileClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + * to clear httpHeaders and preserve SMB properties. + */ + public void clearSyncHTTPHeaders() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties + FileInfo response = fileClient.setProperties(1024, null, null, null); + System.out.printf("Setting the file httpHeaders completed."); + // END: com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties } /** - * Generates a code sample for using {@link FileAsyncClient#setHttpHeaders(long, FileHTTPHeaders)} + * Generates a code sample for using {@link FileClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String, Context)} */ - public void setHTTPHeadersAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - fileAsyncClient.setHttpHeaders(1024, httpHeaders) - .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders + public void setHttpHeadersWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-Context + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + Response response = fileClient.setPropertiesWithResponse(1024, httpHeaders, smbProperties, + filePermission, new Context(key1, value1)); + System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-Context } /** - * Generates a code sample for using {@link FileClient#setHttpHeaders(long, FileHTTPHeaders)} to clear httpHeaders. + * Generates a code sample for using {@link FileClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String, Context)} + * (long, FileHTTPHeaders)} to clear httpHeaders. */ public void clearHTTPHeaders() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders - Response response = fileClient.setHttpHeaders(1024, null); + // BEGIN: com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-Context.clearHttpHeaderspreserveSMBProperties + Response response = fileClient.setPropertiesWithResponse(1024, null, null, null, + new Context(key1, value1)); System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders - } - - /** - * Generates a code sample for using {@link FileAsyncClient#setHttpHeaders(long, FileHTTPHeaders)} to clear httpHeaders. - */ - public void clearHTTPHeadersAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders - fileAsyncClient.setHttpHeaders(1024, null) - .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders + // END: com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-Context.clearHttpHeaderspreserveSMBProperties } /** @@ -646,16 +509,6 @@ public void listRanges() { // END: com.azure.storage.file.fileClient.listRanges } - /** - * Generates a code sample for using {@link FileAsyncClient#listRanges()} - */ - public void listRangesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges - fileAsyncClient.listRanges().subscribe(range -> - System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end())); - // END: com.azure.storage.file.fileAsyncClient.listRanges - } /** * Generates a code sample for using {@link FileClient#listRanges(FileRange)} */ @@ -668,17 +521,6 @@ public void listRangesMaxOverload() { // END: com.azure.storage.file.fileClient.listRanges#filerange } - /** - * Generates a code sample for using {@link FileAsyncClient#listRanges(FileRange)} - */ - public void listRangesAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges#filerange - fileAsyncClient.listRanges(new FileRange(1024, 2048L)) - .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", - result.start(), result.end())); - // END: com.azure.storage.file.fileAsyncClient.listRanges#filerange - } /** * Generates a code sample for using {@link FileClient#listHandles()} */ @@ -686,21 +528,11 @@ public void listHandles() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.listHandles fileClient.listHandles() - .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", + .forEach(handleItem -> System.out.printf("List handles completed with handleId %s", handleItem.handleId())); // END: com.azure.storage.file.fileClient.listHandles } - /** - * Generates a code sample for using {@link FileAsyncClient#listHandles()} - */ - public void listHandlesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles - fileAsyncClient.listHandles() - .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); - // END: com.azure.storage.file.fileAsyncClient.listHandles - } /** * Generates a code sample for using {@link FileClient#listHandles(Integer)} */ @@ -708,21 +540,11 @@ public void listHandlesWithOverload() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.listHandles#integer fileClient.listHandles(10) - .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", + .forEach(handleItem -> System.out.printf("List handles completed with handleId %s", handleItem.handleId())); // END: com.azure.storage.file.fileClient.listHandles#integer } - /** - * Generates a code sample for using {@link FileAsyncClient#listHandles(Integer)} - */ - public void listHandlesAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles#integer - fileAsyncClient.listHandles(10) - .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); - // END: com.azure.storage.file.fileAsyncClient.listHandles#integer - } /** * Generates a code sample for using {@link FileClient#forceCloseHandles(String)} */ @@ -738,20 +560,36 @@ public void forceCloseHandles() { } /** - * Generates a code sample for using {@link FileAsyncClient#forceCloseHandles(String)} + * Generates a code sample for using {@link FileClient#generateSAS(String, FileSASPermission, OffsetDateTime, + * OffsetDateTime, String, SASProtocol, IPRange, String, String, String, String, String)} */ - public void forceCloseHandlesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string - fileAsyncClient.listHandles(10) - .subscribe(result -> { - fileAsyncClient.forceCloseHandles(result.handleId()).subscribe(numOfClosedHandles -> - System.out.printf("Close %d handles.", numOfClosedHandles)); - }); - // END: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string - } - - /** + public void generateSAS() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.FileClient.generateSAS#String-FileSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + String identifier = "identifier"; + FileSASPermission permissions = new FileSASPermission() + .read(true) + .create(true) + .delete(true) + .write(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String cacheControl = "cache"; + String contentDisposition = "disposition"; + String contentEncoding = "encoding"; + String contentLanguage = "language"; + String contentType = "type"; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + String sas = fileClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + // END: com.azure.storage.file.FileClient.generateSAS#String-FileSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** * Generates a code sample for using {@link FileClient#getShareSnapshotId()} */ public void getShareSnapshotId() { @@ -761,27 +599,11 @@ public void getShareSnapshotId() { .endpoint("https://${accountName}.file.core.windows.net") .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) .shareName("myshare") - .filePath("myfile") + .resourcePath("myfile") .snapshot(currentTime.toString()) - .buildClient(); - fileClient.getShareSnapshotId(); - // END: com.azure.storage.file.fileClient.getShareSnapshotId - } + .buildFileClient(); - /** - * Generates a code sample for using {@link FileAsyncClient#getShareSnapshotId()} - */ - public void getShareSnapshotIdAsync() { - // BEGIN: com.azure.storage.file.fileAsyncClient.getShareSnapshotId - OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .endpoint("https://${accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) - .shareName("myshare") - .filePath("myfiile") - .snapshot(currentTime.toString()) - .buildAsyncClient(); - fileAsyncClient.getShareSnapshotId(); - // END: com.azure.storage.file.fileAsyncClient.getShareSnapshotId + System.out.printf("Snapshot ID: %s%n", fileClient.getShareSnapshotId()); + // END: com.azure.storage.file.fileClient.getShareSnapshotId } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java index b33587dab198..43391ab2b9f2 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java @@ -2,18 +2,16 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import com.azure.storage.file.models.StorageException; import java.io.File; import java.io.IOException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.UUID; @@ -33,9 +31,8 @@ private static String generateRandomName() { * The main method shows how to do the base operation using file sync client. * @param args No args needed for the main method. * @throws RuntimeException If error occurs when make storage API call. - * @throws Exception If there are any IO exception occurs. */ - public static void main(String[] args) throws Exception { + public static void main(String[] args) { String shareName = generateRandomName(); ShareClient shareClient = new ShareClientBuilder().endpoint(ENDPOINT).shareName(shareName).buildClient(); shareClient.create(); @@ -45,93 +42,92 @@ public static void main(String[] args) throws Exception { // Create a source file client String srcFileName = generateRandomName(); FileClient srcFileClient = new FileClientBuilder().endpoint(ENDPOINT).shareName(shareName) - .filePath(parentDirName + "/" + srcFileName).buildClient(); + .resourcePath(parentDirName + "/" + srcFileName).buildFileClient(); // Create a source file try { srcFileClient.create(1024); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create source client. Reasons: " + e.getMessage()); } // Upload some data bytes to the src file. String dataText = "Hello, file client sample!"; - ByteBuf uploadData = Unpooled.wrappedBuffer(dataText.getBytes(StandardCharsets.UTF_8)); + ByteBuffer uploadData = ByteBuffer.wrap(dataText.getBytes(StandardCharsets.UTF_8)); try { - srcFileClient.upload(uploadData, uploadData.readableBytes()); - } catch (StorageErrorException e) { + srcFileClient.upload(uploadData, uploadData.remaining()); + } catch (StorageException e) { System.out.println("Failed to upload the data. Reasons: " + e.getMessage()); } // Create a destination file client. String destFileName = generateRandomName(); FileClient destFileClient = new FileClientBuilder().endpoint(ENDPOINT).shareName(shareName) - .filePath(parentDirName + "/" + destFileName).buildClient(); + .resourcePath(parentDirName + "/" + destFileName).buildFileClient(); destFileClient.create(1024); // Copy the file from source file to destination file. - URL clientURL = null; - clientURL = srcFileClient.getFileUrl(); + URL clientURL = srcFileClient.getFileUrl(); String sourceURL = clientURL.toString() + "/" + shareName + "/" + parentDirName + "/" + srcFileName; - Response copyResponse = null; + FileCopyInfo copyResponse = null; try { copyResponse = destFileClient.startCopy(sourceURL, null); - } catch (StorageErrorException e) { + } catch (StorageException e) { throw new RuntimeException("Failed to start the copy of source file. Reasons: " + e.getMessage()); } // Abort the copy if the status is pending. - if (copyResponse.value().copyStatus() == CopyStatusType.PENDING) { + if (copyResponse.copyStatus() == CopyStatusType.PENDING) { try { - destFileClient.abortCopy(copyResponse.value().copyId()); - } catch (StorageErrorException e) { + destFileClient.abortCopy(copyResponse.copyId()); + } catch (StorageException e) { System.out.println("Failed to abort the copy. Reasons: " + e.getMessage()); } } // Upload a local file to the storage. - URL fileFolder = FileSample.class.getClassLoader().getResource("."); - String uploadPath = fileFolder.getPath() + "testfiles/" + "uploadSample.txt"; + String filePath = "C:/resourcePath/"; + String uploadPath = filePath + "testfiles/" + "uploadSample.txt"; try { srcFileClient.uploadFromFile(uploadPath); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to upload file to storage. Reasons: " + e.getMessage()); } // Download storage file to local file. - String downloadPath = fileFolder.getPath() + "testfiles/" + "downloadSample.txt"; + String downloadPath = filePath + "testfiles/" + "downloadSample.txt"; File downloadFile = new File(downloadPath); try { - if (!Files.exists(downloadFile.toPath())) { - downloadFile.createNewFile(); + if (!Files.exists(downloadFile.toPath()) && !downloadFile.createNewFile()) { + throw new RuntimeException("Failed to create new upload file."); } } catch (IOException e) { throw new RuntimeException("Failed to create new upload file."); } try { srcFileClient.downloadToFile(downloadPath); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to download file from storage. Reasons: " + e.getMessage()); } - if (!Files.exists(downloadFile.toPath())) { - downloadFile.delete(); + if (Files.exists(downloadFile.toPath()) && !downloadFile.delete()) { + System.out.println("Failed to delete download file."); } // Get the file properties try { - Response propertiesResponse = srcFileClient.getProperties(); - System.out.printf("This is the eTag: %s of the file. File type is : %s.", propertiesResponse.value().eTag(), propertiesResponse.value().fileType()); - } catch (StorageErrorException e) { + FileProperties propertiesResponse = srcFileClient.getProperties(); + System.out.printf("This is the eTag: %s of the file. File type is : %s.", propertiesResponse.eTag(), propertiesResponse.fileType()); + } catch (StorageException e) { System.out.println("Failed to get file properties. Reasons: " + e.getMessage()); } // Delete the source file. try { srcFileClient.delete(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the src file. Reasons: " + e.getMessage()); } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..afc509e6ced9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.AccountSASPermission; +import com.azure.storage.common.AccountSASResourceType; +import com.azure.storage.common.AccountSASService; +import com.azure.storage.common.Constants; +import com.azure.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.FileServiceProperties; +import com.azure.storage.file.models.ListSharesOptions; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link FileServiceClient} and {@link FileServiceAsyncClient}. + */ +public class FileServiceAsyncJavaDocCodeSamples { + + /** + * Generates code sample for {@link FileServiceAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation + ShareAsyncClient client = new ShareClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileServiceAsyncClient} + */ + public FileServiceAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken + return fileServiceAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileServiceAsyncClient} + */ + public FileServiceAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential + return fileServiceAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link FileServiceAsyncClient} + */ + public FileServiceAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring + return fileServiceAsyncClient; + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String)} + */ + public void createShareAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string + fileServiceAsyncClient.createShare("myshare").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#createShareWithResponse(String, Map, Integer)} with metadata + */ + public void createShareWithResponse() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata + fileServiceAsyncClient.createShareWithResponse("test", Collections.singletonMap("share", "metadata"), null) + .subscribe( + response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#createShareWithResponse(String, Map, Integer)} with quota. + */ + public void createShareAsyncWithQuota() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota + fileServiceAsyncClient.createShareWithResponse("test", null, 10) + .subscribe( + response -> System.out.printf("Creating the share completed with status code %d", + response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#listShares()} + */ + public void listSharesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares + fileServiceAsyncClient.listShares().subscribe( + shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the shares!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.listShares + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of prefix. + */ + public void listSharesAsyncWithPrefix() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix + fileServiceAsyncClient.listShares(new ListSharesOptions().prefix("azure")).subscribe( + shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the shares!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of metadata and snapshot. + */ + public void listSharesAsyncWithOverload() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot + fileServiceAsyncClient.listShares(new ListSharesOptions().includeMetadata(true) + .includeSnapshots(true)).subscribe( + shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the shares!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String)} + */ + public void deleteShareAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string + fileServiceAsyncClient.deleteShare("test").doOnSuccess( + response -> System.out.println("Deleting the share completed.") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#deleteShareWithResponse(String, String)} + */ + public void deleteShareAsyncMaxOverload() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string + OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + fileServiceAsyncClient.deleteShareWithResponse("test", midnight.toString()) + .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getProperties + fileServiceAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse + fileServiceAsyncClient.getPropertiesWithResponse() + .subscribe(properties -> { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.value().hourMetrics().enabled(), properties.value().minuteMetrics().enabled()); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} + */ + public void setPropertiesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties + fileServiceAsyncClient.getProperties().subscribe(properties -> { + properties.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + + fileServiceAsyncClient.setProperties(properties) + .subscribe(r -> System.out.println("Setting File service properties completed.")); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties + } + + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#setPropertiesWithResponse(FileServiceProperties)} + */ + public void setPropertiesWithResponseAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties + fileServiceAsyncClient.getPropertiesWithResponse().subscribe(response -> { + FileServiceProperties properties = response.value(); + properties.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + + fileServiceAsyncClient.setPropertiesWithResponse(properties).subscribe(r -> + System.out.printf("Setting File service properties completed with status code %d", r.statusCode())); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#setPropertiesWithResponse(FileServiceProperties)} to clear CORS in file service. + */ + public void clearPropertiesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS + fileServiceAsyncClient.getProperties().subscribe(properties -> { + properties.cors(Collections.emptyList()); + + fileServiceAsyncClient.setPropertiesWithResponse(properties).subscribe(response -> + System.out.printf("Setting File service properties completed with status code %d", + response.statusCode())); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#generateAccountSAS(AccountSASService, + * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IPRange, SASProtocol)} + */ + public void generateAccountSASAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.FileServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol + AccountSASService service = new AccountSASService() + .blob(true) + .file(true) + .queue(true) + .table(true); + AccountSASResourceType resourceType = new AccountSASResourceType() + .container(true) + .object(true) + .service(true); + AccountSASPermission permission = new AccountSASPermission() + .read(true) + .add(true) + .create(true) + .write(true) + .delete(true) + .list(true) + .processMessages(true) + .update(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + + String sas = fileServiceAsyncClient.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, + version, ipRange, sasProtocol); + // END: com.azure.storage.file.FileServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java index b2f4a959e906..2411805d40ee 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java @@ -4,12 +4,18 @@ 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.file.models.FileServiceProperties; import com.azure.storage.file.models.ListSharesOptions; - import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; @@ -20,6 +26,10 @@ * Contains code snippets when generating javadocs through doclets for {@link FileServiceClient} and {@link FileServiceAsyncClient}. */ public class FileServiceJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link FileServiceClient} instantiation. */ @@ -56,19 +66,6 @@ public FileServiceClient createClientWithSASToken() { return fileServiceClient; } - /** - * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileServiceAsyncClient} - */ - public FileServiceAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken - FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .buildAsyncClient(); - // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken - return fileServiceAsyncClient; - } - /** * Generates code sample for creating a {@link FileServiceClient} with {@link SASTokenCredential} * {@code SASTokenQueryParams} is composed of the Key @@ -84,20 +81,6 @@ public FileServiceClient createClientWithCredential() { return fileServiceClient; } - /** - * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileServiceAsyncClient} - */ - public FileServiceAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential - FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .buildAsyncClient(); - // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential - return fileServiceAsyncClient; - } - /** * Generates code sample for creating a {@link FileServiceClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link FileServiceClient} @@ -113,20 +96,6 @@ public FileServiceClient createClientWithConnectionString() { return fileServiceClient; } - /** - * Generates code sample for creating a {@link FileServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link FileServiceAsyncClient} - */ - public FileServiceAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring - return fileServiceAsyncClient; - } /** * Generates a code sample for using {@link FileServiceClient#createShare(String)} @@ -134,77 +103,21 @@ public FileServiceAsyncClient createAsyncClientWithConnectionString() { public void createShare() { FileServiceClient fileServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string - Response response = fileServiceClient.createShare("myshare"); - System.out.printf("Creating the share completed with status code %d", response.statusCode()); + fileServiceClient.createShare("myshare"); + System.out.println("Creating the share completed."); // END: com.azure.storage.file.fileServiceClient.createShare#string } /** - * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String)} - */ - public void createShareAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string - fileServiceAsyncClient.createShare("myshare").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string - } - - /** - * Generates a code sample for using {@link FileServiceClient#createShare(String, Map, Integer)} with metadata + * Generates a code sample for using {@link FileServiceClient#createShareWithResponse(String, Map, Integer, Context)} with metadata */ public void createShareWithMetadata() { FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.metadata - Response response = fileServiceClient.createShare("test", - Collections.singletonMap("share", "metadata"), null); + // BEGIN: com.azure.storage.file.FileServiceClient.createShareWithResponse#String-Map-Integer-Context + Response response = fileServiceClient.createShareWithResponse("test", + Collections.singletonMap("share", "metadata"), null, new Context(key1, value1)); System.out.printf("Creating the share completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.metadata - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String, Map, Integer)} with metadata - */ - public void createShareAsyncWithMetadata() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.metadata - fileServiceAsyncClient.createShare("test", Collections.singletonMap("share", "metadata"), null) - .subscribe( - response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.metadata - } - - /** - * Generates a code sample for using {@link FileServiceClient#createShare(String, Map, Integer)} with quota. - */ - public void createShareWithQuota() { - FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.quota - Response response = fileServiceClient.createShare("test", null, 10); - System.out.printf("Creating the share completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.quota - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String, Map, Integer)} with quota. - */ - public void createShareAsyncWithQuota() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.quota - fileServiceAsyncClient.createShare("test", null, 10) - .subscribe( - response -> System.out.printf("Creating the share completed with status code %d", - response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.quota + // END: com.azure.storage.file.FileServiceClient.createShareWithResponse#String-Map-Integer-Context } /** @@ -219,20 +132,6 @@ public void listShares() { // END: com.azure.storage.file.fileServiceClient.listShares } - /** - * Generates a code sample for using {@link FileServiceAsyncClient#listShares()} - */ - public void listSharesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares - fileServiceAsyncClient.listShares().subscribe( - shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the shares!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.listShares - } - /** * Generates a code sample for using {@link FileServiceClient#listShares(ListSharesOptions)} of prefix. */ @@ -245,20 +144,6 @@ public void listSharesWithPrefix() { // END: com.azure.storage.file.fileServiceClient.listShares#ListSharesOptions.prefix } - /** - * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of prefix. - */ - public void listSharesAsyncWithPrefix() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix - fileServiceAsyncClient.listShares(new ListSharesOptions().prefix("azure")).subscribe( - shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the shares!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix - } - /** * Generates a code sample for using {@link FileServiceClient#listShares(ListSharesOptions)} of metadata and snapshot. */ @@ -272,21 +157,6 @@ public void listSharesWithMetadataAndSnapshot() { // END: com.azure.storage.file.fileServiceClient.listShares#ListSharesOptions.metadata.snapshot } - /** - * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of metadata and snapshot. - */ - public void listSharesAsyncWithOverload() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot - fileServiceAsyncClient.listShares(new ListSharesOptions().includeMetadata(true) - .includeSnapshots(true)).subscribe( - shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the shares!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot - } - /** * Generates a code sample for using {@link FileServiceClient#deleteShare(String)} */ @@ -298,40 +168,16 @@ public void deleteShare() { } /** - * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String)} - */ - public void deleteShareAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string - fileServiceAsyncClient.deleteShare("test").subscribe( - response -> System.out.println("Deleting the share completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string - } - - /** - * Generates a code sample for using {@link FileServiceClient#deleteShare(String, String)} + * Generates a code sample for using {@link FileServiceClient#deleteShareWithResponse(String, String, Context)} */ public void deleteShareMaxOverload() { FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.deleteShare#string-string + // BEGIN: com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-Context OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - VoidResponse response = fileServiceClient.deleteShare("test", midnight.toString()); + VoidResponse response = fileServiceClient.deleteShareWithResponse("test", midnight.toString(), + new Context(key1, value1)); System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.deleteShare#string-string - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String, String)} - */ - public void deleteShareAsyncMaxOverload() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string-string - OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - fileServiceAsyncClient.deleteShare("test", midnight.toString()) - .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string-string + // END: com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-Context } /** @@ -340,25 +186,34 @@ public void deleteShareAsyncMaxOverload() { public void getProperties() { FileServiceClient fileServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileServiceClient.getProperties - FileServiceProperties properties = fileServiceClient.getProperties().value(); + FileServiceProperties properties = fileServiceClient.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); // END: com.azure.storage.file.fileServiceClient.getProperties } /** - * Generates a code sample for using {@link FileServiceAsyncClient#getProperties()} + * Generates a code sample for using {@link FileServiceClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getProperties - fileServiceAsyncClient.getProperties() - .subscribe(response -> { - FileServiceProperties properties = response.value(); - System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", - properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); - }); - // END: com.azure.storage.file.fileServiceAsyncClient.getProperties + public void getPropertiesWithRespose() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceClient.getPropertiesWithRespose#Context + Response properties = fileServiceClient.getPropertiesWithResponse(new Context(key1, value1)); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.value().hourMetrics().enabled(), + properties.value().minuteMetrics().enabled()); + // END: com.azure.storage.file.fileServiceClient.getPropertiesWithRespose#Context + } + + /** + * Generates a code sample for using {@link FileServiceClient#getPropertiesWithResponse(Context)} + */ + public void getPropertiesWithResponse() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#Context + FileServiceProperties properties = fileServiceClient.getPropertiesWithResponse(new Context(key1, value1)).value(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), + properties.minuteMetrics().enabled()); + // END: com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#Context } /** @@ -367,31 +222,30 @@ public void getPropertiesAsync() { public void setProperties() { FileServiceClient fileServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties - FileServiceProperties properties = fileServiceClient.getProperties().value(); + FileServiceProperties properties = fileServiceClient.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - VoidResponse response = fileServiceClient.setProperties(properties); - System.out.printf("Setting File service properties completed with status code %d", response.statusCode()); + fileServiceClient.setProperties(properties); + System.out.println("Setting File service properties completed."); // END: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties } /** - * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} + * Generates a code sample for using {@link FileServiceClient#setProperties(FileServiceProperties)} */ - public void setPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties - FileServiceProperties properties = fileServiceAsyncClient.getProperties().block().value(); + public void setPropertiesWithResponse() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context + FileServiceProperties properties = fileServiceClient.getPropertiesWithResponse(new Context(key1, value1)).value(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - fileServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties + VoidResponse response = fileServiceClient.setPropertiesWithResponse(properties, new Context(key1, value1)); + System.out.printf("Setting File service properties completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context } /** @@ -399,27 +253,52 @@ public void setPropertiesAsync() { */ public void clearProperties() { FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties.clearCORS - FileServiceProperties properties = fileServiceClient.getProperties().value(); + // BEGIN: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS + FileServiceProperties properties = fileServiceClient.getProperties(); properties.cors(Collections.emptyList()); - VoidResponse response = fileServiceClient.setProperties(properties); + VoidResponse response = fileServiceClient.setPropertiesWithResponse(properties, new Context(key1, value1)); System.out.printf("Setting File service properties completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties.clearCORS + // END: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS } /** - * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} to clear CORS in file service. + * Generates a code sample for using {@link FileServiceClient#generateAccountSAS(AccountSASService, + * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IPRange, SASProtocol)} */ - public void clearPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties.clearCORS - FileServiceProperties properties = fileServiceAsyncClient.getProperties().block().value(); - properties.cors(Collections.emptyList()); - - fileServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties.clearCORS + public void generateAccountSAS() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.FileServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol + AccountSASService service = new AccountSASService() + .blob(true) + .file(true) + .queue(true) + .table(true); + AccountSASResourceType resourceType = new AccountSASResourceType() + .container(true) + .object(true) + .service(true); + AccountSASPermission permission = new AccountSASPermission() + .read(true) + .add(true) + .create(true) + .write(true) + .delete(true) + .list(true) + .processMessages(true) + .update(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + + String sas = fileServiceClient.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, + version, ipRange, sasProtocol); + // END: com.azure.storage.file.FileServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol } + + } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java index 931aa6b7ecee..f58aed817e74 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java @@ -2,10 +2,9 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; import java.util.UUID; @@ -33,28 +32,28 @@ public static void main(String[] args) { for (int i = 0; i < 3; i++) { try { fileServiceClient.createShare(generateRandomName()); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.printf("Failed to create share %d. Reasons: %s", i, e.getMessage()); } } // Get properties from the file service try { - Response response = fileServiceClient.getProperties(); + FileServiceProperties properties = fileServiceClient.getProperties(); - System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b\n", - response.value().hourMetrics(), response.value().minuteMetrics()); - } catch (StorageErrorException e) { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", + properties.hourMetrics(), properties.minuteMetrics()); + } catch (StorageException e) { System.out.println("Failed to get the account properties. Reasons: " + e.getMessage()); } // List all shares under file service and delete them. fileServiceClient.listShares().forEach( shareItem -> { try { - System.out.printf("This is the share name: %s in the file account.\n", shareItem.name()); + System.out.printf("This is the share name: %s in the file account.%n", shareItem.name()); fileServiceClient.deleteShare(shareItem.name()); System.out.println("The share has been deleted from the storage file account!"); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the share. Reasons: " + e.getMessage()); } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..d479e571d5aa --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Constants; +import com.azure.storage.common.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.file.models.AccessPolicy; +import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.NtfsFileAttributes; +import com.azure.storage.file.models.SignedIdentifier; + +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.EnumSet; +import java.util.List; +import java.util.Map; + +/** +* Contains code snippets when generating javadocs through doclets for {@link ShareAsyncClient}. +*/ +public class ShareAsyncJavaDocCodeSamples { + + + /** + * Generates code sample for {@link ShareAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation + ShareAsyncClient client = new ShareClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link ShareAsyncClient} + */ + public ShareAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.sastoken + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .shareName("myshare") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.sastoken + return shareAsyncClient; + } + + /** + * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link ShareAsyncClient} + */ + public ShareAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.credential + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .shareName("myshare") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.credential + return shareAsyncClient; + } + + /** + * Generates code sample for creating a {@link ShareAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link ShareAsyncClient} + */ + public ShareAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() + .connectionString(connectionString).shareName("myshare") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring + return shareAsyncClient; + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#create} + */ + public void createShareAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.create + shareAsyncClient.create().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.shareAsyncClient.create + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createWithResponse(Map, Integer)} with Metadata. + */ + public void createWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata + shareAsyncClient.createWithResponse(Collections.singletonMap("share", "metadata"), null).subscribe( + response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createWithResponse(Map, Integer)} with Quota. + */ + public void createShareAsyncMaxOverloadQuota() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota + shareAsyncClient.createWithResponse(null, 10).subscribe( + response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String)} + */ + public void createDirectoryAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string + shareAsyncClient.createDirectory("mydirectory").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the directory!") + ); + // END: com.azure.storage.file.shareAsyncClient.createDirectory#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} + */ + public void createFileAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long + shareAsyncClient.createFile("myfile", 1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the directory!") + ); + // END: com.azure.storage.file.shareAsyncClient.createFile#string-long + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createSnapshot()} + */ + public void createSnapshotAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot + shareAsyncClient.createSnapshot().subscribe( + response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + + response.snapshot()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete creating the share snapshot.") + ); + // END: com.azure.storage.file.shareAsyncClient.createSnapshot + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createSnapshotWithResponse(Map)} + */ + public void createSnapshotAsyncWithMetadata() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map + shareAsyncClient.createSnapshotWithResponse(Collections.singletonMap("snapshot", "metadata")).subscribe( + response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + + response.value().snapshot()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete creating the share snapshot.") + ); + // END: com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createDirectoryWithResponse(String, FileSmbProperties, String, Map)} + */ + public void createDirectoryWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-filesmbproperties-string-map + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + shareAsyncClient.createDirectoryWithResponse("documents", smbProperties, filePermission, + Collections.singletonMap("directory", "metadata")) + .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-filesmbproperties-string-map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} + */ + public void createFileAsyncMaxOverload() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map + shareAsyncClient.createFile("myfile", 1024) + .doOnSuccess(response -> System.out.println("Creating the file completed.")); + // END: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createFileWithResponse(String, long, FileHTTPHeaders, FileSmbProperties, String, Map)} + */ + public void createFileWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + shareAsyncClient.createFileWithResponse("myfile", 1024, httpHeaders, smbProperties, filePermission, + Collections.singletonMap("directory", "metadata")) + .subscribe(response -> System.out.printf("Creating the file completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#deleteDirectory(String)} + */ + public void deleteDirectoryAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.deleteDirectory#string + shareAsyncClient.deleteDirectory("mydirectory").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the directory.") + ); + // END: com.azure.storage.file.shareAsyncClient.deleteDirectory#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#deleteFile(String)} + */ + public void deleteFileAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.deleteFile#string + shareAsyncClient.deleteFile("myfile").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the file.") + ); + // END: com.azure.storage.file.shareAsyncClient.deleteFile#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#delete} + */ + public void deleteShareAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.delete + shareAsyncClient.delete().subscribe( + response -> System.out.println("Deleting the shareAsyncClient completed."), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the share.") + ); + // END: com.azure.storage.file.shareAsyncClient.delete + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.deleteWithResponse + shareAsyncClient.deleteWithResponse().subscribe( + response -> System.out.println("Deleting the shareAsyncClient completed with status code: " + + response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the share.") + ); + // END: com.azure.storage.file.shareAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getProperties + shareAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); + }); + // END: com.azure.storage.file.shareAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse + shareAsyncClient.getPropertiesWithResponse() + .subscribe(properties -> { + System.out.printf("Share quota: %d, Metadata: %s", properties.value().quota(), properties.value().metadata()); + }); + // END: com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setQuota(int)} + */ + public void setQuotaAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setQuota#int + shareAsyncClient.setQuota(1024).doOnSuccess(response -> + System.out.println("Setting the share quota completed.") + ); + // END: com.azure.storage.file.ShareAsyncClient.setQuota#int + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setQuotaWithResponse(int)} + */ + public void setQuotaWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int + shareAsyncClient.setQuotaWithResponse(1024) + .subscribe(response -> + System.out.printf("Setting the share quota completed with status code %d", response.statusCode()) + ); + // END: com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int + } + + + /** + * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} + */ + public void setMetadataAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadata#map + shareAsyncClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")).doOnSuccess(response -> + System.out.println("Setting the share metadata completed.") + ); + // END: com.azure.storage.file.shareAsyncClient.setMetadata#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setMetadataWithResponse(Map)} + */ + public void setMetadataWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadataWithResponse#map + shareAsyncClient.setMetadataWithResponse(Collections.singletonMap("share", "updatedMetadata")) + .subscribe(response -> + System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()) + ); + // END: com.azure.storage.file.shareAsyncClient.setMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} to clear the metadata. + */ + public void clearMetadataAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.clearMetadata#map + shareAsyncClient.setMetadata(null).doOnSuccess(response -> + System.out.println("Setting the share metadata completed.") + ); + // END: com.azure.storage.file.shareAsyncClient.clearMetadata#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getAccessPolicy()} + */ + public void getAccessPolicyAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getAccessPolicy + shareAsyncClient.getAccessPolicy() + .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.id(), + result.accessPolicy().permission()) + ); + // END: com.azure.storage.file.shareAsyncClient.getAccessPolicy + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicy(List)} + */ + public void setAccessPolicyAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setAccessPolicy#List + 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); + shareAsyncClient.setAccessPolicy(Collections.singletonList(permission)).doOnSuccess( + response -> System.out.println("Setting access policies completed.")); + // END: com.azure.storage.file.ShareAsyncClient.setAccessPolicy#List + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicyWithResponse(List)} + */ + public void setAccessPolicyWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List + 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); + shareAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("Setting access policies completed completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getStatistics()} + */ + public void getStatisticsAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getStatistics + shareAsyncClient.getStatistics().doOnSuccess(response -> System.out.printf("The share is using %d GB", + response.getShareUsageInGB())); + // END: com.azure.storage.file.shareAsyncClient.getStatistics + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createPermission(String)} + */ + public void createPermissionAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createPermission#string + shareAsyncClient.createPermission("filePermission").subscribe( + response -> System.out.printf("The file permission key is %s", response)); + // END: com.azure.storage.file.shareAsyncClient.createPermission#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createPermissionWithResponse(String)} + */ + public void createPermissionWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createPermissionWithResponse#string + shareAsyncClient.createPermissionWithResponse("filePermission").subscribe( + response -> System.out.printf("The file permission key is %s", response.value())); + // END: com.azure.storage.file.shareAsyncClient.createPermissionWithResponse#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getPermission(String)} + */ + public void getPermissionAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getPermission#string + shareAsyncClient.getPermission("filePermissionKey").subscribe( + response -> System.out.printf("The file permission is %s", response)); + // END: com.azure.storage.file.shareAsyncClient.getPermission#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getPermissionWithResponse(String)} + */ + public void getPermissionWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getPermissionWithResponse#string + shareAsyncClient.getPermissionWithResponse("filePermissionKey").subscribe( + response -> System.out.printf("The file permission is %s", response.value())); + // END: com.azure.storage.file.shareAsyncClient.getPermissionWithResponse#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getStatisticsWithResponse()} + */ + public void getStatisticsWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse + shareAsyncClient.getStatisticsWithResponse().subscribe(response -> System.out.printf("The share is using %d GB", + response.value().getShareUsageInGB())); + // END: com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getSnapshotId()} + */ + public void getSnapshotIdAsync() { + // BEGIN: com.azure.storage.file.shareAsyncClient.getSnapshotId + OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + ShareAsyncClient shareAysncClient = new ShareClientBuilder().endpoint("https://${accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) + .shareName("myshare") + .snapshot(currentTime.toString()) + .buildAsyncClient(); + + System.out.printf("Snapshot ID: %s%n", shareAysncClient.getSnapshotId()); + // END: com.azure.storage.file.shareAsyncClient.getSnapshotId + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#generateSAS(String, ShareSASPermission, OffsetDateTime, + * OffsetDateTime, String, SASProtocol, IPRange, String, String, String, String, String)} + */ + public void generateSASAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.generateSAS#String-ShareSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + String identifier = "identifier"; + ShareSASPermission permissions = new ShareSASPermission() + .read(true) + .create(true) + .delete(true) + .write(true) + .list(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String cacheControl = "cache"; + String contentDisposition = "disposition"; + String contentEncoding = "encoding"; + String contentLanguage = "language"; + String contentType = "type"; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + String sas = shareAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + // END: com.azure.storage.file.shareAsyncClient.generateSAS#String-ShareSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java index 46234818fa5a..60bfc749d378 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java @@ -4,28 +4,37 @@ 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.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.file.models.AccessPolicy; import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.NtfsFileAttributes; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.ShareSnapshotInfo; import com.azure.storage.file.models.ShareStatistics; import com.azure.storage.file.models.SignedIdentifier; - import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.Collections; +import java.util.EnumSet; import java.util.List; import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link ShareClient} and {@link ShareAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link ShareClient}. */ public class ShareJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link ShareClient} instantiation. */ @@ -38,18 +47,6 @@ public void initialization() { // END: com.azure.storage.file.shareClient.instantiation } - /** - * Generates code sample for {@link ShareAsyncClient} instantiation. - */ - public void asyncInitialization() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation - ShareAsyncClient client = new ShareClientBuilder() - .connectionString("${connectionString}") - .endpoint("${endpoint}") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link ShareClient} with {@link SASTokenCredential} * @return An instance of {@link ShareClient} @@ -65,19 +62,6 @@ public ShareClient createClientWithSASToken() { return shareClient; } - /** - * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link ShareAsyncClient} - */ - public ShareAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.sastoken - ShareAsyncClient shareAsyncClient = new ShareClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .shareName("myshare") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation.sastoken - return shareAsyncClient; - } /** * Generates code sample for creating a {@link ShareClient} with {@link SASTokenCredential} @@ -95,21 +79,6 @@ public ShareClient createClientWithCredential() { return shareClient; } - /** - * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link ShareAsyncClient} - */ - public ShareAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.credential - ShareAsyncClient shareAsyncClient = new ShareClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .shareName("myshare") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation.credential - return shareAsyncClient; - } - /** * Generates code sample for creating a {@link ShareClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link ShareClient} @@ -125,94 +94,49 @@ public ShareClient createClientWithConnectionString() { return shareClient; } - /** - * Generates code sample for creating a {@link ShareAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link ShareAsyncClient} - */ - public ShareAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - ShareAsyncClient shareAsyncClient = new ShareClientBuilder() - .connectionString(connectionString).shareName("myshare") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring - return shareAsyncClient; - } - /** * Generates a code sample for using {@link ShareClient#create()} */ public void createShare() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.create - Response response = shareClient.create(); - System.out.println("Complete creating the shares with status code: " + response.statusCode()); + ShareInfo response = shareClient.create(); + System.out.println("Complete creating the shares with status code: " + response); // END: com.azure.storage.file.shareClient.create } /** - * Generates a code sample for using {@link ShareAsyncClient#create} - */ - public void createShareAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.create - shareAsyncClient.create().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.shareAsyncClient.create - } - - /** - * Generates a code sample for using {@link ShareClient#create(Map, Integer)} with Metadata. + * Generates a code sample for using {@link ShareClient#create()}. */ public void createShareMaxOverloadMetadata() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.create#map-integer.metadata - Response response = shareClient.create(Collections.singletonMap("share", "metadata"), null); - System.out.println("Complete creating the shares with status code: " + response.statusCode()); + ShareInfo response = shareClient.create(); + System.out.println("Complete creating the shares."); // END: com.azure.storage.file.shareClient.create#map-integer.metadata } /** - * Generates a code sample for using {@link ShareAsyncClient#create(Map, Integer)} with Metadata. + * Generates a code sample for using {@link ShareClient#createWithResponse(Map, Integer, Context)} with Quota. */ - public void createShareAsyncMaxOverloadMetadata() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.create#map-integer.metadata - shareAsyncClient.create(Collections.singletonMap("share", "metadata"), null).subscribe( - response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.shareAsyncClient.create#map-integer.metadata - } - - /** - * Generates a code sample for using {@link ShareClient#create(Map, Integer)} with Quota. - */ - public void createShareMaxOverloadQuota() { + public void createWithResponse() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.create#map-integer.quota - Response response = shareClient.create(null, 10); + // BEGIN: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.quota + Response response = shareClient.createWithResponse(null, 10, new Context(key1, value1)); System.out.println("Complete creating the shares with status code: " + response.statusCode()); - // END: com.azure.storage.file.shareClient.create#map-integer.quota + // END: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.quota } /** - * Generates a code sample for using {@link ShareAsyncClient#create(Map, Integer)} with Quota. + * Generates a code sample for using {@link ShareClient#createWithResponse(Map, Integer, Context)} with Metadata. */ - public void createShareAsyncMaxOverloadQuota() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.create#map-integer.quota - shareAsyncClient.create(null, 10).subscribe( - response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.shareAsyncClient.create#map-integer.quota + public void createWithResponseMetadata() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.metadata + Response response = shareClient.createWithResponse(Collections.singletonMap("share", "metadata"), null, + new Context(key1, value1)); + System.out.println("Complete creating the shares with status code: " + response.statusCode()); + // END: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.metadata } /** @@ -221,23 +145,23 @@ public void createShareAsyncMaxOverloadQuota() { public void createDirectory() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.createDirectory#string - Response response = shareClient.createDirectory("mydirectory"); - System.out.println("Complete creating the directory with status code: " + response.statusCode()); + DirectoryClient response = shareClient.createDirectory("mydirectory"); + System.out.println("Complete creating the directory."); // END: com.azure.storage.file.shareClient.createDirectory#string } /** - * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String)} + * Generates a code sample for using {@link ShareClient#createDirectoryWithResponse(String, FileSmbProperties, String, Map, Context)} */ - public void createDirectoryAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string - shareAsyncClient.createDirectory("mydirectory").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.shareAsyncClient.createDirectory#string + public void createDirectoryWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.createDirectoryWithResponse#string-filesmbproperties-string-map-context + FileSmbProperties smbProperties = new FileSmbProperties(); + String filePermission = "filePermission"; + Response response = shareClient.createDirectoryWithResponse("documents", smbProperties, + filePermission, Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); + System.out.printf("Creating the directory completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.createDirectoryWithResponse#string-filesmbproperties-string-map-context } /** @@ -246,177 +170,101 @@ public void createDirectoryAsync() { public void createFile() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.createFile#string-long - Response response = shareClient.createFile("myfile", 1024); - System.out.println("Complete creating the file with status code: " + response.statusCode()); + FileClient response = shareClient.createFile("myfile", 1024); + System.out.println("Complete creating the file with snapshot Id:" + response.getShareSnapshotId()); // END: com.azure.storage.file.shareClient.createFile#string-long } /** - * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} - */ - public void createFileAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long - shareAsyncClient.createFile("myfile", 1024).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.shareAsyncClient.createFile#string-long - } - - /** - * Generates a code sample for using {@link ShareClient#createSnapshot()()} + * Generates a code sample for using {@link ShareClient#createSnapshot()} */ public void createSnapshot() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.createSnapshot - Response response = shareClient.createSnapshot(); - System.out.println("Complete creating the share snpashot with snapshot id: " + response.value().snapshot()); + ShareSnapshotInfo response = shareClient.createSnapshot(); + System.out.println("Complete creating the share snpashot with snapshot id: " + response.snapshot()); // END: com.azure.storage.file.shareClient.createSnapshot } /** - * Generates a code sample for using {@link ShareAsyncClient#createSnapshot()} - */ - public void createSnapshotAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot - shareAsyncClient.createSnapshot().subscribe( - response -> System.out.println("Successfully creating the share snapshot with snapshot id: " - + response.value().snapshot()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the share snapshot.") - ); - // END: com.azure.storage.file.shareAsyncClient.createSnapshot - } - - /** - * Generates a code sample for using {@link ShareClient#createSnapshot(Map)} + * Generates a code sample for using {@link ShareClient#createSnapshotWithResponse(Map, Context)} */ public void createSnapshotWithMetadata() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createSnapshot#map + // BEGIN: com.azure.storage.file.shareClient.createSnapshotWithResponse#map-Context Response response = - shareClient.createSnapshot(Collections.singletonMap("snpashot", "metadata")); + shareClient.createSnapshotWithResponse(Collections.singletonMap("snpashot", "metadata"), new Context(key1, value1)); System.out.println("Complete creating the share snpashot with snapshot id: " + response.value().snapshot()); - // END: com.azure.storage.file.shareClient.createSnapshot#map + // END: com.azure.storage.file.shareClient.createSnapshotWithResponse#map-Context } /** - * Generates a code sample for using {@link ShareAsyncClient#createSnapshot(Map)} + * Generates a code sample for using {@link ShareClient#createFileWithResponse(String, long, FileHTTPHeaders, FileSmbProperties, String, Map, Context)} */ - public void createSnapshotAsyncWithMetadata() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot#map - shareAsyncClient.createSnapshot(Collections.singletonMap("snapshot", "metadata")).subscribe( - response -> System.out.println("Successfully creating the share snapshot with snapshot id: " - + response.value().snapshot()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the share snapshot.") - ); - // END: com.azure.storage.file.shareAsyncClient.createSnapshot#map - } - - /** - * Generates a code sample for using {@link ShareClient#createDirectory(String, Map)} - */ - public void createDirectoryMaxOverload() { - ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createDirectory#string-map - Response response = shareClient.createDirectory("documents", - Collections.singletonMap("directory", "metadata")); - System.out.printf("Creating the directory completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.createDirectory#string-map - } - - /** - * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String, Map)} - */ - public void createDirectoryAsyncMaxOverload() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string-map - shareAsyncClient.createDirectory("documents", Collections.singletonMap("directory", "metadata")) - .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.shareAsyncClient.createDirectory#string-map - } - - /** - * Generates a code sample for using {@link ShareClient#createFile(String, long, FileHTTPHeaders, Map)} - */ - public void createFileMaxOverload() { + public void createFileWithResponse() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createFile#string-long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = shareClient.createFile("myfile", 1024, httpHeaders, - Collections.singletonMap("directory", "metadata")); + // BEGIN: com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map-context + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("text/html") + .fileContentEncoding("gzip") + .fileContentLanguage("en") + .fileCacheControl("no-transform") + .fileContentDisposition("attachment"); + FileSmbProperties smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.READ_ONLY)) + .fileCreationTime(OffsetDateTime.now()) + .fileLastWriteTime(OffsetDateTime.now()) + .filePermissionKey("filePermissionKey"); + String filePermission = "filePermission"; + // NOTE: filePermission and filePermissionKey should never be both set + Response response = shareClient.createFileWithResponse("myfile", 1024, httpHeaders, smbProperties, + filePermission, Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); System.out.printf("Creating the file completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.createFile#string-long-filehttpheaders-map - } - - /** - * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long, FileHTTPHeaders, Map)} - */ - public void createFileAsyncMaxOverload() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - shareAsyncClient.createFile("myfile", 1024, httpHeaders, - Collections.singletonMap("directory", "metadata")) - .subscribe(response -> System.out.printf("Creating the file completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map + // END: com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map-context } /** - * Generates a code sample for using {@link ShareClient#deleteDirectory(String)()} + * Generates a code sample for using {@link ShareClient#deleteDirectory(String)} */ public void deleteDirectory() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.deleteDirectory#string - VoidResponse response = shareClient.deleteDirectory("mydirectory"); - System.out.println("Complete deleting the directory with status code: " + response.statusCode()); + shareClient.deleteDirectory("mydirectory"); + System.out.println("Completed deleting the directory."); // END: com.azure.storage.file.shareClient.deleteDirectory#string } /** - * Generates a code sample for using {@link ShareAsyncClient#deleteDirectory(String)()} + * Generates a code sample for using {@link ShareClient#deleteDirectoryWithResponse(String, Context)} */ - public void deleteDirectoryAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.deleteDirectory#string - shareAsyncClient.deleteDirectory("mydirectory").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the directory.") - ); - // END: com.azure.storage.file.shareAsyncClient.deleteDirectory#string + public void deleteDirectoryWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-Context + VoidResponse response = shareClient.deleteDirectoryWithResponse("mydirectory", new Context(key1, value1)); + System.out.println("Complete deleting the directory with status code: " + response.statusCode()); + // END: com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-Context } /** - * Generates a code sample for using {@link ShareClient#deleteFile(String)()} + * Generates a code sample for using {@link ShareClient#deleteFile(String)} */ public void deleteFile() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.deleteFile#string - VoidResponse response = shareClient.deleteFile("myfile"); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); + shareClient.deleteFile("myfile"); + System.out.println("Complete deleting the file."); // END: com.azure.storage.file.shareClient.deleteFile#string } /** - * Generates a code sample for using {@link ShareAsyncClient#deleteFile(String)()} + * Generates a code sample for using {@link ShareClient#deleteFileWithResponse(String, Context)} */ - public void deleteFileAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.deleteFile#string - shareAsyncClient.deleteFile("myfile").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the file.") - ); - // END: com.azure.storage.file.shareAsyncClient.deleteFile#string + public void deleteFileWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.deleteFileWithResponse#string-Context + VoidResponse response = shareClient.deleteFileWithResponse("myfile", new Context(key1, value1)); + System.out.println("Complete deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.shareClient.deleteFileWithResponse#string-Context } /** @@ -425,25 +273,20 @@ public void deleteFileAsync() { public void deleteShare() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.delete - VoidResponse response = shareClient.delete(); - System.out.println("Complete deleting the share with status code: " + response.statusCode()); + shareClient.delete(); + System.out.println("Completed deleting the share."); // END: com.azure.storage.file.shareClient.delete } - /** - * Generates a code sample for using {@link ShareAsyncClient#delete} + * Generates a code sample for using {@link ShareClient#delete} */ - public void deleteShareAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.delete - shareAsyncClient.delete().subscribe( - response -> System.out.println("Deleting the shareAsyncClient completed with status code: " - + response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the share.") - ); - // END: com.azure.storage.file.shareAsyncClient.delete + public void deleteShareWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.deleteWithResponse#Context + VoidResponse response = shareClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Complete deleting the share with status code: " + response.statusCode()); + // END: com.azure.storage.file.shareClient.deleteWithResponse#Context } /** @@ -452,24 +295,20 @@ public void deleteShareAsync() { public void getProperties() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.getProperties - ShareProperties properties = shareClient.getProperties().value(); + ShareProperties properties = shareClient.getProperties(); System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); // END: com.azure.storage.file.shareClient.getProperties } - /** - * Generates a code sample for using {@link ShareAsyncClient#getProperties()} + * Generates a code sample for using {@link ShareClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.getProperties - shareAsyncClient.getProperties() - .subscribe(response -> { - ShareProperties properties = response.value(); - System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); - }); - // END: com.azure.storage.file.shareAsyncClient.getProperties + public void getPropertiesWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.getPropertiesWithResponse#Context + ShareProperties properties = shareClient.getPropertiesWithResponse(new Context(key1, value1)).value(); + System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); + // END: com.azure.storage.file.shareClient.getPropertiesWithResponse#Context } /** @@ -477,24 +316,20 @@ public void getPropertiesAsync() { */ public void setQuota() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.setQuota - Response response = shareClient.setQuota(1024); - System.out.printf("Setting the share quota completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.setQuota + // BEGIN: com.azure.storage.file.ShareClient.setQuota#int + System.out.println("Setting the share quota completed." + shareClient.setQuota(1024)); + // END: com.azure.storage.file.ShareClient.setQuota#int } - /** - * Generates a code sample for using {@link ShareAsyncClient#setQuota(int)} + * Generates a code sample for using {@link ShareClient#setQuotaWithResponse(int, Context)} */ - public void setQuotaAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.setQuota - shareAsyncClient.setQuota(1024) - .subscribe(response -> - System.out.printf("Setting the share quota completed with status code %d", response.statusCode()) - ); - // END: com.azure.storage.file.shareAsyncClient.setQuota + public void setQuotaWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.setQuotaWithResponse#int-Context + Response response = shareClient.setQuotaWithResponse(1024, new Context(key1, value1)); + System.out.printf("Setting the share quota completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.setQuotaWithResponse#int-Context } /** @@ -503,50 +338,37 @@ public void setQuotaAsync() { public void setMetadata() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.setMetadata#map - Response response = shareClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")); - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()); + shareClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")); + System.out.println("Setting the share metadata."); // END: com.azure.storage.file.shareClient.setMetadata#map } - /** - * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} + * Generates a code sample for using {@link ShareClient#setMetadataWithResponse(Map, Context)} */ - public void setMetadataAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadata#map - shareAsyncClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")) - .subscribe(response -> - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()) - ); - // END: com.azure.storage.file.shareAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.setMetadataWithResponse#map-Context + Response response = shareClient.setMetadataWithResponse( + Collections.singletonMap("share", "updatedMetadata"), + new Context(key1, value1)); + System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.setMetadataWithResponse#map-Context } + /** * Generates a code sample for using {@link ShareClient#setMetadata(Map)} to clear the metadata. */ public void clearMetadata() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.clearMetadata#map - Response response = shareClient.setMetadata(null); - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()); + shareClient.setMetadata(null); + System.out.println("Clear metadata completed."); // END: com.azure.storage.file.shareClient.clearMetadata#map } - /** - * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} to clear the metadata. - */ - public void clearMetadataAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.clearMetadata#map - shareAsyncClient.setMetadata(null) - .subscribe(response -> - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()) - ); - // END: com.azure.storage.file.shareAsyncClient.clearMetadata#map - } - /** * Generates a code sample for using {@link ShareClient#getAccessPolicy()} */ @@ -559,74 +381,106 @@ public void getAccessPolicy() { // END: com.azure.storage.file.shareClient.getAccessPolicy } - /** - * Generates a code sample for using {@link ShareAsyncClient#getAccessPolicy()} - */ - public void getAccessPolicyAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.getAccessPolicy - shareAsyncClient.getAccessPolicy() - .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.id(), - result.accessPolicy().permission()) - ); - // END: com.azure.storage.file.shareAsyncClient.getAccessPolicy - } - /** * Generates a code sample for using {@link ShareClient#setAccessPolicy(List)} */ public void setAccessPolicy() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.setAccessPolicy + // BEGIN: com.azure.storage.file.ShareClient.setAccessPolicy#List 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); - Response response = shareClient.setAccessPolicy(Collections.singletonList(permission)); - System.out.printf("Setting access policies completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.setAccessPolicy + shareClient.setAccessPolicy(Collections.singletonList(permission)); + System.out.println("Setting access policies completed."); + // END: com.azure.storage.file.ShareClient.setAccessPolicy#List } /** - * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicy(List)} + * Generates a code sample for using {@link ShareClient#setAccessPolicyWithResponse(List, Context)} */ - public void setAccessPolicyAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.setAccessPolicy + public void setAccessPolicyWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.setAccessPolicyWithResponse#List-Context 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); - shareAsyncClient.setAccessPolicy(Collections.singletonList(permission)) - .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.shareAsyncClient.setAccessPolicy + + Response response = shareClient.setAccessPolicyWithResponse(Collections.singletonList(permission), + new Context(key1, value1)); + System.out.printf("Setting access policies completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.setAccessPolicyWithResponse#List-Context } + /** * Generates a code sample for using {@link ShareClient#getStatistics()} */ public void getStatistics() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.getStatistics - Response response = shareClient.getStatistics(); - System.out.printf("The share is using %d GB", response.value().getShareUsageInGB()); + ShareStatistics response = shareClient.getStatistics(); + System.out.printf("The share is using %d GB", response.getShareUsageInGB()); // END: com.azure.storage.file.shareClient.getStatistics } /** - * Generates a code sample for using {@link ShareAsyncClient#getStatistics()} + * Generates a code sample for using {@link ShareClient#getStatisticsWithResponse(Context)} */ - public void getStatisticsAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.getStatistics - shareAsyncClient.getStatistics() - .subscribe(response -> System.out.printf("The share is using %d GB", - response.value().getShareUsageInGB())); - // END: com.azure.storage.file.shareAsyncClient.getStatistics + public void getStatisticsWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.getStatisticsWithResponse#Context + Response response = shareClient.getStatisticsWithResponse(new Context(key1, value1)); + System.out.printf("The share is using %d GB", response.value().getShareUsageInGB()); + // END: com.azure.storage.file.shareClient.getStatisticsWithResponse#Context + } + + /** + * Generates a code sample for using {@link ShareClient#createPermission(String)} + */ + public void createPermissionAsync() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.createPermission#string + String response = shareClient.createPermission("filePermission"); + System.out.printf("The file permission key is %s", response); + // END: com.azure.storage.file.shareClient.createPermission#string + } + + /** + * Generates a code sample for using {@link ShareClient#createPermissionWithResponse(String, Context)} + */ + public void createPermissionWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.createPermissionWithResponse#string-context + Response response = shareClient.createPermissionWithResponse("filePermission", Context.NONE); + System.out.printf("The file permission key is %s", response.value()); + // END: com.azure.storage.file.shareClient.createPermissionWithResponse#string-context + } + + /** + * Generates a code sample for using {@link ShareClient#getPermission(String)} + */ + public void getPermission() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.getPermission#string + String response = shareClient.getPermission("filePermissionKey"); + System.out.printf("The file permission is %s", response); + // END: com.azure.storage.file.shareClient.getPermission#string + } + + /** + * Generates a code sample for using {@link ShareClient#getPermissionWithResponse(String, Context)} + */ + public void getPermissionWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.getPermissionWithResponse#string-context + Response response = shareClient.getPermissionWithResponse("filePermissionKey", Context.NONE); + System.out.printf("The file permission is %s", response.value()); + // END: com.azure.storage.file.shareClient.getPermissionWithResponse#string-context } /** @@ -640,22 +494,39 @@ public void getSnapshotId() { .shareName("myshare") .snapshot(currentTime.toString()) .buildClient(); - shareClient.getSnapshotId(); + + System.out.printf("Snapshot ID: %s%n", shareClient.getSnapshotId()); // END: com.azure.storage.file.shareClient.getSnapshotId } /** - * Generates a code sample for using {@link ShareAsyncClient#getSnapshotId()} + * Generates a code sample for using {@link ShareClient#generateSAS(String, ShareSASPermission, OffsetDateTime, + * OffsetDateTime, String, SASProtocol, IPRange, String, String, String, String, String)} */ - public void getSnapshotIdAsync() { - // BEGIN: com.azure.storage.file.shareAsyncClient.getSnapshotId - OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - ShareAsyncClient shareAysncClient = new ShareClientBuilder().endpoint("https://${accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) - .shareName("myshare") - .snapshot(currentTime.toString()) - .buildAsyncClient(); - shareAysncClient.getSnapshotId(); - // END: com.azure.storage.file.shareAsyncClient.getSnapshotId + public void generateSAS() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareClient.generateSAS#String-ShareSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + String identifier = "identifier"; + ShareSASPermission permissions = new ShareSASPermission() + .read(true) + .create(true) + .delete(true) + .write(true) + .list(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String cacheControl = "cache"; + String contentDisposition = "disposition"; + String contentEncoding = "encoding"; + String contentLanguage = "language"; + String contentType = "type"; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + String sas = shareClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, + ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + // END: com.azure.storage.file.ShareClient.generateSAS#String-ShareSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java index 9fb593d14dd6..cbe1ba72778e 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java @@ -2,10 +2,9 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.StorageErrorException; +import com.azure.storage.file.models.StorageException; import java.util.UUID; @@ -33,22 +32,22 @@ public static void main(String[] args) { // Create first snapshot on share. String shareSnapshot1 = null; try { - shareSnapshot1 = shareClient.createSnapshot().value().snapshot(); - } catch (StorageErrorException e) { + shareSnapshot1 = shareClient.createSnapshot().snapshot(); + } catch (StorageException e) { System.out.println("Failed to create snapshot on share. Reasons: " + e.getMessage()); } // Create a share using the share client try { shareClient.create(); - } catch (StorageErrorException e) { - System.out.printf("Failed to create the share %s with share client. Reasons: %s\n", shareName, e.getMessage()); + } catch (StorageException e) { + System.out.printf("Failed to create the share %s with share client. Reasons: %s%n", shareName, e.getMessage()); } // Create 3 directories using share client for (int i = 0; i < 3; i++) { try { shareClient.createDirectory(generateRandomName()); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create directory using the share client. Reasons: " + e.getMessage()); } } @@ -56,50 +55,53 @@ public static void main(String[] args) { // Create another snapshot on share. String shareSnapshot2 = null; try { - shareSnapshot2 = shareClient.createSnapshot().value().snapshot(); - } catch (StorageErrorException e) { + shareSnapshot2 = shareClient.createSnapshot().snapshot(); + } catch (StorageException e) { System.out.println("Failed to create snapshot on share. Reasons: " + e.getMessage()); } // Create another directory after having the snapshot try { shareClient.createDirectory(generateRandomName()); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create directory using the share client. Reasons: " + e.getMessage()); } // Get the properties of the share with first snapshot. - ShareClient shareClientWithSnapshot1 = null; + ShareClient shareClientWithSnapshot1 = new ShareClientBuilder() + .endpoint(ENDPOINT) + .shareName(shareName) + .snapshot(shareSnapshot1) + .buildClient(); + try { - shareClientWithSnapshot1 = new ShareClientBuilder().endpoint(ENDPOINT) - .shareName(shareName).snapshot(shareSnapshot1).buildClient(); - Response shareProperties1 = shareClientWithSnapshot1.getProperties(); - System.out.println("This is the first snapshot eTag: " + shareProperties1.value().etag()); - } catch (StorageErrorException e) { + ShareProperties shareProperties1 = shareClientWithSnapshot1.getProperties(); + System.out.println("This is the first snapshot eTag: " + shareProperties1.etag()); + } catch (StorageException e) { System.out.println("Failed to get properties for the first share snapshot. Reasons: " + e.getMessage()); } // Get the properties of the share with second snapshot. - ShareClient shareClientWithSnapshot2 = null; + ShareClient shareClientWithSnapshot2 = new ShareClientBuilder() + .endpoint(ENDPOINT) + .shareName(shareName) + .snapshot(shareSnapshot2) + .buildClient(); + try { - shareClientWithSnapshot2 = new ShareClientBuilder().endpoint(ENDPOINT) - .shareName(shareName).snapshot(shareSnapshot2).buildClient(); - Response shareProperties2 = shareClientWithSnapshot2.getProperties(); - System.out.println("This is the second snapshot eTag: " + shareProperties2.value().etag()); - } catch (StorageErrorException e) { + ShareProperties shareProperties2 = shareClientWithSnapshot2.getProperties(); + System.out.println("This is the second snapshot eTag: " + shareProperties2.etag()); + } catch (StorageException e) { System.out.println("Failed to get properties for the second share snapshot. Reasons: " + e.getMessage()); } // Get the root directory and list all directories. try { - shareClient.getRootDirectoryClient().listFilesAndDirectories().forEach( - fileRef -> { - System.out.printf("Is the resource a file or directory?"); - } - ); - } catch (StorageErrorException e) { + shareClient.getRootDirectoryClient().listFilesAndDirectories().forEach(resource -> + System.out.printf("Name: %s, Directory? %b%n", resource.name(), resource.isDirectory())); + } catch (StorageException e) { System.out.println("Failed to delete the share. Reasons: " + e.getMessage()); } @@ -107,49 +109,49 @@ public static void main(String[] args) { try { FileClient fileClient = shareClient.getFileClient("myFile"); fileClient.create(1024); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create a file under the share. Reasons: " + e.getMessage()); } // Create a file with size of 1024 bytes under the share using createFile API. try { shareClient.createFile(generateRandomName(), 1024); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to create file using the share client. Reasons: " + e.getMessage()); } // Delete the file "myFile" using shareClient. try { shareClient.deleteFile("myFile"); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the file named myFile. Reasons: " + e.getMessage()); } // Delete the share snapshot 1 try { shareClientWithSnapshot1.delete(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the share snapshot 1. Reasons: " + e.getMessage()); } // Check the delete share snapshot properties. try { shareClientWithSnapshot1.getProperties(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("This is expected. The snapshot has been delete. Reasons: " + e.getMessage()); } // Check the one not deleted. try { shareClientWithSnapshot2.getProperties(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to get the properties of share snapshot 2. Reasons: " + e.getMessage()); } // Delete the share. try { shareClient.delete(); - } catch (StorageErrorException e) { + } catch (StorageException e) { System.out.println("Failed to delete the share. Reasons: " + e.getMessage()); } diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java deleted file mode 100644 index 3e84a1bb90cf..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.implementation.http.UrlBuilder; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileProperty; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.HandleItem; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.setupClient; - -public class DirectoryAsyncClientTests extends DirectoryClientTestBase { - private final ClientLogger directoryAsyncLogger = new ClientLogger(DirectoryAsyncClientTests.class); - private static ShareClient shareClient; - private static String shareName = "dirsharename"; - private DirectoryAsyncClient client; - - @Override - public void beforeTest() { - beforeDirectoryTest(); - if (interceptorManager.isPlaybackMode()) { - client = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, directoryAsyncLogger); - } else { - client = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, directoryAsyncLogger); - } - } - - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void urlFromDirClient() { - if (interceptorManager.isPlaybackMode()) { - azureStorageFileEndpoint = "https://teststorage.file.core.windows.net/"; - } - UrlBuilder urlBuilder = UrlBuilder.parse(azureStorageFileEndpoint); - String endpointURL = new UrlBuilder().scheme(urlBuilder.scheme()).host(urlBuilder.host()).toString(); - Assert.assertTrue(endpointURL.equals(client.getDirectoryUrl().toString())); - } - - @Override - public void createMinFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createTwiceFromDirClient() { - client.create().block(); - StepVerifier.create(client.create()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createWithMetadataFromDirClient() { - StepVerifier.create(client.create(basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void getFileClientFromDirClient() { - FileAsyncClient fileClient = client.getFileClient(testResourceNamer.randomName("getFileAsync", 16)); - Assert.assertNotNull(fileClient); - } - - @Override - public void getSubDirectoryClient() { - Assert.assertNotNull(client.getSubDirectoryClient("getSubdirectoryASync")); - } - - @Override - public void deleteFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteNotExistFromDirClient() { - StepVerifier.create(client.delete()) - .verifyErrorSatisfies(exception -> FileTestHelpers.assertExceptionErrorMessage(exception, "ResourceNotFound")); - - } - - @Override - public void getPropertiesFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.getProperties()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void clearMetadataFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.setMetadata(null)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setMetadataFromDirClient() { - client.create().block(); - StepVerifier.create(client.setMetadata(basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setMetadataInvalidKeyFromDirClient() { - client.create().block(); - StepVerifier.create(client.setMetadata(invalidMetadata)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void listFilesAndDirectoriesFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - List fileRefs = new ArrayList<>(); - int repeatTimes = 3; - // generate some subdirectories - String fileNameSameLayer = testResourceNamer.randomName("sameLayer", 16); - String fileNameNextLayer = testResourceNamer.randomName("nextLayer", 16); - - for (int i = 0; i < repeatTimes; i++) { - String directoryName = dirName + i; - DirectoryAsyncClient subDirectoryClient = client.getSubDirectoryClient(directoryName); - StepVerifier.create(subDirectoryClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - fileRefs.add(new FileRef(directoryName, true, null)); - - fileNameSameLayer = fileNameSameLayer + i; - fileNameNextLayer = fileNameNextLayer + i; - - StepVerifier.create(client.createFile(fileNameSameLayer, 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - fileRefs.add(new FileRef(fileNameSameLayer, false, new FileProperty().contentLength(1024))); - StepVerifier.create(subDirectoryClient.createFile(fileNameNextLayer, 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - } - - Collections.sort(fileRefs, new LexicographicComparator()); - StepVerifier.create(client.listFilesAndDirectories(null, null)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(0), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(1), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(2), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(3), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(4), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(5), fileRef)) - .verifyComplete(); - } - - class LexicographicComparator implements Comparator { - @Override - public int compare(FileRef a, FileRef b) { - return a.name().compareToIgnoreCase(b.name()); - } - } - - @Override - public void getHandlesFromDirClient() { - // TODO: Need to figure out way of creating handlers first. - -// StepVerifier.create(client.create()) -// .assertNext(response -> StorageTestBase.assertResponseStatusCode(response, 201)) -// .verifyComplete(); -// StepVerifier.create(client.getHandles(null, true)) -// .assertNext(response -> Assert.assertNotNull(response)) -// .verifyComplete(); - } - - @Override - public void forceCloseHandlesFromDirClient() { - client.create().block(); - client.createFile("test", 1024); - Iterable handleItems = client.getHandles(null, true).toIterable(); - handleItems.forEach(handleItem -> { - StepVerifier.create(client.forceCloseHandles(handleItem.handleId(), true)) - .assertNext(numOfClosedHandles -> Assert.assertTrue(numOfClosedHandles.longValue() > 0)) - .verifyComplete(); - }); - } - - @Override - public void createSubDirectory() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.createSubDirectory(testResourceNamer.randomName("dir", 16))) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createSubDirectoryWithMetadata() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.createSubDirectory(testResourceNamer.randomName("dir", 16), basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createSubDirectoryTwiceSameMetadata() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - String dirName = testResourceNamer.randomName("dir", 16); - StepVerifier.create(client.createSubDirectory(dirName, basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.createSubDirectory(dirName, basicMetadata)) - .verifyErrorSatisfies(exception -> FileTestHelpers.assertExceptionErrorMessage(exception, "ResourceAlreadyExists")); - } - - @Override - public void deleteSubDirectory() { - client.create().block(); - String dirName = testResourceNamer.randomName("dir", 16); - StepVerifier.create(client.createSubDirectory(dirName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.deleteSubDirectory(dirName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void createFileFromDirClient() { - client.create().block(); - StepVerifier.create(client.createFile("testfile", 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createFileWithoutCreateDirFromDirClient() { - StepVerifier.create(client.createFile("testfile", 1024)) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void deleteFileFromDirClient() { - client.create().block(); - client.createFile("testfile", 1024).block(); - StepVerifier.create(client.deleteFile("testfile")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteFileWithoutCreateFileFromDirClient() { - client.create().block(); - StepVerifier.create(client.deleteFile("testfile")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java deleted file mode 100644 index f86f1c2ec14a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import com.azure.core.util.configuration.ConfigurationManager; -import java.util.Collections; -import java.util.Map; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TestName; - -public abstract class DirectoryClientTestBase extends TestBase { - protected String dirName; - protected String shareName; - - String azureStorageFileEndpoint = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_ENDPOINT"); - final Map basicMetadata = Collections.singletonMap("test", "metadata"); - final Map invalidMetadata = Collections.singletonMap("1", "metadata"); - - @Rule - public TestName testName = new TestName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - void beforeDirectoryTest() { - dirName = testResourceNamer.randomName("directory", 16); - } - - /** - * 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. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } - - @Test - public abstract void urlFromDirClient(); - - @Test - public abstract void getFileClientFromDirClient(); - - @Test - public abstract void getSubDirectoryClient(); - - @Test - public abstract void createMinFromDirClient(); - - @Test - public abstract void createTwiceFromDirClient(); - - @Test - public abstract void createWithMetadataFromDirClient(); - - @Test - public abstract void deleteFromDirClient(); - - @Test - public abstract void deleteNotExistFromDirClient(); - - @Test - public abstract void getPropertiesFromDirClient(); - - @Test - public abstract void clearMetadataFromDirClient(); - - @Test - public abstract void setMetadataFromDirClient(); - - @Test - public abstract void setMetadataInvalidKeyFromDirClient(); - - @Test - public abstract void listFilesAndDirectoriesFromDirClient(); - - @Test - public abstract void getHandlesFromDirClient(); - - @Test - public abstract void forceCloseHandlesFromDirClient(); - - @Test - public abstract void createSubDirectory(); - - @Test - public abstract void createSubDirectoryWithMetadata(); - - @Test - public abstract void createSubDirectoryTwiceSameMetadata(); - - @Test - public abstract void deleteSubDirectory(); - - @Test - public abstract void createFileFromDirClient(); - - @Test - public abstract void createFileWithoutCreateDirFromDirClient(); - - @Test - public abstract void deleteFileFromDirClient(); - - @Test - public abstract void deleteFileWithoutCreateFileFromDirClient(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTests.java deleted file mode 100644 index ce73781ae3a5..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTests.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.implementation.http.UrlBuilder; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.util.Iterator; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertTrue; - -public class DirectoryClientTests extends DirectoryClientTestBase { - private final ClientLogger directoryLogger = new ClientLogger(DirectoryClientTests.class); - private static String shareName = "dirsharename"; - private static ShareClient shareClient; - private DirectoryClient directoryClient; - - @Override - public void beforeTest() { - beforeDirectoryTest(); - if (interceptorManager.isPlaybackMode()) { - directoryClient = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, directoryLogger); - } else { - directoryClient = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, directoryLogger); - } - } - - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void urlFromDirClient() { - if (interceptorManager.isPlaybackMode()) { - azureStorageFileEndpoint = "https://teststorage.file.core.windows.net/"; - } - UrlBuilder urlBuilder = UrlBuilder.parse(azureStorageFileEndpoint); - String endpointURL = new UrlBuilder().scheme(urlBuilder.scheme()).host(urlBuilder.host()).toString(); - Assert.assertEquals(endpointURL, directoryClient.getDirectoryUrl().toString()); - } - - @Override - public void createMinFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - } - - @Override - public void createTwiceFromDirClient() { - directoryClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceAlreadyExists"); - directoryClient.create(); - } - - @Override - public void createWithMetadataFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(basicMetadata), 201); - } - - @Override - public void getFileClientFromDirClient() { - Assert.assertNotNull(directoryClient.getFileClient(testResourceNamer.randomName("getFileSync", 16))); - } - - @Override - public void getSubDirectoryClient() { - Assert.assertNotNull(directoryClient.getSubDirectoryClient("getSubdirectorySync")); - } - - @Override - public void deleteFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.delete(), 202); - } - - @Override - public void deleteNotExistFromDirClient() { - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - directoryClient.delete(); - } - - @Override - public void getPropertiesFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.getProperties(), 200); - } - - @Override - public void clearMetadataFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.setMetadata(null), 200); - } - - @Override - public void setMetadataFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.setMetadata(basicMetadata), 200); - } - - @Override - public void setMetadataInvalidKeyFromDirClient() { - directoryClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("InvalidMetadata"); - directoryClient.setMetadata(invalidMetadata); - } - - @Override - public void listFilesAndDirectoriesFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - int repeatTimes = 3; - String fileNameSameLayer = testResourceNamer.randomName("sameLayer", 16); - String fileNameNextLayer = testResourceNamer.randomName("nextLayer", 16); - for (int i = 0; i < repeatTimes; i++) { - DirectoryClient subDirClient = directoryClient.getSubDirectoryClient(dirName + i); - FileTestHelpers.assertResponseStatusCode(subDirClient.create(), 201); - fileNameSameLayer = fileNameSameLayer + i; - fileNameNextLayer = fileNameNextLayer + i; - FileTestHelpers.assertResponseStatusCode(directoryClient.createFile(fileNameSameLayer, 1024), 201); - FileTestHelpers.assertResponseStatusCode(subDirClient.createFile(fileNameNextLayer, 1024), 201); - } - - Iterable fileRefs = directoryClient.listFilesAndDirectories(); - - int count = 0; - Iterator it = fileRefs.iterator(); - while (it.hasNext()) { - count++; - FileRef ref = it.next(); - Assert.assertNotNull(ref); - if (!ref.isDirectory()) { - assertTrue("It is supposed to list the files in same layer.", ref.name().contains("samelayer")); - } - } - Assert.assertEquals(repeatTimes * 2, count); - } - - @Override - public void getHandlesFromDirClient() { - // TODO: Need to open channel and create handlers first. -// StorageTestBase.assertResponseStatusCode(directoryClient.create(), 201); -// Assert.assertTrue(directoryClient.getHandles(null, true).iterator().hasNext()); - } - - @Override - public void forceCloseHandlesFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - directoryClient.getHandles(null, true).forEach( - handleItem -> { - directoryClient.forceCloseHandles(handleItem.handleId(), true).forEach( - numberOfClosedHandles -> assertTrue(numberOfClosedHandles > 0) - ); - } - ); - } - - @Override - public void createSubDirectory() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(testResourceNamer.randomName("directory", 16)), 201); - } - - @Override - public void createSubDirectoryWithMetadata() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(testResourceNamer.randomName("directory", 16), basicMetadata), 201); - } - - @Override - public void createSubDirectoryTwiceSameMetadata() { - directoryClient.create(); - String dirName = testResourceNamer.randomName("dir", 16); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(dirName, basicMetadata), 201); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceAlreadyExists"); - directoryClient.createSubDirectory(dirName, basicMetadata); - } - - - @Override - public void deleteSubDirectory() { - directoryClient.create(); - String dirName = testResourceNamer.randomName("dir", 16); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(dirName), 201); - FileTestHelpers.assertResponseStatusCode(directoryClient.deleteSubDirectory(dirName), 202); - } - - @Override - public void createFileFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.createFile("testfile", 1024), 201); - } - - @Override - public void createFileWithoutCreateDirFromDirClient() { - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ParentNotFound"); - directoryClient.createFile("testfile", 1024); - } - - @Override - public void deleteFileFromDirClient() { - directoryClient.create(); - directoryClient.createFile("testfile", 1024); - FileTestHelpers.assertResponseStatusCode(directoryClient.deleteFile("testfile"), 202); - } - - @Override - public void deleteFileWithoutCreateFileFromDirClient() { - directoryClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - directoryClient.deleteFile("testfile"); - } - -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java deleted file mode 100644 index 262cc4b0b98d..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.HandleItem; -import java.io.File; -import java.net.URL; -import java.nio.file.Files; -import java.time.Duration; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.assertTwoFilesAreSame; -import static com.azure.storage.file.FileTestHelpers.setupClient; - -public class FileAsyncClientTest extends FileClientTestBase { - private final ClientLogger fileAsyncLogger = new ClientLogger(FileAsyncClientTest.class); - String filePath; - private static String shareName = "filesharename"; - private static String dirName = "testdir/"; - private static ShareClient shareClient; - private FileAsyncClient fileAsyncClient; - - @Override - public void beforeTest() { - filePath = dirName + testResourceNamer.randomName("file", 16); - if (interceptorManager.isPlaybackMode()) { - fileAsyncClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, fileAsyncLogger); - } else { - fileAsyncClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, fileAsyncLogger); - } - } - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - shareClient.createDirectory(dirName); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void createFromFileClient() { - StepVerifier.create(fileAsyncClient.create(1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(fileAsyncClient.getProperties()) - .assertNext(filePropertiesResponse -> Assert.assertTrue(filePropertiesResponse.value().contentLength() == 1024)) - .verifyComplete(); - } - - @Override - public void createExcessMaxSizeFromFileClient() { - StepVerifier.create(fileAsyncClient.create(1024 * 1024 * 1024 * 1024, null, null)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(fileAsyncClient.getProperties()) - .assertNext(filePropertiesResponse -> Assert.assertTrue(filePropertiesResponse.value().contentLength() == 0)) - .verifyComplete(); - } - - @Override - public void startCopy() throws Exception { - fileAsyncClient.create(1024).block(); - String sourceURL = fileAsyncClient.getFileUrl().toString() + "/" + shareName + "/" + filePath; - StepVerifier.create(fileAsyncClient.startCopy(sourceURL, null)) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 202); - Assert.assertTrue(response.value().copyId() != null); - }) - .verifyComplete(); - } - - @Override - public void abortCopy() { - // TODO: need to mock a pending copy process. - } - - @Override - public void downloadWithProperties() { - fileAsyncClient.create(1024, null, null).block(); - StepVerifier.create(fileAsyncClient.downloadWithProperties()) - .assertNext(response -> FileTestHelpers.assertResponseListStatusCode(response, Arrays.asList(200, 206))) - .verifyComplete(); - } - - @Override - public void uploadToStorageAndDownloadToFile() throws Exception { - URL fileFolder = FileClientTestBase.class.getClassLoader().getResource("testfiles"); - File uploadFile = new File(fileFolder.getPath() + "/helloworld"); - File downloadFile = new File(fileFolder.getPath() + "/testDownload"); - - if (!Files.exists(downloadFile.toPath())) { - downloadFile.createNewFile(); - } - fileAsyncClient.create(uploadFile.length()).block(); - StepVerifier.create(fileAsyncClient.uploadFromFile(uploadFile.toString())) - .verifyComplete(); - StepVerifier.create(fileAsyncClient.downloadToFile(downloadFile.toString())) - .verifyComplete(); - - assertTwoFilesAreSame(uploadFile, downloadFile); - } - - @Override - public void deleteFromFileClient() { - fileAsyncClient.create(1024, null, null).block(); - StepVerifier.create(fileAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void getPropertiesFromFileClient() { - fileAsyncClient.create(1024).block(); - StepVerifier.create(fileAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setHttpHeadersFromFileClient() { - fileAsyncClient.create(1024).block(); - FileHTTPHeaders headers = new FileHTTPHeaders(); - headers.fileContentMD5(new byte[0]); - StepVerifier.create(fileAsyncClient.setHttpHeaders(1024, headers)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setMeatadataFromFileClient() { - fileAsyncClient.create(1024).block(); - StepVerifier.create(fileAsyncClient.setMetadata(basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void upload() { - fileAsyncClient.create(1024 * 5, null, null).block(); - StepVerifier.create(fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void listRangesFromFileClient() { - fileAsyncClient.create(512, null, null).block(); - fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes()).block(); - StepVerifier.create(fileAsyncClient.listRanges()) - .assertNext(response -> Assert.assertTrue(response.start() == 0 && response.end() == 511)) - .verifyComplete(); - } - - @Override - public void listHandlesFromFileClient() { - //TODO: need to create a handle first - fileAsyncClient.create(1024).block(); - StepVerifier.create(fileAsyncClient.listHandles()) - .verifyComplete(); - } - - @Override - public void forceCloseHandlesFromFileClient() { - //TODO: need to figureout create a handle first - fileAsyncClient.create(1024).block(); - Iterable handles = fileAsyncClient.listHandles(10).toIterable(); - handles.forEach( - response -> { - StepVerifier.create(fileAsyncClient.forceCloseHandles(response.handleId())) - .assertNext(forceCloseHandles -> Assert.assertTrue(forceCloseHandles > 0)) - .verifyComplete(); - } - ); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTest.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTest.java deleted file mode 100644 index 7a08972b0109..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTest.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileCopyInfo; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileInfo; -import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.FileRange; -import java.io.File; -import java.net.URL; -import java.nio.file.Files; -import java.time.Duration; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import static com.azure.storage.file.FileTestHelpers.assertTwoFilesAreSame; -import static com.azure.storage.file.FileTestHelpers.setupClient; - -public class FileClientTest extends FileClientTestBase { - private final ClientLogger fileLogger = new ClientLogger(FileClientTest.class); - private static String shareName = "filesharename"; - private static String dirName = "testdir/"; - private static ShareClient shareClient; - String filePath; - - private FileClient fileClient; - - @Override - public void beforeTest() { - filePath = dirName + testResourceNamer.randomName("file", 16); - if (interceptorManager.isPlaybackMode()) { - fileClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, fileLogger); - } else { - fileClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, fileLogger); - } - } - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - shareClient.createDirectory(dirName); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void createFromFileClient() { - FileTestHelpers.assertResponseStatusCode(fileClient.create(1024), 201); - Assert.assertTrue(fileClient.getProperties().value().contentLength() == 1024); - } - - @Override - public void createExcessMaxSizeFromFileClient() { - FileTestHelpers.assertResponseStatusCode(fileClient.create(1024 * 1024 * 1024 * 1024, null, null), 201); - Assert.assertTrue(fileClient.getProperties().value().contentLength() == 0); - } - - @Override - public void startCopy() throws Exception { - FileTestHelpers.assertResponseStatusCode(fileClient.create(1024, null, null), 201); - String sourceURL = fileClient.getFileUrl().toString() + "/" + shareName + "/" + filePath; - Response copyInfoResponse = fileClient.startCopy(sourceURL, null); - FileTestHelpers.assertResponseStatusCode(copyInfoResponse, 202); - Assert.assertTrue(copyInfoResponse.value().copyId() != null); - } - - @Override - public void abortCopy() { - // TODO: Need to construct or mock a copy with pending status - } - - @Override - public void downloadWithProperties() { - fileClient.create(1024, null, null); - FileRange range = new FileRange(0, 1024L); - FileTestHelpers.assertResponseListStatusCode(fileClient.downloadWithProperties(range, null), Arrays.asList(200, 206)); - } - - @Override - public void uploadToStorageAndDownloadToFile() throws Exception { - URL fileFolder = FileClientTestBase.class.getClassLoader().getResource("testfiles"); - File uploadFile = new File(fileFolder.getPath() + "/helloworld"); - File downloadFile = new File(fileFolder.getPath() + "/testDownload"); - - if (!Files.exists(downloadFile.toPath())) { - downloadFile.createNewFile(); - } - - fileClient.create(uploadFile.length()); - fileClient.uploadFromFile(uploadFile.toString()); - fileClient.downloadToFile(downloadFile.toString()); - assertTwoFilesAreSame(uploadFile, downloadFile); - } - - @Override - public void deleteFromFileClient() { - fileClient.create(1024, null, null); - FileTestHelpers.assertResponseStatusCode(fileClient.delete(), 202); - } - - @Override - public void getPropertiesFromFileClient() { - fileClient.create(1024, null, null); - Response propertiesResponse = fileClient.getProperties(); - Assert.assertNotNull(propertiesResponse.value()); - Assert.assertNotNull(propertiesResponse.value().contentLength() == 1024); - Assert.assertNotNull(propertiesResponse.value().eTag()); - Assert.assertNotNull(propertiesResponse.value().lastModified()); - } - - @Override - public void setHttpHeadersFromFileClient() { - fileClient.create(1024, null, null); - FileHTTPHeaders headers = new FileHTTPHeaders(); - headers.fileContentMD5(new byte[0]); - Response response = fileClient.setHttpHeaders(1024, headers); - FileTestHelpers.assertResponseStatusCode(response, 200); - Assert.assertNotNull(response.value().eTag()); - } - - @Override - public void setMeatadataFromFileClient() { - fileClient.create(1024, null, null); - FileTestHelpers.assertResponseStatusCode(fileClient.setMetadata(basicMetadata), 200); - } - - @Override - public void upload() { - fileClient.create(1024 * 5, null, null); - FileTestHelpers.assertResponseStatusCode(fileClient.upload(defaultData, defaultData.readableBytes()), 201); - } - - @Override - public void listRangesFromFileClient() { - fileClient.create(1024, null, null); - fileClient.upload(defaultData, defaultData.readableBytes()); - fileClient.listRanges(new FileRange(0, 511L)).forEach( - fileRangeInfo -> { - Assert.assertTrue(fileRangeInfo.start() == 0); - Assert.assertTrue(fileRangeInfo.end() == 511); - } - ); - } - - @Override - public void listHandlesFromFileClient() { - //TODO: need to find a way to create handles. - fileClient.create(1024); - fileClient.listHandles().forEach( - handleItem -> { - Assert.assertNotNull(handleItem.handleId()); - } - ); - } - - @Override - public void forceCloseHandlesFromFileClient() { - fileClient.create(1024, null, null); - fileClient.listHandles(10).forEach( - handleItem -> { - Assert.assertNotNull(fileClient.forceCloseHandles(handleItem.handleId())); - } - ); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTestBase.java deleted file mode 100644 index 9aba9e055bbc..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTestBase.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Map; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TestName; - -public abstract class FileClientTestBase extends TestBase { - final Map basicMetadata = Collections.singletonMap("test", "metadata"); - static final String DEFAULT_TEXT = "default"; - final ByteBuf defaultData = Unpooled.wrappedBuffer(DEFAULT_TEXT.getBytes(StandardCharsets.UTF_8)); - - @Rule - public TestName testName = new TestName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - /** - * 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. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } - - @Test - public abstract void createFromFileClient(); - - @Test - public abstract void createExcessMaxSizeFromFileClient(); - - @Test - public abstract void startCopy() throws Exception; - - @Test - public abstract void abortCopy(); - - @Test - public abstract void downloadWithProperties(); - - @Test - public abstract void uploadToStorageAndDownloadToFile() throws Exception; - - @Test - public abstract void deleteFromFileClient(); - - @Test - public abstract void getPropertiesFromFileClient(); - - @Test - public abstract void setHttpHeadersFromFileClient(); - - @Test - public abstract void setMeatadataFromFileClient(); - - @Test - public abstract void upload(); - - @Test - public abstract void listRangesFromFileClient() throws Exception; - - @Test - public abstract void listHandlesFromFileClient(); - - @Test - public abstract void forceCloseHandlesFromFileClient(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java deleted file mode 100644 index 8f7c96dc579c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java +++ /dev/null @@ -1,470 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.Metrics; -import com.azure.storage.file.models.RetentionPolicy; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.fail; - -public class FileServiceClientAsyncTests extends FileServiceClientTestBase { - private final ClientLogger fileServiceAsyncLogger = new ClientLogger(FileServiceClientAsyncTests.class); - - private FileServiceAsyncClient fileServiceAsyncClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - fileServiceAsyncClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, fileServiceAsyncLogger); - } else { - fileServiceAsyncClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, fileServiceAsyncLogger); - } - } - - @Override - public void afterTest() { - fileServiceAsyncClient.listShares(new ListSharesOptions().prefix(shareName)) - .collectList() - .block() - .forEach(share -> { - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(share.name()); - try { - client.delete().block(); - } catch (StorageErrorException ex) { - // Share already deleted, that's what we wanted anyways. - } - }); - } - - @Override - public void getShareDoesNotCreateAShare() { - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(shareName); - try { - client.getStatistics().block(); - fail("getShareAsyncClient shouldn't create a share in Azure."); - } catch (Exception ex) { - FileTestHelpers.assertExceptionStatusCode(ex, 404); - } - } - - @Override - public void createShare() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createShareTwiceSameMetadata() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createShareTwiceDifferentMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName, metadata, null)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createShareInvalidQuota() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName, null, -1)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName, null, 9999999)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteShare() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteShareDoesNotExist() { - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteThenCreateShareFromFileServiceClient() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteThenCreateShareTooSoonFromFileServiceClient() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void listShares() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions())) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesWithPrefix() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.name(shareName + "prefix" + i); - testShares.add(share); - } else { - share.name(shareName + i); - } - - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().prefix(shareName + "prefix"))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesWithLimit() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().maxResults(2))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesInvalidMaxResults() { - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().maxResults(-1))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().maxResults(0))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void listSharesIncludeMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - testShares.add(share); - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().includeMetadata(true))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesIncludeSnapshots() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(share.name()); - - StepVerifier.create(client.create(null, share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - if (i % 2 == 0) { - StepVerifier.create(client.createSnapshot()) - .assertNext(response -> { - testShares.add(new ShareItem().name(share.name()) - .snapshot(response.value().snapshot()) - .properties(share.properties())); - - FileTestHelpers.assertResponseStatusCode(response, 201); - }) - .verifyComplete(); - } - - testShares.add(share); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().includeSnapshots(true))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesIncludeMetadataAndSnapshots() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(share.name()); - - StepVerifier.create(client.create(share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - if (i % 2 == 0) { - StepVerifier.create(client.createSnapshot()) - .assertNext(response -> { - testShares.add(new ShareItem().name(share.name()) - .snapshot(response.value().snapshot()) - .properties(share.properties())); - - FileTestHelpers.assertResponseStatusCode(response, 201); - }) - .verifyComplete(); - } - - testShares.add(share); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().includeMetadata(true).includeSnapshots(true))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void setFileServiceProperties() { - FileServiceProperties originalProperties = fileServiceAsyncClient.getProperties().block().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties updatedProperties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - StepVerifier.create(fileServiceAsyncClient.setProperties(updatedProperties)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertFileServicePropertiesAreEqual(updatedProperties, response.value())) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.setProperties(originalProperties)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertFileServicePropertiesAreEqual(originalProperties, response.value())) - .verifyComplete(); - } - - @Override - public void setPropertiesTooManyRules() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - List cors = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - cors.add(new CorsRule()); - } - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(cors); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidAllowedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidExposedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidAllowedOrigin() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidAllowedMethod() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD"))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java deleted file mode 100644 index 6a34f910052f..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import com.azure.storage.file.models.ListSharesOptions; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -public abstract class FileServiceClientTestBase extends TestBase { - String shareName; - - String reallyLongString = "thisisareallylongstringthatexceedsthe64characterlimitallowedoncertainproperties"; - - @Rule - public TestName testName = new TestName(); - - /** - * 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. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } - - String getShareName() { - return testResourceNamer.randomName("share", 16).toLowerCase(); - } - - ListSharesOptions defaultOptions() { - return new ListSharesOptions().prefix(shareName); - } - - @Test - public abstract void getShareDoesNotCreateAShare(); - - @Test - public abstract void createShare(); - - @Test - public abstract void createShareTwiceSameMetadata(); - - @Test - public abstract void createShareTwiceDifferentMetadata(); - - @Test - public abstract void createShareInvalidQuota(); - - @Test - public abstract void deleteShare(); - - @Test - public abstract void deleteShareDoesNotExist(); - - @Test - public abstract void deleteThenCreateShareFromFileServiceClient(); - - /** - * Cannot re-create a share within 30 seconds of it being deleted. - */ - @Test - public abstract void deleteThenCreateShareTooSoonFromFileServiceClient(); - - @Test - public abstract void listShares(); - - @Test - public abstract void listSharesWithPrefix(); - - @Test - public abstract void listSharesWithLimit(); - - @Test - public abstract void listSharesInvalidMaxResults(); - - @Test - public abstract void listSharesIncludeMetadata(); - - @Test - public abstract void listSharesIncludeSnapshots(); - - @Test - public abstract void listSharesIncludeMetadataAndSnapshots(); - - @Test - public abstract void setFileServiceProperties(); - - @Test - public abstract void setPropertiesTooManyRules(); - - /** - * A header in AllowedHeaders is not allowed to exceed 256 characters. - */ - @Test - public abstract void setPropertiesInvalidAllowedHeader(); - - /** - * A header in ExposedHeaders is not allowed to exceed 256 characters. - */ - @Test - public abstract void setPropertiesInvalidExposedHeader(); - - /** - * An origin in AllowedOrigins is not allowed to exceed 256 characters. - */ - @Test - public abstract void setPropertiesInvalidAllowedOrigin(); - - /** - * AllowedMethods only supports DELETE, GET, HEAD, MERGE, POST, OPTIONS, and PUT. - */ - @Test - public abstract void setPropertiesInvalidAllowedMethod(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTests.java deleted file mode 100644 index f8795d6048af..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTests.java +++ /dev/null @@ -1,477 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -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.file.models.CorsRule; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.Metrics; -import com.azure.storage.file.models.RetentionPolicy; -import com.azure.storage.file.models.ShareInfo; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.fail; - -public class FileServiceClientTests extends FileServiceClientTestBase { - private final ClientLogger fileServiceLogger = new ClientLogger(FileServiceClientTests.class); - - private FileServiceClient fileServiceClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - fileServiceClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, fileServiceLogger); - } else { - fileServiceClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, fileServiceLogger); - } - } - - @Override - public void afterTest() { - for (ShareItem share : fileServiceClient.listShares(new ListSharesOptions().prefix(shareName))) { - ShareClient client = fileServiceClient.getShareClient(share.name()); - try { - client.delete(); - } catch (StorageErrorException ex) { - // Share already deleted, that's what we wanted anyways. - } - } - } - - @Override - public void getShareDoesNotCreateAShare() { - ShareClient client = fileServiceClient.getShareClient(shareName); - try { - client.getStatistics(); - fail("getShareAsyncClient shouldn't create a share in Azure."); - } catch (Exception ex) { - FileTestHelpers.assertExceptionStatusCode(ex, 404); - } - } - - @Override - public void createShare() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - } - - @Override - public void createShareTwiceSameMetadata() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - - try { - fileServiceClient.createShare(shareName); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void createShareTwiceDifferentMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - - try { - fileServiceClient.createShare(shareName, metadata, null); - fail("Attempting to create the share twice with different metadata should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void createShareInvalidQuota() { - try { - fileServiceClient.createShare(shareName, null, -1); - fail("Attempting to create a share with a negative quota should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - - try { - fileServiceClient.createShare(shareName, null, 9999999); - fail("Attempting to create a share with a quota above 5120 GB should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void deleteShare() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - } - - @Override - public void deleteShareDoesNotExist() { - try { - fileServiceClient.deleteShare(shareName); - fail("Attempting to delete a share that doesn't exist should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteThenCreateShareFromFileServiceClient() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - } - - @Override - public void deleteThenCreateShareTooSoonFromFileServiceClient() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - - try { - fileServiceClient.createShare(shareName); - fail("Attempting to re-create a share within 30 seconds of deleting it should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void listShares() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions()).iterator(); - for (int i = 0; i < 3; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesWithPrefix() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.name(shareName + "prefix" + i); - testShares.add(share); - } else { - share.name(shareName + i); - } - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().prefix(shareName + "prefix")).iterator(); - for (int i = 0; i < 2; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesWithLimit() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().maxResults(2)).iterator(); - for (int i = 0; i < 2; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesInvalidMaxResults() { - try { - fileServiceClient.listShares(defaultOptions().maxResults(-1)).iterator().hasNext(); - fail("Attempting to list shares with a negative maximum should throw an error"); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - - try { - fileServiceClient.listShares(defaultOptions().maxResults(0)).iterator().hasNext(); - fail("Attempting to list shares with a zero maximum should throw an error"); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void listSharesIncludeMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - testShares.add(share); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().includeMetadata(true)).iterator(); - for (int i = 0; i < 3; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesIncludeSnapshots() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - ShareClient client = fileServiceClient.getShareClient(share.name()); - - Response createResponse = client.create(null, share.properties().quota()); - FileTestHelpers.assertResponseStatusCode(createResponse, 201); - - if (i % 2 == 0) { - Response snapshotResponse = client.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotResponse, 201); - - testShares.add(new ShareItem().name(share.name()) - .snapshot(snapshotResponse.value().snapshot()) - .properties(new ShareProperties().quota(share.properties().quota()))); - } - - testShares.add(share); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().includeSnapshots(true)).iterator(); - for (int i = 0; i < 5; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesIncludeMetadataAndSnapshots() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - ShareClient client = fileServiceClient.getShareClient(share.name()); - - Response createResponse = client.create(share.metadata(), share.properties().quota()); - FileTestHelpers.assertResponseStatusCode(createResponse, 201); - - if (i % 2 == 0) { - Response snapshotResponse = client.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotResponse, 201); - - testShares.add(new ShareItem().name(share.name()) - .snapshot(snapshotResponse.value().snapshot()) - .properties(share.properties())); - } - - testShares.add(share); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().includeMetadata(true).includeSnapshots(true)).iterator(); - for (int i = 0; i < 5; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void setFileServiceProperties() { - FileServiceProperties originalProperties = fileServiceClient.getProperties().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties updatedProperties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.setProperties(updatedProperties), 202); - - Response getResponse = fileServiceClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(getResponse, 200); - FileTestHelpers.assertFileServicePropertiesAreEqual(updatedProperties, getResponse.value()); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.setProperties(originalProperties), 202); - - getResponse = fileServiceClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(getResponse, 200); - FileTestHelpers.assertFileServicePropertiesAreEqual(originalProperties, getResponse.value()); - } - - @Override - public void setPropertiesTooManyRules() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - List cors = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - cors.add(new CorsRule()); - } - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(cors); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set more than 5 CorsRules on files should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidAllowedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an allowed header longer than 64 characters should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidExposedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an exposed header longer than 64 characters should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidAllowedOrigin() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an allowed origin longer than 64 characters should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidAllowedMethod() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD"))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an invalid allowed method should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileTestHelpers.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileTestHelpers.java deleted file mode 100644 index d9ea09ede4c3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileTestHelpers.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.rest.Response; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.test.InterceptorManager; -import com.azure.core.test.TestBase; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.Metrics; -import com.azure.storage.file.models.RetentionPolicy; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.security.NoSuchAlgorithmException; -import java.time.Duration; -import java.util.List; -import java.util.Locale; -import java.util.function.BiFunction; -import org.junit.Assert; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -class FileTestHelpers { - private static final String AZURE_TEST_MODE = "AZURE_TEST_MODE"; - - static T setupClient(BiFunction clientBuilder, boolean isPlayback, ClientLogger logger) { - String connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;EndpointSuffix=core.windows.net"; - String endpoint = "https://teststorage.file.core.windows.net/"; - - if (!isPlayback) { - connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING"); - endpoint = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_ENDPOINT"); - } - - if (ImplUtils.isNullOrEmpty(connectionString) && ImplUtils.isNullOrEmpty(endpoint)) { - logger.warning("Connection string or endpoint must be set to buildClient the testing client"); - fail(); - return null; - } - - return clientBuilder.apply(connectionString, endpoint); - } - - static ShareClientBuilder createShareClientWithSnapshot(InterceptorManager interceptorManager, String shareName, String snapshot) { - String connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;EndpointSuffix=core.windows.net"; - String endpoint = "https://teststorage.file.core.windows.net/"; - - ShareClientBuilder shareClientBuilder; - if (!interceptorManager.isPlaybackMode()) { - connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING"); - endpoint = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_ENDPOINT"); - shareClientBuilder = new ShareClientBuilder() - .endpoint(endpoint) - .connectionString(connectionString) - .addPolicy(interceptorManager.getRecordPolicy()) - .shareName(shareName) - .snapshot(snapshot); - } else { - shareClientBuilder = new ShareClientBuilder() - .endpoint(endpoint) - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .shareName(shareName) - .snapshot(snapshot); - } - return shareClientBuilder; - } - - static void assertResponseStatusCode(Response response, int expectedStatusCode) { - assertEquals(expectedStatusCode, response.statusCode()); - } - - static void assertResponseListStatusCode(Response response, List expectedStatusCodeList) { - for (Integer expectedStatusCode: expectedStatusCodeList) { - if (expectedStatusCode == response.statusCode()) { - return; - } - } - fail("The response status code did not include in the list."); - } - - static void assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { - assertTrue(throwable instanceof StorageErrorException); - StorageErrorException exception = (StorageErrorException) throwable; - assertEquals(expectedStatusCode, exception.response().statusCode()); - } - - static void assertExceptionErrorMessage(Throwable throwable, String message) { - assertTrue(throwable instanceof StorageErrorException); - StorageErrorException exception = (StorageErrorException) throwable; - assertTrue(exception.getMessage().contains(message)); - } - - static void assertExceptionStatusCode(Runnable thrower, int expectedStatusCode) { - try { - thrower.run(); - fail(); - } catch (Exception ex) { - assertTrue(ex instanceof StorageErrorException); - StorageErrorException exception = (StorageErrorException) ex; - assertEquals(expectedStatusCode, exception.response().statusCode()); - } - } - - static void sleepInRecordMode(Duration duration) { - if (getTestMode() == TestMode.RECORD) { - sleep(duration); - } - } - - static void sleep(Duration duration) { - try { - Thread.sleep(duration.toMillis()); - } catch (InterruptedException ex) { - // Ignore the exception - } - } - - static void assertSharesAreEqual(ShareItem expected, ShareItem actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.name(), actual.name()); - assertEquals(expected.properties().quota(), actual.properties().quota()); - - if (expected.metadata() != null) { - assertEquals(expected.metadata(), actual.metadata()); - } - - if (expected.snapshot() != null) { - assertEquals(expected.snapshot(), actual.snapshot()); - } - } - } - - static void assertFileServicePropertiesAreEqual(FileServiceProperties expected, FileServiceProperties actual) { - if (expected == null) { - assertNull(actual); - } else { - assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()); - assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()); - assertCorsAreEqual(expected.cors(), actual.cors()); - } - } - - static void assertFileRefsAreEqual(FileRef expected, FileRef actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.name(), actual.name()); - assertEquals(expected.isDirectory(), actual.isDirectory()); - - if (expected.fileProperties() != null && actual.fileProperties() != null) { - assertEquals(expected.fileProperties().contentLength(), actual.fileProperties().contentLength()); - } - } - } - - static 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()); - } - - static TestMode getTestMode() { - final Logger logger = LoggerFactory.getLogger(TestBase.class); - final String azureTestMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE); - - if (azureTestMode != null) { - try { - return TestMode.valueOf(azureTestMode.toUpperCase(Locale.US)); - } catch (IllegalArgumentException e) { - if (logger.isErrorEnabled()) { - logger.error("Could not parse '{}' into TestEnum. Using 'Playback' mode.", azureTestMode); - } - - return TestMode.PLAYBACK; - } - } - - if (logger.isInfoEnabled()) { - logger.info("Environment variable '{}' has not been set yet. Using 'Playback' mode.", AZURE_TEST_MODE); - } - return TestMode.PLAYBACK; - } - - private static 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()); - } - } - - static void assertTwoFilesAreSame(File f1, File f2) throws IOException, NoSuchAlgorithmException { - List uploadFileString = Files.readAllLines(f1.toPath()); - List downloadFileString = Files.readAllLines(f2.toPath()); - if (uploadFileString != null && downloadFileString != null) { - downloadFileString.removeAll(uploadFileString); - } - while (!downloadFileString.isEmpty()) { - Assert.assertTrue("The download file is supposed to be the same as the upload file.", downloadFileString.get(0).isEmpty()); - downloadFileString.remove(0); - } - } - - private static void assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.days(), actual.days()); - assertEquals(expected.enabled(), actual.enabled()); - } - } - - private static 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 static 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()); - } - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/LargeFileTest.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/LargeFileTest.java deleted file mode 100644 index db25264a92de..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/LargeFileTest.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.RandomAccessFile; -import java.net.URL; -import java.nio.file.Files; -import java.security.MessageDigest; -import java.time.Duration; -import java.time.OffsetDateTime; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -import static org.junit.Assert.fail; -import static org.junit.Assume.assumeTrue; - -public class LargeFileTest extends TestBase { - private final ClientLogger largeFileLogger = new ClientLogger(LargeFileTest.class); - private final String azureStorageConnectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING"); - private static final String LARGE_TEST_FOLDER = "test-large-files/"; - private static FileClient largeFileClient; - private static String fileName; - private static File largeFile; - private ShareClient shareClient; - private File dirPath; - - @Rule - public TestName testName = new TestName(); - - @Before - public void setup() { - assumeTrue("The test is only for live mode.", FileTestHelpers.getTestMode() == TestMode.RECORD); - fileName = testResourceNamer.randomName("largefile", 16); - URL folderUrl = LargeFileTest.class.getClassLoader().getResource("."); - dirPath = new File(folderUrl.getPath() + LARGE_TEST_FOLDER); - if (dirPath.exists() || dirPath.mkdir()) { - largeFile = new File(folderUrl.getPath() + LARGE_TEST_FOLDER + fileName); - } else { - largeFileLogger.warning("Failed to create the large file dir."); - } - String shareName = testResourceNamer.randomName("largefileshare", 32); - shareClient = new ShareClientBuilder().connectionString(azureStorageConnectionString).shareName(shareName) - .buildClient(); - shareClient.create(); - shareClient.createDirectory("largefiledir"); - largeFileClient = shareClient.getDirectoryClient("largefiledir").getFileClient(fileName); - } - - @Ignore - @Test - public void uploadAndDownloadLargeFile() throws Exception { - Long fileSize = 5 * 1024 * 1024L; - RandomAccessFile raf = new RandomAccessFile(largeFile, "rw"); - raf.setLength(fileSize); - largeFileClient.create(fileSize); - if (largeFile.exists()) { - largeFileClient.uploadFromFile(largeFile.getPath()); - largeFileLogger.warning("Uploaded success!"); - } else { - fail("Did not find the upload file."); - } - OffsetDateTime start = OffsetDateTime.now(); - File downloadFile = new File(dirPath + "/" + testResourceNamer.randomName("download", 16)); - downloadFile.createNewFile(); - largeFileClient.downloadToFile(downloadFile.getPath()); - System.out.println("Download " + downloadFile.length() + " bytes took " + Duration.between(start, OffsetDateTime.now()).getSeconds() + " seconds"); - if (Files.exists(downloadFile.toPath()) && Files.exists(largeFile.toPath())) { - String checksumUpload = getFileChecksum(largeFile); - String checksumDownload = getFileChecksum(downloadFile); - Assert.assertEquals(checksumUpload, checksumDownload); - } else { - fail("Did not find the download file."); - } - } - - @After - public void cleanUp() { - assumeTrue("The test is only for live mode.", FileTestHelpers.getTestMode() == TestMode.RECORD); - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - private String getFileChecksum(File file) throws Exception { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(Files.readAllBytes(file.toPath())); - int numRead; - InputStream fis = new FileInputStream(file.getPath()); - byte[] buffer = new byte[1024]; - do { - numRead = fis.read(buffer); - if (numRead > 0) { - md.update(buffer, 0, numRead); - } - } while (numRead != -1); - - fis.close(); - byte[] digestByte = md.digest(); - String result = ""; - for (int i = 0; i < digestByte.length; i++) { - result += Integer.toString((digestByte[i] & 0xff) + 0x100, 16).substring(1); - } - return result; - } - - /** - * 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. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java deleted file mode 100644 index 694cf3c2ffa9..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java +++ /dev/null @@ -1,668 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.exception.HttpResponseException; -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.file.models.AccessPolicy; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -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.List; -import java.util.Map; -import org.junit.Assert; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.createShareClientWithSnapshot; -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class ShareAsyncClientTests extends ShareClientTestBase { - private final ClientLogger shareAsyncLogger = new ClientLogger(ShareAsyncClientTests.class); - - private ShareAsyncClient shareAsyncClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - shareAsyncClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, shareAsyncLogger); - } else { - shareAsyncClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, shareAsyncLogger); - } - } - - @Override - public void afterTest() { - try { - shareAsyncClient.delete().block(); - } catch (StorageErrorException ex) { - // Ignore the exception as the share is already deleted and that is what we wanted. - } - } - - @Override - public void getRootDirectoryDoesNotCreateADirectory() { - shareAsyncClient.create().block(); - DirectoryAsyncClient directoryAsyncClient = shareAsyncClient.getRootDirectoryClient(); - StepVerifier.create(directoryAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void getDirectoryDoesNotCreateADirectory() { - shareAsyncClient.create().block(); - DirectoryAsyncClient directoryAsyncClient = shareAsyncClient.getDirectoryClient("testshare"); - Assert.assertNotNull(directoryAsyncClient); - StepVerifier.create(directoryAsyncClient.getProperties()) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void getFileClientDoesNotCreateAFile() { - shareAsyncClient.create().block(); - FileAsyncClient fileAsyncClient = shareAsyncClient.getFileClient("testfile"); - Assert.assertNotNull(fileAsyncClient); - StepVerifier.create(fileAsyncClient.getProperties()) - .verifyErrorSatisfies(response -> Assert.assertTrue(response instanceof HttpResponseException)); - } - - @Override - public void createDirectoryFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createDirectory("testshare")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createDirectoryInvalidNameFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createDirectory("test/share")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createDirectoryAlreadyExistsFromShareClient() { - shareAsyncClient.create().block(); - shareAsyncClient.createDirectory("testshare").block(); - StepVerifier.create(shareAsyncClient.createDirectory("testshare")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 409)); - } - - @Override - public void deleteDirectoryFromShareClient() { - shareAsyncClient.create().block(); - shareAsyncClient.createDirectory("testshare").block(); - StepVerifier.create(shareAsyncClient.deleteDirectory("testshare")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteDirectoryDoesNotExistFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.deleteDirectory("testshare")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createFileFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createFile("myFile", 1024)) - .assertNext(fileAsyncClientResponse -> FileTestHelpers.assertResponseStatusCode(fileAsyncClientResponse, 201)) - .verifyComplete(); - } - - @Override - public void createFileInvalidNameFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createFile("my/File", 1024)) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createFileAlreadyExistsFromShareClient() { - shareAsyncClient.create().block(); - shareAsyncClient.createFile("myFile", 1024).block(); - StepVerifier.create(shareAsyncClient.createFile("myFile", 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteFileFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createFile("myFile", 1024)) - .assertNext(fileAsyncClientResponse -> FileTestHelpers.assertResponseStatusCode(fileAsyncClientResponse, 201)) - .verifyComplete(); - StepVerifier.create(shareAsyncClient.deleteFile("myFile")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteFileDoesNotExistFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.deleteFile("myFile")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createTwiceSameMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createTwiceDifferentMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createInvalidQuotaFromShareClient() { - StepVerifier.create(shareAsyncClient.create(null, -1)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(shareAsyncClient.create(null, 0)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.delete()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteThenCreateFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteThenCreateTooSoonFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.create()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void snapshot() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.createSnapshot()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteSnapshotFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot().block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot( - interceptorManager, shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.createSnapshot()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void snapshotSameMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot(metadata).block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot( - interceptorManager, shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void snapshotDifferentMetadata() { - Map createMetadata = Collections.singletonMap("create", "metadata"); - - StepVerifier.create(shareAsyncClient.create(createMetadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Map updateMetadata = Collections.singletonMap("update", "metadata"); - Response snapshotInfoResponse = shareAsyncClient.createSnapshot(updateMetadata).block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(createMetadata, response.value().metadata()); - }) - .verifyComplete(); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(updateMetadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void snapshotDoesNotExist() { - StepVerifier.create(shareAsyncClient.createSnapshot()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getPropertiesFromShareClient() { - final int quotaInGB = 2; - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create(metadata, quotaInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(quotaInGB, response.value().quota()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getSnapshotPropertiesFromShareClient() { - final int quotaInGB = 2; - Map snapshotMetadata = Collections.singletonMap("snapshot", "metadata"); - - StepVerifier.create(shareAsyncClient.create(null, quotaInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot(snapshotMetadata).block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(quotaInGB, response.value().quota()); - assertEquals(snapshotMetadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getPropertiesDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getSnapshotPropertiesDoesNotExist() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, "snapshot").buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesFromShareClient() { - final int initialQuoteInGB = 2; - - StepVerifier.create(shareAsyncClient.create(null, initialQuoteInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(initialQuoteInGB, response.value().quota()); - }) - .verifyComplete(); - - final int updatedQuotaInGB = 4; - StepVerifier.create(shareAsyncClient.setQuota(updatedQuotaInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(updatedQuotaInGB, response.value().quota()); - }) - .verifyComplete(); - } - - @Override - public void setPropertiesInvalidQuotaFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.setQuota(-1)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(shareAsyncClient.setQuota(9999)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.setQuota(2)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getSnapshotMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot().block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getMetadataDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getSnapshotMetadataDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, "snapshot").buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setMetadataFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Map metadata = Collections.singletonMap("setting", "metadata"); - StepVerifier.create(shareAsyncClient.setMetadata(metadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void setMetadataInvalidMetadataFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Map metadata = Collections.singletonMap("", "metadata"); - StepVerifier.create(shareAsyncClient.setMetadata(metadata)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setMetadataDoesNotExistFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - StepVerifier.create(shareAsyncClient.setMetadata(metadata)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getPolicies() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getAccessPolicy()) - .expectNextCount(0) - .verifyComplete(); - } - - @Override - public void getPoliciesDoesNotExist() { - StepVerifier.create(shareAsyncClient.getAccessPolicy()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setPolicies() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - AccessPolicy policy = 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("test") - .accessPolicy(policy); - - StepVerifier.create(shareAsyncClient.setAccessPolicy(Collections.singletonList(permission))) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getAccessPolicy()) - .assertNext(responsePermission -> FileTestHelpers.assertPermissionsAreEqual(permission, responsePermission)) - .verifyComplete(); - } - - @Override - public void setPoliciesInvalidPermission() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - AccessPolicy policy = new AccessPolicy().permission("abcdefg") - .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("test") - .accessPolicy(policy); - - StepVerifier.create(shareAsyncClient.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPoliciesTooManyPermissions() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - List permissions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - AccessPolicy policy = 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)); - - permissions.add(new SignedIdentifier().id("test" + i).accessPolicy(policy)); - } - - StepVerifier.create(shareAsyncClient.setAccessPolicy(permissions)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPoliciesDoesNotExist() { - AccessPolicy policy = 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("test") - .accessPolicy(policy); - - StepVerifier.create(shareAsyncClient.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getStats() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getStatistics()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().getShareUsageInGB()); - }) - .verifyComplete(); - } - - @Override - public void getStatsDoesNotExist() { - StepVerifier.create(shareAsyncClient.getStatistics()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getSnapshotId() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createSnapshot()) - .assertNext(response -> { - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, response.value().snapshot()).buildAsyncClient(); - Assert.assertEquals(response.value().snapshot(), shareAsyncClientWithSnapshot.getSnapshotId()); - }) - .verifyComplete(); - - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTestBase.java deleted file mode 100644 index 0601788ea732..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTestBase.java +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TestName; - -public abstract class ShareClientTestBase extends TestBase { - String shareName; - - @Rule - public TestName testName = new TestName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - /** - * 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. - * - * @return The name of the current test. - */ - - @Override - public String testName() { - return testName.getMethodName(); - } - - String getShareName() { - return testResourceNamer.randomName("share", 16).toLowerCase(); - } - - @Test - public abstract void getRootDirectoryDoesNotCreateADirectory(); - - @Test - public abstract void getDirectoryDoesNotCreateADirectory(); - - @Test - public abstract void getFileClientDoesNotCreateAFile(); - - @Test - public abstract void createDirectoryFromShareClient(); - - @Test - public abstract void createDirectoryInvalidNameFromShareClient(); - - @Test - public abstract void createDirectoryAlreadyExistsFromShareClient(); - - @Test - public abstract void deleteDirectoryFromShareClient(); - - @Test - public abstract void deleteDirectoryDoesNotExistFromShareClient(); - - @Test - public abstract void createFileFromShareClient(); - - @Test - public abstract void createFileInvalidNameFromShareClient(); - - @Test - public abstract void createFileAlreadyExistsFromShareClient(); - - @Test - public abstract void deleteFileFromShareClient(); - - @Test - public abstract void deleteFileDoesNotExistFromShareClient(); - - @Test - public abstract void createFromShareClient(); - - @Test - public abstract void createTwiceSameMetadataFromShareClient(); - - @Test - public abstract void createTwiceDifferentMetadataFromShareClient(); - - @Test - public abstract void createInvalidQuotaFromShareClient(); - - @Test - public abstract void deleteFromShareClient(); - - @Test - public abstract void deleteDoesNotExistFromShareClient(); - - @Test - public abstract void deleteThenCreateFromShareClient(); - - /** - * Cannot re-create a share within 30 seconds of it being deleted. - */ - @Test - public abstract void deleteThenCreateTooSoonFromShareClient(); - - @Test - public abstract void snapshot(); - - @Test - public abstract void deleteSnapshotFromShareClient(); - - @Test - public abstract void snapshotSameMetadata(); - - @Test - public abstract void snapshotDifferentMetadata(); - - @Test - public abstract void snapshotDoesNotExist(); - - @Test - public abstract void getPropertiesFromShareClient(); - - @Test - public abstract void getSnapshotPropertiesFromShareClient(); - - @Test - public abstract void getPropertiesDoesNotExistFromShareClient(); - - @Test - public abstract void getSnapshotPropertiesDoesNotExist(); - - @Test - public abstract void setPropertiesFromShareClient(); - - @Test - public abstract void setPropertiesInvalidQuotaFromShareClient(); - - @Test - public abstract void setPropertiesDoesNotExistFromShareClient(); - - @Test - public abstract void getMetadataFromShareClient(); - - @Test - public abstract void getSnapshotMetadataFromShareClient(); - - @Test - public abstract void getMetadataDoesNotExistFromShareClient(); - - @Test - public abstract void getSnapshotMetadataDoesNotExistFromShareClient(); - - @Test - public abstract void setMetadataFromShareClient(); - - @Test - public abstract void setMetadataInvalidMetadataFromShareClient(); - - @Test - public abstract void setMetadataDoesNotExistFromShareClient(); - - @Test - public abstract void getPolicies(); - - @Test - public abstract void getPoliciesDoesNotExist(); - - @Test - public abstract void setPolicies(); - - @Test - public abstract void setPoliciesInvalidPermission(); - - @Test - public abstract void setPoliciesTooManyPermissions(); - - @Test - public abstract void setPoliciesDoesNotExist(); - - @Test - public abstract void getStats(); - - @Test - public abstract void getStatsDoesNotExist(); - - @Test - public abstract void getSnapshotId(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTests.java deleted file mode 100644 index ff5cc5485406..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTests.java +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.exception.HttpResponseException; -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.file.models.AccessPolicy; -import com.azure.storage.file.models.DirectoryProperties; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.ShareStatistics; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -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.Iterator; -import java.util.List; -import java.util.Map; -import org.junit.Assert; - -import static com.azure.storage.file.FileTestHelpers.createShareClientWithSnapshot; -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -public class ShareClientTests extends ShareClientTestBase { - private final ClientLogger shareLogger = new ClientLogger(ShareClient.class); - - private ShareClient shareClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - shareClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, shareLogger); - } else { - shareClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, shareLogger); - } - } - - @Override - public void afterTest() { - try { - shareClient.delete(); - } catch (StorageErrorException ex) { - // Ignore the exception as the share is already deleted and that is what we wanted. - } - } - - @Override - public void getRootDirectoryDoesNotCreateADirectory() { - shareClient.create(); - DirectoryClient directoryClient = shareClient.getRootDirectoryClient(); - Response response = directoryClient.getProperties(); - Assert.assertEquals(response.statusCode(), 200); - Assert.assertNotNull(response.value().eTag()); - } - - @Override - public void getDirectoryDoesNotCreateADirectory() { - shareClient.create(); - DirectoryClient directoryClient = shareClient.getDirectoryClient("testshare"); - Assert.assertNotNull(directoryClient); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - directoryClient.getProperties(); - } - - @Override - public void getFileClientDoesNotCreateAFile() { - shareClient.create(); - FileClient fileClient = shareClient.getFileClient("testfile"); - Assert.assertNotNull(fileClient); - thrown.expect(HttpResponseException.class); - fileClient.getProperties(); - } - - @Override - public void createDirectoryFromShareClient() { - shareClient.create(); - FileTestHelpers.assertResponseStatusCode(shareClient.createDirectory("testshare"), 201); - } - - @Override - public void createDirectoryInvalidNameFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ParentNotFound"); - shareClient.createDirectory("test/share"); - } - - @Override - public void createDirectoryAlreadyExistsFromShareClient() { - shareClient.create(); - shareClient.createDirectory("testshare"); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceAlreadyExists"); - shareClient.createDirectory("testshare"); - } - - @Override - public void deleteDirectoryFromShareClient() { - shareClient.create(); - shareClient.createDirectory("testshare"); - FileTestHelpers.assertResponseStatusCode(shareClient.deleteDirectory("testshare"), 202); - } - - @Override - public void deleteDirectoryDoesNotExistFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - shareClient.deleteDirectory("testshare"); - } - - @Override - public void createFileFromShareClient() { - shareClient.create(); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("myFile", 1024), 201); - } - - @Override - public void createFileInvalidNameFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ParentNotFound"); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("my/File", 1024), 201); - } - - @Override - public void createFileAlreadyExistsFromShareClient() { - shareClient.create(); - shareClient.createFile("myFile", 1024); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("myFile", 1024), 201); - } - - @Override - public void deleteFileFromShareClient() { - shareClient.create(); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("myFile", 1024), 201); - FileTestHelpers.assertResponseStatusCode(shareClient.deleteFile("myFile"), 202); - } - - @Override - public void deleteFileDoesNotExistFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - shareClient.deleteFile("myFile"); - } - - @Override - public void createFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - } - - @Override - public void createTwiceSameMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(metadata, 2), 409); - } - - @Override - public void createTwiceDifferentMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(metadata, 2), 409); - } - - @Override - public void createInvalidQuotaFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(null, -1), 400); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(null, 0), 400); - } - - @Override - public void deleteFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - } - - @Override - public void deleteDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.delete(), 404); - } - - @Override - public void deleteThenCreateFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - } - - @Override - public void deleteThenCreateTooSoonFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(), 409); - } - - @Override - public void snapshot() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.createSnapshot(), 201); - } - - @Override - public void deleteSnapshotFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - FileTestHelpers.assertResponseStatusCode(shareClientWithSnapshot.delete(), 202); - - FileTestHelpers.assertResponseStatusCode(shareClient.createSnapshot(), 201); - } - - @Override - public void snapshotSameMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(metadata); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - Response propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void snapshotDifferentMetadata() { - Map createMetadata = Collections.singletonMap("create", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(createMetadata, 2), 201); - - Map updateMetadata = Collections.singletonMap("update", "metadata"); - Response snapshotInfoResponse = shareClient.createSnapshot(updateMetadata); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(createMetadata, propertiesResponse.value().metadata()); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(updateMetadata, propertiesResponse.value().metadata()); - } - - @Override - public void snapshotDoesNotExist() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.createSnapshot(), 404); - } - - @Override - public void getPropertiesFromShareClient() { - final int quotaInGB = 2; - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, quotaInGB), 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(quotaInGB, propertiesResponse.value().quota()); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void getSnapshotPropertiesFromShareClient() { - final int quotaInGB = 2; - Map snapshotMetadata = Collections.singletonMap("snapshot", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(null, quotaInGB), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(snapshotMetadata); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - Response propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(quotaInGB, propertiesResponse.value().quota()); - assertEquals(snapshotMetadata, propertiesResponse.value().metadata()); - } - - @Override - public void getPropertiesDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getProperties(), 404); - } - - @Override - public void getSnapshotPropertiesDoesNotExist() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - "snapshot").buildClient(); - FileTestHelpers.assertExceptionStatusCode(() -> shareClientWithSnapshot.getProperties(), 400); - } - - @Override - public void setPropertiesFromShareClient() { - final int initialQuoteInGB = 2; - - FileTestHelpers.assertResponseStatusCode(shareClient.create(null, initialQuoteInGB), 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(initialQuoteInGB, propertiesResponse.value().quota()); - - final int updatedQuotaInGB = 4; - FileTestHelpers.assertResponseStatusCode(shareClient.setQuota(updatedQuotaInGB), 200); - - propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(updatedQuotaInGB, propertiesResponse.value().quota()); - } - - @Override - public void setPropertiesInvalidQuotaFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setQuota(-1), 400); - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setQuota(9999), 400); - } - - @Override - public void setPropertiesDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setQuota(2), 404); - } - - @Override - public void getMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void getSnapshotMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - Response propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void getMetadataDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getProperties(), 404); - } - - @Override - public void getSnapshotMetadataDoesNotExistFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - "snapshot").buildClient(); - FileTestHelpers.assertExceptionStatusCode(() -> shareClientWithSnapshot.getProperties(), 400); - } - - @Override - public void setMetadataFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Map metadata = Collections.singletonMap("setting", "metadata"); - FileTestHelpers.assertResponseStatusCode(shareClient.setMetadata(metadata), 200); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void setMetadataInvalidMetadataFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Map metadata = Collections.singletonMap("", "metadata"); - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setMetadata(metadata), 400); - } - - @Override - public void setMetadataDoesNotExistFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setMetadata(metadata), 404); - } - - @Override - public void getPolicies() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Iterator accessPolicies = shareClient.getAccessPolicy().iterator(); - assertFalse(accessPolicies.hasNext()); - } - - @Override - public void getPoliciesDoesNotExist() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getAccessPolicy().iterator().hasNext(), 404); - } - - @Override - public void setPolicies() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - AccessPolicy policy = 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("test") - .accessPolicy(policy); - - FileTestHelpers.assertResponseStatusCode(shareClient.setAccessPolicy(Collections.singletonList(permission)), 200); - - Iterator permissions = shareClient.getAccessPolicy().iterator(); - FileTestHelpers.assertPermissionsAreEqual(permission, permissions.next()); - assertFalse(permissions.hasNext()); - } - - @Override - public void setPoliciesInvalidPermission() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - AccessPolicy policy = new AccessPolicy().permission("abcdefg") - .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("test") - .accessPolicy(policy); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setAccessPolicy(Collections.singletonList(permission)), 400); - } - - @Override - public void setPoliciesTooManyPermissions() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - List permissions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - AccessPolicy policy = 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)); - - permissions.add(new SignedIdentifier().id("test" + i).accessPolicy(policy)); - } - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setAccessPolicy(permissions), 400); - } - - @Override - public void setPoliciesDoesNotExist() { - AccessPolicy policy = 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("test") - .accessPolicy(policy); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setAccessPolicy(Collections.singletonList(permission)), 404); - } - - @Override - public void getStats() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Response statisticsResponse = shareClient.getStatistics(); - FileTestHelpers.assertResponseStatusCode(statisticsResponse, 200); - assertEquals(0, statisticsResponse.value().getShareUsageInGB()); - } - - @Override - public void getStatsDoesNotExist() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getStatistics(), 404); - } - - @Override - public void getSnapshotId() { - shareClient.create(); - String actualSnapshot = shareClient.createSnapshot().value().snapshot(); - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, actualSnapshot).buildClient(); - Assert.assertEquals(actualSnapshot, shareClientWithSnapshot.getSnapshotId()); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/APISpec.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/APISpec.groovy new file mode 100644 index 000000000000..5bfac846a0e9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/APISpec.groovy @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.http.HttpClient +import com.azure.core.http.ProxyOptions +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder +import com.azure.core.http.policy.HttpLogDetailLevel +import com.azure.core.test.InterceptorManager +import com.azure.core.test.TestMode +import com.azure.core.test.utils.ResourceNamer +import com.azure.core.test.utils.TestResourceNamer +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.core.util.logging.ClientLogger + +import com.azure.storage.file.FileClientBuilder +import com.azure.storage.file.FileServiceAsyncClient +import com.azure.storage.file.FileServiceClient +import com.azure.storage.file.FileServiceClientBuilder +import com.azure.storage.file.ShareClientBuilder +import com.azure.storage.file.models.ListSharesOptions +import spock.lang.Specification + +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 tmpFolder = getClass().getClassLoader().getResource("tmptestfiles") + def testFolder = getClass().getClassLoader().getResource("testfiles") + InterceptorManager interceptorManager + TestResourceNamer testResourceName + + // Primary Clients used for API tests + FileServiceClient primaryFileServiceClient + FileServiceAsyncClient primaryFileServiceAsyncClient + + + // 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 File service clients commonly used for the API tests. + */ + def setup() { + String testName = reformat(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_FILE_CONNECTION_STRING") + } else { + connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;" + + "AccountKey=atestaccountkey;EndpointSuffix=core.windows.net" + } + } + + /** + * Clean up the test shares, directories and files for the account. + */ + def cleanup() { + interceptorManager.close() + if (getTestMode() == TestMode.RECORD) { + FileServiceClient cleanupFileServiceClient = new FileServiceClientBuilder() + .connectionString(connectionString) + .buildClient() + cleanupFileServiceClient.listShares(new ListSharesOptions().prefix(methodName.toLowerCase())).each { + cleanupFileServiceClient.deleteShare(it.name()) + } + } + } + + /** + * 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: + *

                    + *
                  • Record
                  • + *
                  • 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 fileServiceBuilderHelper(final InterceptorManager interceptorManager) { + if (testMode == TestMode.RECORD) { + return new FileServiceClientBuilder() + .connectionString(connectionString) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + .httpClient(getHttpClient()) + } else { + return new FileServiceClientBuilder() + .connectionString(connectionString) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def shareBuilderHelper(final InterceptorManager interceptorManager, final String shareName) { + if (testMode == TestMode.RECORD) { + return new ShareClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + .httpClient(getHttpClient()) + } else { + return new ShareClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def directoryBuilderHelper(final InterceptorManager interceptorManager, final String shareName, final String directoryPath) { + if (testMode == TestMode.RECORD) { + return new FileClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .resourcePath(directoryPath) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + .httpClient(getHttpClient()) + } else { + return new FileClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .resourcePath(directoryPath) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def fileBuilderHelper(final InterceptorManager interceptorManager, final String shareName, final String filePath) { + if (testMode == TestMode.RECORD) { + return new FileClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .resourcePath(filePath) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + .httpClient(getHttpClient()) + } else { + return new FileClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .resourcePath(filePath) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + private def reformat(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] + } + + static HttpClient getHttpClient() { + if (enableDebugging) { + def builder = new NettyAsyncHttpClientBuilder() + builder.setProxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888))) + return builder.build() + } else { + return HttpClient.createDefault() + } + } + + OffsetDateTime getUTCNow() { + return testResourceName.now() + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAPITests.groovy new file mode 100644 index 000000000000..c211d0728996 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAPITests.groovy @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.Constants +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryClient +import com.azure.storage.file.FileClient +import com.azure.storage.file.FileSmbProperties +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileProperties +import com.azure.storage.file.models.NtfsFileAttributes +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageException +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class DirectoryAPITests extends APISpec { + DirectoryClient primaryDirectoryClient + ShareClient shareClient + def directoryPath + def shareName + static def testMetadata + static def smbProperties + static def filePermission = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL" + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + directoryPath = testResourceName.randomName(methodName, 60) + shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryDirectoryClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).buildDirectoryClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL)) + } + + def "Get directory URL"() { + given: + def accountName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accountName) + when: + def directoryURL = primaryDirectoryClient.getDirectoryUrl().toString() + then: + expectURL == directoryURL + } + + def "Get sub directory client"() { + given: + def subDirectoryClient = primaryDirectoryClient.getSubDirectoryClient("testSubDirectory") + expect: + subDirectoryClient instanceof DirectoryClient + } + + def "Get file client"() { + given: + def fileClient = primaryDirectoryClient.getFileClient("testFile") + expect: + fileClient instanceof FileClient + } + + def "Create directory"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.createWithResponse(null, null, null, null), 201) + } + + def "Create directory error"() { + given: + def testShareName = testResourceName.randomName(methodName, 60) + when: + directoryBuilderHelper(interceptorManager, testShareName, directoryPath).buildDirectoryClient().create() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Create directory with metadata"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.createWithResponse(null, null, testMetadata, null), 201) + } + + def "Create directory error with metadata"() { + given: + def errorMetadata = Collections.singletonMap("testMeta", "value") + when: + primaryDirectoryClient.createWithResponse(null, null, errorMetadata, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 403, StorageErrorCode.AUTHENTICATION_FAILED) + } + + def "Create directory with file permission"() { + when: + def resp = primaryDirectoryClient.createWithResponse(null, filePermission, null, null) + + then: + FileTestHelper.assertResponseStatusCode(resp, 201) + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + def "Create directory with file permission key"() { + setup: + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + when: + def resp = primaryDirectoryClient.createWithResponse(smbProperties, null, null, null) + + then: + FileTestHelper.assertResponseStatusCode(resp, 201) + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + @Unroll + def "Create directory permission and key error"() { + when: + FileSmbProperties properties = new FileSmbProperties().filePermissionKey(filePermissionKey) + primaryDirectoryClient.createWithResponse(properties, permission, null, null) + then: + thrown(IllegalArgumentException) + where: + filePermissionKey | permission + "filePermissionKey" | filePermission + null | new String(FileTestHelper.getRandomBuffer(9 * Constants.KB)) + } + + def "Delete directory"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.deleteWithResponse(null), 202) + } + + def "Delete directory error"() { + when: + primaryDirectoryClient.delete() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get properties"() { + given: + primaryDirectoryClient.create() + def resp = primaryDirectoryClient.getPropertiesWithResponse(null) + expect: + FileTestHelper.assertResponseStatusCode(resp, 200) + resp.value().eTag() + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + def "Get properties error"() { + when: + primaryDirectoryClient.getPropertiesWithResponse(null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Set properties file permission"() { + given: + primaryDirectoryClient.create() + def resp = primaryDirectoryClient.setPropertiesWithResponse(null, filePermission, null) + expect: + FileTestHelper.assertResponseStatusCode(resp, 200) + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + def "Set properties file permission key"() { + given: + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + primaryDirectoryClient.create() + def resp = primaryDirectoryClient.setPropertiesWithResponse(smbProperties, null, null) + expect: + FileTestHelper.assertResponseStatusCode(resp, 200) + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + @Unroll + def "Set properties error"() { + when: + FileSmbProperties properties = new FileSmbProperties().filePermissionKey(filePermissionKey) + primaryDirectoryClient.create() + primaryDirectoryClient.setPropertiesWithResponse(properties, permission, null) + then: + thrown(IllegalArgumentException) + where: + filePermissionKey | permission + "filePermissionKey" | filePermission + null | new String(FileTestHelper.getRandomBuffer(9 * Constants.KB)) + } + + def "Set metadata"() { + given: + primaryDirectoryClient.createWithResponse(null, null, testMetadata, null) + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBefore = primaryDirectoryClient.getProperties() + def setPropertiesResponse = primaryDirectoryClient.setMetadataWithResponse(updatedMetadata, null) + def getPropertiesAfter = primaryDirectoryClient.getProperties() + then: + testMetadata == getPropertiesBefore.metadata() + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 200) + updatedMetadata == getPropertiesAfter.metadata() + } + + def "Set metadata error"() { + given: + primaryDirectoryClient.create() + def errorMetadata = Collections.singletonMap("", "value") + when: + primaryDirectoryClient.setMetadata(errorMetadata) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + @Unroll + def "List files and directories"() { + given: + primaryDirectoryClient.create() + + for (def expectedFile : expectedFiles) { + primaryDirectoryClient.createFile(expectedFile, 2) + } + + for (def expectedDirectory : expectedDirectories) { + primaryDirectoryClient.createSubDirectory(expectedDirectory) + } + + when: + def foundFiles = [] as Set + def foundDirectories = [] as Set + for (def fileRef : primaryDirectoryClient.listFilesAndDirectories()) { + if (fileRef.isDirectory()) { + foundDirectories << fileRef.name() + } else { + foundFiles << fileRef.name() + } + } + + then: + expectedFiles == foundFiles + expectedDirectories == foundDirectories + + where: + expectedFiles | expectedDirectories + ["a", "b", "c"] as Set | ["d", "e"] as Set + ["a", "c", "e"] as Set | ["b", "d"] as Set + } + + /** + * The listing hierarchy: + * share -> dir -> listOp0 (dir) -> listOp3 (file) + * -> listOp4 (file) + * -> listOp1 (dir) -> listOp5 (file) + * -> listOp6 (file) + * -> listOp2 (file) + */ + @Unroll + def "List files and directories args"() { + given: + primaryDirectoryClient.create() + def nameList = new LinkedList() + def dirPrefix = testResourceName.randomName(methodName, 60) + for (int i = 0; i < 2; i++) { + def subDirClient = primaryDirectoryClient.getSubDirectoryClient(dirPrefix + i) + subDirClient.create() + for (int j = 0; j < 2; j++) { + def num = i * 2 + j + 3 + subDirClient.createFile(dirPrefix + num, 1024) + } + } + primaryDirectoryClient.createFile(dirPrefix + 2, 1024) + for (int i = 0; i < 3; i++) { + nameList.add(dirPrefix + i) + } + + when: + def fileRefIter = primaryDirectoryClient.listFilesAndDirectories(prefix, maxResults).iterator() + + then: + for (int i = 0; i < numOfResults; i++) { + Objects.equals(nameList.pop(), fileRefIter.next().name()) + } + !fileRefIter.hasNext() + + where: + prefix | maxResults | numOfResults + null | null | 3 + "directoryapitestslistfilesanddirectoriesargs" | 1 | 3 + "noOp" | 3 | 0 + } + + @Unroll + def "List handles"() { + given: + primaryDirectoryClient.create() + expect: + primaryDirectoryClient.listHandles(maxResult, recursive).size() == 0 + where: + maxResult | recursive + 2 | true + null | false + } + + def "List handles error"() { + when: + primaryDirectoryClient.listHandles(null, true).iterator().hasNext() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Force close handles error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.forceCloseHandles("handleId", true).iterator().hasNext() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + + def "Create sub directory"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, null, null, null), 201) + } + + def "Create sub directory invalid name"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createSubDirectory("test/subdirectory") + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + + def "Create sub directory metadata"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, null, testMetadata, null), 201) + } + + def "Create sub directory metadata error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createSubDirectoryWithResponse("testsubdirectory", null, null, Collections.singletonMap("", "value"), null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "Create sub directory file permission"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, filePermission, null, null), 201) + } + + def "Create sub directory file permission key"() { + given: + primaryDirectoryClient.create() + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createSubDirectoryWithResponse("testCreateSubDirectory", smbProperties, null, null, null), 201) + } + + def "Delete sub directory"() { + given: + def subDirectoryName = "testSubCreateDirectory" + primaryDirectoryClient.create() + primaryDirectoryClient.createSubDirectory(subDirectoryName) + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.deleteSubDirectoryWithResponse(subDirectoryName, null), 202) + } + + def "Delete sub directory error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.deleteSubDirectory("testsubdirectory") + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + + def "Create file"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createFileWithResponse("testCreateFile", 1024, null, null, null, null, null), 201) + } + + @Unroll + def "Create file invalid args"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createFileWithResponse(fileName, maxSize, null, null, null, null, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + fileName | maxSize | statusCode | errMsg + "testfile:" | 1024 | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryDirectoryClient.create() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("txt") + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, smbProperties, filePermission, testMetadata, null), 201) + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryDirectoryClient.create() + when: + + primaryDirectoryClient.createFileWithResponse(fileName, maxSize, httpHeaders, null, null, metadata, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, errMsg) + where: + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryDirectoryClient.create() + primaryDirectoryClient.createFile(fileName, 1024) + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.deleteFileWithResponse(fileName, null), 202) + } + + def "Delete file error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.deleteFileWithResponse("testfile", null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).snapshot(snapshot).buildDirectoryClient() + then: + snapshot == shareSnapshotClient.getShareSnapshotId() + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAsyncAPITests.groovy new file mode 100644 index 000000000000..63762b7c05b1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAsyncAPITests.groovy @@ -0,0 +1,582 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.Constants +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryAsyncClient +import com.azure.storage.file.FileAsyncClient +import com.azure.storage.file.FileSmbProperties +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileProperties +import com.azure.storage.file.models.NtfsFileAttributes +import com.azure.storage.file.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class DirectoryAsyncAPITests extends APISpec { + DirectoryAsyncClient primaryDirectoryAsyncClient + ShareClient shareClient + def directoryPath + def shareName + static def testMetadata + static def smbProperties + static def filePermission = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL" + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + directoryPath = testResourceName.randomName(methodName, 60) + shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryDirectoryAsyncClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).buildDirectoryAsyncClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL)) + } + + def "Get directory URL"() { + given: + def accountName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accountName) + when: + def directoryURL = primaryDirectoryAsyncClient.getDirectoryUrl().toString() + then: + expectURL.equals(directoryURL) + } + + def "Get sub directory client"() { + given: + def subDirectoryClient = primaryDirectoryAsyncClient.getSubDirectoryClient("testSubDirectory") + expect: + subDirectoryClient instanceof DirectoryAsyncClient + } + + def "Get file client"() { + given: + def fileClient = primaryDirectoryAsyncClient.getFileClient("testFile") + expect: + fileClient instanceof FileAsyncClient + } + + def "Create directory"() { + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(null, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory error"() { + given: + def testShareName = testResourceName.randomName(methodName, 60) + when: + def createDirErrorVerifier = StepVerifier.create(directoryBuilderHelper(interceptorManager, testShareName, directoryPath).buildDirectoryAsyncClient().create()) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Create directory with metadata"() { + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(null, null, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory error with metadata"() { + given: + def errorMetadata = Collections.singletonMap("testMeta", "value") + when: + def createMetadataErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(null, null, errorMetadata)) + then: + createMetadataErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 403, StorageErrorCode.AUTHENTICATION_FAILED) + } + } + + def "Create directory with file permission"() { + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(null, filePermission, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Create dir with file perm key"() { + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(smbProperties, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Delete directory"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.deleteWithResponse()) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete directory error"() { + when: + def deleteDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.delete()) + then: + deleteDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + primaryDirectoryAsyncClient.create().block() + def getPropertiesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + expect: + getPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().eTag() + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Get properties error"() { + when: + def getPropertiesErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Set properties file permission"() { + given: + primaryDirectoryAsyncClient.createWithResponse(null, null, null).block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.setPropertiesWithResponse(null, filePermission)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Set properties file permission key"() { + given: + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + primaryDirectoryAsyncClient.createWithResponse(null, null, null).block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.setPropertiesWithResponse(smbProperties, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Set properties error"() { + setup: + primaryDirectoryAsyncClient.createWithResponse(null, null, null).block() + when: + FileSmbProperties properties = new FileSmbProperties().filePermissionKey("filePermissionKey") + def setPropertiesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.setProperties(properties, filePermission)) + then: + setPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof IllegalArgumentException + } + when: + setPropertiesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.setProperties(null, new String(FileTestHelper.getRandomBuffer(9 * Constants.KB)))) + then: + setPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof IllegalArgumentException + } + } + + def "Set metadata"() { + given: + primaryDirectoryAsyncClient.createWithResponse(null, null, testMetadata).block() + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + def setPropertiesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.setMetadataWithResponse(updatedMetadata)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesBeforeVerifier.assertNext { + assert testMetadata.equals(it.value().metadata()) + }.verifyComplete() + setPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert updatedMetadata.equals(it.value().metadata()) + }.verifyComplete() + } + + def "Set metadata error"() { + given: + primaryDirectoryAsyncClient.create().block() + def errorMetadata = Collections.singletonMap("", "value") + when: + def setMetadataVerifier = StepVerifier.create(primaryDirectoryAsyncClient.setMetadata(errorMetadata)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + @Unroll + def "List files and directories"() { + given: + primaryDirectoryAsyncClient.create().block() + + for (def expectedFile : expectedFiles) { + primaryDirectoryAsyncClient.createFile(expectedFile, 2).block() + } + + for (def expectedDirectory : expectedDirectories) { + primaryDirectoryAsyncClient.createSubDirectory(expectedDirectory).block() + } + + when: + def foundFiles = [] as Set + def foundDirectories = [] as Set + for (def fileRef : primaryDirectoryAsyncClient.listFilesAndDirectories().toIterable()) { + if (fileRef.isDirectory()) { + foundDirectories << fileRef.name() + } else { + foundFiles << fileRef.name() + } + } + + then: + expectedFiles == foundFiles + expectedDirectories == foundDirectories + + where: + expectedFiles | expectedDirectories + ["a", "b", "c"] as Set | ["d", "e"] as Set + ["a", "c", "e"] as Set | ["b", "d"] as Set + } + + /** + * The listing hierarchy: + * share -> dir -> listOp0 (dir) -> listOp3 (file) + * -> listOp4 (file) + * -> listOp1 (dir) -> listOp5 (file) + * -> listOp6 (file) + * -> listOp2 (file) + */ + @Unroll + def "List files and directories args"() { + given: + primaryDirectoryAsyncClient.create().block() + LinkedList nameList = new LinkedList<>() + def dirPrefix = testResourceName.randomName(methodName, 60) + for (int i = 0; i < 2; i++) { + def subDirClient = primaryDirectoryAsyncClient.getSubDirectoryClient(dirPrefix + i) + subDirClient.create().block() + for (int j = 0; j < 2; j++) { + def num = i * 2 + j + 3 + subDirClient.createFile(dirPrefix + num, 1024).block() + } + } + primaryDirectoryAsyncClient.createFile(dirPrefix + 2, 1024).block() + for (int i = 0; i < 3; i++) { + nameList.add(dirPrefix + i) + } + + when: + def listFileAndDirVerifier = StepVerifier.create(primaryDirectoryAsyncClient.listFilesAndDirectories(prefix, maxResults)) + + then: + listFileAndDirVerifier.thenConsumeWhile { + Objects.equals(it.name(), nameList.pop()) + }.verifyComplete() + for (int i = 0; i < 3 - numOfResults; i++) { + nameList.pop() + } + nameList.isEmpty() + where: + prefix | maxResults | numOfResults + "directoryasyncapitestslistfilesanddirectoriesargs" | null | 3 + "directoryasyncapitestslistfilesanddirectoriesargs" | 1 | 3 + "directoryasyncapitestslistfilesanddirectoriesargsnoops" | 1 | 0 + } + + @Unroll + def "List handles"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.listHandles(maxResult, recursive)).verifyComplete() + where: + maxResult | recursive + 2 | true + null | false + } + + def "List handles error"() { + when: + def listHandlesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.listHandles(null, true)) + then: + listHandlesVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Force close handles error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def forceCloseHandlesErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.forceCloseHandles("handleId", true)) + then: + forceCloseHandlesErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + } + + def "Create sub directory"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create sub directory invalid name"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectory("test/subdirectory")) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + } + + def "Create sub directory metadata"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, null, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create sub directory metadata error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testsubdirectory", null, null, Collections.singletonMap("", "value"))) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "Create sub directory file permission"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, filePermission, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create sub directory file perm key"() { + given: + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testCreateSubDirectory", smbProperties, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Delete sub directory"() { + given: + def subDirectoryName = "testSubCreateDirectory" + primaryDirectoryAsyncClient.create().block() + primaryDirectoryAsyncClient.createSubDirectory(subDirectoryName).block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.deleteSubDirectoryWithResponse(subDirectoryName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete sub directory error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def deleteDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.deleteSubDirectoryWithResponse("testsubdirectory")) + then: + deleteDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Create file"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse("testCreateFile", 1024, null, null, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file invalid args"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createFileErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse(fileName, maxSize, null, null, null, null)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + fileName | maxSize | statusCode | errMsg + "testfile:" | 1024 | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryDirectoryAsyncClient.create().block() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("txt") + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, smbProperties, filePermission, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryDirectoryAsyncClient.create().block() + + when: + + def errorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse(fileName, maxSize, httpHeaders, null, null, metadata)) + + then: + errorVerifier.verifyErrorSatisfies({ + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, errMsg) + }) + + where: + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryDirectoryAsyncClient.create().block() + primaryDirectoryAsyncClient.createFile(fileName, 1024).block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.deleteFileWithResponse(fileName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete file error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def deleteFileErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.deleteFileWithResponse("testfile")) + then: + deleteFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).snapshot(snapshot).buildDirectoryAsyncClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAPITests.groovy new file mode 100644 index 000000000000..7c04a0645614 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAPITests.groovy @@ -0,0 +1,568 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.exception.HttpResponseException +import com.azure.core.http.rest.Response +import com.azure.core.exception.UnexpectedLengthException +import com.azure.core.implementation.util.FluxUtil +import com.azure.storage.common.Constants +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.FileClient +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.FileCopyInfo +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileProperties +import com.azure.storage.file.models.FileRange +import com.azure.storage.file.FileSmbProperties +import com.azure.storage.file.models.NtfsFileAttributes +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageException +import spock.lang.Ignore +import spock.lang.Unroll + +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.nio.file.FileAlreadyExistsException +import java.nio.file.NoSuchFileException +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class FileAPITests extends APISpec { + FileClient primaryFileClient + ShareClient shareClient + def shareName + def filePath + def defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)) + def dataLength = defaultData.remaining() + static def testMetadata + static def httpHeaders + static def smbProperties + static def filePermission = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL" + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + filePath = testResourceName.randomName(methodName, 60) + shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryFileClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildFileClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + httpHeaders = new FileHTTPHeaders().fileContentLanguage("en") + .fileContentType("application/octet-stream") + smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL) as EnumSet) + } + + def "Get file URL"() { + given: + def accountName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accountName) + when: + def fileURL = primaryFileClient.getFileUrl().toString() + then: + expectURL == fileURL + } + + def "Create file"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryFileClient.createWithResponse(1024, null, null, null, null, null), 201) + } + + def "Create file error"() { + when: + primaryFileClient.create(-1) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + + def "Create file with args fpk"() { + when: + def filePermissionKey = shareClient.createPermission(filePermission) + // We recreate file properties for each test since we need to store the times for the test with getUTCNow() + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + def resp = primaryFileClient.createWithResponse(1024, httpHeaders, smbProperties, null, testMetadata, null) + then: + FileTestHelper.assertResponseStatusCode(resp, 201) + resp.value().eTag() + resp.value().lastModified() + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + def "Create file with args fp"() { + when: + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + def resp = primaryFileClient.createWithResponse(1024, httpHeaders, smbProperties, filePermission, testMetadata, null) + then: + FileTestHelper.assertResponseStatusCode(resp, 201) + resp.value().eTag() + resp.value().lastModified() + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + @Unroll + def "Create file with args error"() { + when: + primaryFileClient.createWithResponse(maxSize, null, null, null, metadata, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + maxSize | metadata | statusCode | errMsg + -1 | testMetadata | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + 1024 | Collections.singletonMap("testMeta", "value") | 403 | StorageErrorCode.AUTHENTICATION_FAILED + } + + @Unroll + def "Create file permission and key error"() { + when: + FileSmbProperties smbProperties = new FileSmbProperties().filePermissionKey(filePermissionKey) + primaryFileClient.createWithResponse(1024, null, smbProperties, permission, null, null) + then: + thrown(IllegalArgumentException) + where: + filePermissionKey | permission + "filePermissionKey" | filePermission + null | new String(FileTestHelper.getRandomBuffer(9 * Constants.KB)) + } + + def "Upload and download data"() { + given: + primaryFileClient.create(dataLength) + def dataBytes = new byte[dataLength] + defaultData.get(dataBytes) + defaultData.rewind() + when: + def uploadResponse = primaryFileClient.uploadWithResponse(defaultData, dataLength, null) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(null, null, null) + then: + FileTestHelper.assertResponseStatusCode(uploadResponse, 201) + FileTestHelper.assertResponseStatusCode(downloadResponse, 200) + downloadResponse.value().contentLength() == dataLength + downloadResponse.value().eTag() + downloadResponse.value().lastModified() + downloadResponse.value().smbProperties() + downloadResponse.value().smbProperties().filePermissionKey() + downloadResponse.value().smbProperties().ntfsFileAttributes() + downloadResponse.value().smbProperties().fileLastWriteTime() + downloadResponse.value().smbProperties().fileCreationTime() + downloadResponse.value().smbProperties().fileChangeTime() + downloadResponse.value().smbProperties().parentId() + downloadResponse.value().smbProperties().fileId() + + Arrays.equals(dataBytes, FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block()) + + + cleanup: + defaultData.clear() + } + + def "Upload and download data with args"() { + given: + primaryFileClient.create(1024) + def dataBytes = new byte[dataLength] + defaultData.get(dataBytes) + defaultData.rewind() + when: + def uploadResponse = primaryFileClient.uploadWithResponse(defaultData, dataLength, 1, null) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(1, dataLength), true, null) + + then: + FileTestHelper.assertResponseStatusCode(uploadResponse, 201) + FileTestHelper.assertResponseStatusCode(downloadResponse, 206) + downloadResponse.value().contentLength() == dataLength + + Arrays.equals(dataBytes, FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block()) + cleanup: + defaultData.clear() + } + + def "Upload data error"() { + when: + primaryFileClient.uploadWithResponse(defaultData, dataLength, 1, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + cleanup: + defaultData.clear() + } + + def "Upload and clear range" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRange(7) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(0, 6), false, null) + then: + def downloadArray = FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block() + downloadArray.eachByte { + assert it == 0 + } + cleanup: + fullInfoData.clear() + } + + def "Upload and clear range with args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRangeWithResponse(7, 1, null) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(1, 7), false, null) + then: + def downloadArray = FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block() + downloadArray.eachByte { + assert it == 0 + } + } + + def "Clear range error" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRange(30) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 416, StorageErrorCode.INVALID_RANGE) + } + + def "Clear range error args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRangeWithResponse(7, 20, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 416, StorageErrorCode.INVALID_RANGE) + } + + @Unroll + def "Upload data length mismatch"() { + given: + primaryFileClient.create(1024) + when: + primaryFileClient.uploadWithResponse(defaultData, size, 0, null) + then: + def e = thrown(UnexpectedLengthException) + e.getMessage().contains(errMsg) + cleanup: + defaultData.clear() + where: + size | errMsg + 6 | "more than" + 8 | "less than" + } + + def "Download data error"() { + when: + primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(0, 1023), false, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Upload file does not exist"() { + given: + def uploadFile = new File(testFolder.getPath() + "/fakefile.txt") + + if (uploadFile.exists()) { + assert uploadFile.delete() + } + + when: + primaryFileClient.uploadFromFile(uploadFile.getPath()) + + then: + def ex = thrown(UncheckedIOException) + ex.getCause() instanceof NoSuchFileException + + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.getPath()) + } + + def "Upload and download file exists"() { + given: + def data = "Download file exists" + def downloadFile = new File(String.format("%s/%s.txt", testFolder.getPath(), methodName)) + + if (!downloadFile.exists()) { + assert downloadFile.createNewFile() + } + + primaryFileClient.create(data.length()) + primaryFileClient.upload(ByteBuffer.wrap(data.getBytes(StandardCharsets.UTF_8)), data.length()) + + when: + primaryFileClient.downloadToFile(downloadFile.getPath()) + + then: + def ex = thrown(UncheckedIOException) + ex.getCause() instanceof FileAlreadyExistsException + + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.getPath()) + } + + def "Upload and download to file does not exist"() { + given: + def data = "Download file does not exist" + def downloadFile = new File(String.format("%s/%s.txt", testFolder.getPath(), methodName)) + + if (downloadFile.exists()) { + assert downloadFile.delete() + } + + primaryFileClient.create(data.length()) + primaryFileClient.upload(ByteBuffer.wrap(data.getBytes(StandardCharsets.UTF_8)), data.length()) + + when: + primaryFileClient.downloadToFile(downloadFile.getPath()) + + then: + def scanner = new Scanner(downloadFile).useDelimiter("\\Z") + data == scanner.next() + scanner.close() + + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.getPath()) + } + + def "Start copy"() { + given: + primaryFileClient.create(1024) + // TODO: Need another test account if using SAS token for authentication. + // TODO: SasToken auth cannot be used until the logging redaction + def sourceURL = primaryFileClient.getFileUrl().toString() + "/" + shareName + "/" + filePath + when: + Response copyInfoResponse = primaryFileClient.startCopyWithResponse(sourceURL, null, null) + then: + FileTestHelper.assertResponseStatusCode(copyInfoResponse, 202) + copyInfoResponse.value().copyId() != null + } + + def "Start copy error"() { + given: + primaryFileClient.create(1024) + when: + primaryFileClient.startCopyWithResponse("some url", testMetadata, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + + @Ignore + def "Abort copy"() { + //TODO: Need to find a way of mocking pending copy status + } + + def "Delete file"() { + given: + primaryFileClient.createWithResponse(1024, null, null, null, null, null) + expect: + FileTestHelper.assertResponseStatusCode(primaryFileClient.deleteWithResponse(null), 202) + } + + def "Delete file error"() { + when: + primaryFileClient.deleteWithResponse(null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get properties"() { + given: + primaryFileClient.create(1024) + when: + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + def resp = primaryFileClient.getPropertiesWithResponse(null) + then: + FileTestHelper.assertResponseStatusCode(resp, 200) + resp.value().eTag() + resp.value().lastModified() + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + def "Get properties error"() { + when: + primaryFileClient.getProperties() + then: + thrown(HttpResponseException) + } + + def "Set httpHeaders fpk"() { + given: + primaryFileClient.createWithResponse(1024, null, null, null, null, null) + def filePermissionKey = shareClient.createPermission(filePermission) + when: + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + + def resp = primaryFileClient.setPropertiesWithResponse(512, httpHeaders, smbProperties, null, null) + then: + FileTestHelper.assertResponseStatusCode(resp, 200) + resp.value().eTag() + resp.value().lastModified() + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + + def "Set httpHeaders fp"() { + given: + primaryFileClient.createWithResponse(1024, null, null, null, null, null) + when: + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + + def resp = primaryFileClient.setPropertiesWithResponse(512, httpHeaders, smbProperties, filePermission, null) + then: + FileTestHelper.assertResponseStatusCode(resp, 200) + resp.value().eTag() + resp.value().lastModified() + resp.value().smbProperties() + resp.value().smbProperties().filePermissionKey() + resp.value().smbProperties().ntfsFileAttributes() + resp.value().smbProperties().fileLastWriteTime() + resp.value().smbProperties().fileCreationTime() + resp.value().smbProperties().fileChangeTime() + resp.value().smbProperties().parentId() + resp.value().smbProperties().fileId() + } + def "Set httpHeaders error"() { + given: + primaryFileClient.createWithResponse(1024, null, null, null, null, null) + when: + primaryFileClient.setPropertiesWithResponse(-1, null, null, null, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + + def "Set metadata"() { + given: + primaryFileClient.createWithResponse(1024, httpHeaders, null, null, testMetadata, null) + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBefore = primaryFileClient.getProperties() + def setPropertiesResponse = primaryFileClient.setMetadataWithResponse(updatedMetadata, null) + def getPropertiesAfter = primaryFileClient.getProperties() + then: + testMetadata.equals(getPropertiesBefore.metadata()) + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 200) + updatedMetadata.equals(getPropertiesAfter.metadata()) + } + + def "Set metadata error"() { + given: + primaryFileClient.create(1024) + def errorMetadata = Collections.singletonMap("", "value") + when: + primaryFileClient.setMetadataWithResponse(errorMetadata, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "List ranges"() { + given: + def fileName = testResourceName.randomName("file", 60) + primaryFileClient.create(1024) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileClient.uploadFromFile(uploadFile) + expect: + primaryFileClient.listRanges().each { + assert it.start() == 0 + assert it.end() == 1023 + } + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List ranges with range"() { + given: + def fileName = testResourceName.randomName("file", 60) + primaryFileClient.create(1024) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileClient.uploadFromFile(uploadFile) + expect: + primaryFileClient.listRanges(new FileRange(0, 511L)).each { + assert it.start() == 0 + assert it.end() == 511 + } + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List handles"() { + given: + primaryFileClient.create(1024) + expect: + primaryFileClient.listHandles().size() == 0 + } + + def "List handles with maxResult"() { + given: + primaryFileClient.create(1024) + expect: + primaryFileClient.listHandles(2).size() == 0 + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = fileBuilderHelper(interceptorManager, shareName, filePath).snapshot(snapshot).buildFileClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAsyncAPITests.groovy new file mode 100644 index 000000000000..03711817d2e9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAsyncAPITests.groovy @@ -0,0 +1,589 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.exception.HttpResponseException +import com.azure.core.exception.UnexpectedLengthException +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.FileAsyncClient +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileRange +import com.azure.storage.file.FileSmbProperties +import com.azure.storage.file.models.NtfsFileAttributes +import com.azure.storage.file.models.StorageErrorCode +import reactor.core.publisher.Flux +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.nio.file.FileAlreadyExistsException +import java.nio.file.NoSuchFileException +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class FileAsyncAPITests extends APISpec { + FileAsyncClient primaryFileAsyncClient + ShareClient shareClient + def shareName + def filePath + def defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)) + def dataLength = defaultData.remaining() + static def testMetadata + static def httpHeaders + static def smbProperties + static def filePermission = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL" + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + filePath = testResourceName.randomName(methodName, 60) + shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryFileAsyncClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildFileAsyncClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + httpHeaders = new FileHTTPHeaders().fileContentLanguage("en") + .fileContentType("application/octet-stream") + smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL)) + } + + def "Get file URL"() { + given: + def accountName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accountName) + when: + def fileURL = primaryFileAsyncClient.getFileUrl().toString() + then: + expectURL == fileURL + } + + def "Create file"() { + expect: + StepVerifier.create(primaryFileAsyncClient.create(1024)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + } + } + + def "Create file error"() { + when: + def createFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.create(-1)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + } + + def "Create file with args fpk"() { + setup: + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + expect: + StepVerifier.create(primaryFileAsyncClient.createWithResponse(1024, httpHeaders, smbProperties, null, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + assert it.value().lastModified() + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Create file with args fp"() { + setup: + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + expect: + StepVerifier.create(primaryFileAsyncClient.createWithResponse(1024, httpHeaders, smbProperties, filePermission, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + assert it.value().lastModified() + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + @Unroll + def "Create file with args error"() { + when: + def createFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.createWithResponse(maxSize, null, null, null, metadata)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + maxSize | metadata | statusCode | errMsg + -1 | testMetadata | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + 1024 | Collections.singletonMap("testMeta", "value") | 403 | StorageErrorCode.AUTHENTICATION_FAILED + } + + def "Upload and download data"() { + given: + primaryFileAsyncClient.create(dataLength).block() + when: + def uploadVerifier = StepVerifier.create(primaryFileAsyncClient.uploadWithResponse(Flux.just(defaultData), dataLength)) + def downloadVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(null, null)) + + then: + uploadVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + + downloadVerifier.assertNext { + assert it.value().contentLength() == dataLength + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + cleanup: + defaultData.clear() + } + + def "Upload and download data with args"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def uploadVerifier = StepVerifier.create(primaryFileAsyncClient.uploadWithResponse(Flux.just(defaultData), dataLength, 1)) + def downloadVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1, dataLength), true)) + + then: + uploadVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + + downloadVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 206) + assert it.value().contentLength() == dataLength + }.verifyComplete() + cleanup: + defaultData.clear() + } + + def "Upload data error"() { + when: + def updateDataErrorVerifier = StepVerifier.create(primaryFileAsyncClient.upload(Flux.just(defaultData), dataLength, 1)) + then: + updateDataErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + cleanup: + defaultData.clear() + } + + @Unroll + def "Upload data length mismatch"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def uploadErrorVerifier = StepVerifier.create(primaryFileAsyncClient.uploadWithResponse(Flux.just(defaultData), + size, 0)) + then: + uploadErrorVerifier.verifyErrorSatisfies { + assert it instanceof UnexpectedLengthException + assert it.getMessage().contains(errMsg) + } + cleanup: + defaultData.clear() + where: + size | errMsg + 6 | "more than" + 8 | "less than" + } + + def "Download data error"() { + when: + def downloadDataErrorVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(0, 1023), false)) + then: + downloadDataErrorVerifier.verifyErrorSatisfies({ + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + }) + } + + def "Upload and clear range" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeVerifier = StepVerifier.create(primaryFileAsyncClient.clearRangeWithResponse(7, 0)) + def downloadResponseVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(0, 6), false)) + then: + clearRangeVerifier.assertNext { + FileTestHelper.assertResponseStatusCode(it, 201) + } + downloadResponseVerifier.assertNext { + assert it.value().body() != null + } + } + + def "Upload and clear range with args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeVerifier = StepVerifier.create(primaryFileAsyncClient.clearRangeWithResponse(7, 1)) + def downloadResponseVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1, 7), false)) + then: + clearRangeVerifier.assertNext { + FileTestHelper.assertResponseStatusCode(it, 201) + } + downloadResponseVerifier.assertNext { + assert it.value().body() != null + } + cleanup: + fullInfoData.clear() + } + + def "Clear range error" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeErrorVerifier = StepVerifier.create(primaryFileAsyncClient.clearRange(30)) + then: + clearRangeErrorVerifier.verifyErrorSatisfies { + FileTestHelper.assertExceptionStatusCodeAndMessage(it, 416, StorageErrorCode.INVALID_RANGE) + } + } + + def "Clear range error args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeErrorVerifier = StepVerifier.create(primaryFileAsyncClient.clearRangeWithResponse(7, 20)) + then: + clearRangeErrorVerifier.verifyErrorSatisfies { + FileTestHelper.assertExceptionStatusCodeAndMessage(it, 416, StorageErrorCode.INVALID_RANGE) + } + cleanup: + fullInfoData.clear() + } + + def "Upload file does not exist"() { + given: + def uploadFile = new File(testFolder.getPath() + "/fakefile.txt") + + if (uploadFile.exists()) { + assert uploadFile.delete() + } + + when: + def uploadFromFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.uploadFromFile(uploadFile.getPath())) + + then: + uploadFromFileErrorVerifier.verifyErrorSatisfies({ it instanceof NoSuchFileException }) + + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.getPath()) + } + + def "Upload and download file exists"() { + given: + def data = "Download file exists" + def downloadFile = new File(String.format("%s/%s.txt", testFolder.getPath(), methodName)) + + if (!downloadFile.exists()) { + assert downloadFile.createNewFile() + } + + primaryFileAsyncClient.create(data.length()).block() + primaryFileAsyncClient.upload(Flux.just(ByteBuffer.wrap(data.getBytes(StandardCharsets.UTF_8))), data.length()).block() + + when: + def downloadToFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.downloadToFile(downloadFile.getPath())) + + then: + downloadToFileErrorVerifier.verifyErrorSatisfies({ it instanceof FileAlreadyExistsException }) + + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.getPath()) + } + + def "Upload and download to file does not exist"() { + given: + def data = "Download file does not exist" + def downloadFile = new File(String.format("%s/%s.txt", testFolder.getPath(), methodName)) + + if (downloadFile.exists()) { + assert downloadFile.delete() + } + + primaryFileAsyncClient.create(data.length()).block() + primaryFileAsyncClient.upload(Flux.just(ByteBuffer.wrap(data.getBytes(StandardCharsets.UTF_8))), data.length()).block() + + when: + def downloadFromFileVerifier = StepVerifier.create(primaryFileAsyncClient.downloadToFile(downloadFile.getPath())) + + then: + downloadFromFileVerifier.verifyComplete() + def scanner = new Scanner(downloadFile).useDelimiter("\\Z") + data == scanner.next() + scanner.close() + + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.getPath()) + } + + def "Start copy"() { + given: + primaryFileAsyncClient.create(1024).block() + // TODO: Need another test account if using SAS token for authentication. + // TODO: SasToken auth cannot be used until the logging redaction + def sourceURL = primaryFileAsyncClient.getFileUrl().toString() + "/" + shareName + "/" + filePath + when: + def copyInfoVerifier = StepVerifier.create(primaryFileAsyncClient.startCopyWithResponse(sourceURL, null)) + then: + copyInfoVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + assert it.value().copyId() != null + }.verifyComplete() + } + + def "Start copy error"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def startCopyErrorVerifier = StepVerifier.create(primaryFileAsyncClient.startCopyWithResponse("some url", testMetadata)) + then: + startCopyErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + } + + @Ignore + def "Abort copy"() { + //TODO: Need to find a way of mocking pending copy status + } + + def "Delete file"() { + given: + primaryFileAsyncClient.create(1024).block() + expect: + StepVerifier.create(primaryFileAsyncClient.deleteWithResponse()) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete file error"() { + when: + def deleteFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.delete()) + then: + deleteFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def getPropertiesVerifier = StepVerifier.create(primaryFileAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().eTag() + assert it.value().lastModified() + assert it.value().lastModified() + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + } + } + + def "Get properties error"() { + when: + def getProperitesErrorVerifier = StepVerifier.create(primaryFileAsyncClient.getProperties()) + then: + getProperitesErrorVerifier.verifyErrorSatisfies { + assert it instanceof HttpResponseException + } + } + + def "Set httpHeaders fpk"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null, null, null).block() + def filePermissionKey = shareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + + expect: + StepVerifier.create(primaryFileAsyncClient.setPropertiesWithResponse(512, httpHeaders, smbProperties, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Set httpHeaders fp"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null, null, null).block() + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + + expect: + StepVerifier.create(primaryFileAsyncClient.setPropertiesWithResponse(512, httpHeaders, smbProperties, filePermission)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().smbProperties() + assert it.value().smbProperties().filePermissionKey() + assert it.value().smbProperties().ntfsFileAttributes() + assert it.value().smbProperties().fileLastWriteTime() + assert it.value().smbProperties().fileCreationTime() + assert it.value().smbProperties().fileChangeTime() + assert it.value().smbProperties().parentId() + assert it.value().smbProperties().fileId() + }.verifyComplete() + } + + def "Set httpHeaders error"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null, null, null).block() + when: + def setHttpHeaderVerifier = StepVerifier.create(primaryFileAsyncClient.setProperties(-1, null, null, null)) + then: + setHttpHeaderVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + } + + def "Set metadata"() { + given: + + primaryFileAsyncClient.createWithResponse(1024, httpHeaders, null, null, testMetadata).block() + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryFileAsyncClient.getProperties()) + def setPropertiesVerifier = StepVerifier.create(primaryFileAsyncClient.setMetadataWithResponse(updatedMetadata)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryFileAsyncClient.getProperties()) + then: + getPropertiesBeforeVerifier.assertNext { + assert testMetadata.equals(it.metadata()) + }.verifyComplete() + setPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert updatedMetadata.equals(it.metadata()) + }.verifyComplete() + } + + def "Set metadata error"() { + given: + primaryFileAsyncClient.create(1024).block() + def errorMetadata = Collections.singletonMap("", "value") + when: + def setMetadataErrorVerifier = StepVerifier.create(primaryFileAsyncClient.setMetadataWithResponse(errorMetadata)) + then: + setMetadataErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "List ranges"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null, null, null).block() + def fileName = testResourceName.randomName("file", 60) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileAsyncClient.uploadFromFile(uploadFile).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listRanges()) + .assertNext { + assert it.start() == 0 + assert it.end() == 1023 + }.verifyComplete() + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List ranges with range"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null, null, null).block() + def fileName = testResourceName.randomName("file", 60) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileAsyncClient.uploadFromFile(uploadFile).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listRanges(new FileRange(0, 511L))) + .assertNext { + assert it.start() == 0 + assert it.end() == 511 + }.verifyComplete() + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List handles"() { + given: + primaryFileAsyncClient.create(1024).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listHandles()) + .verifyComplete() + } + + def "List handles with maxResult"() { + given: + primaryFileAsyncClient.create(1024).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listHandles(2)) + .verifyComplete() + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = fileBuilderHelper(interceptorManager, shareName, filePath).snapshot(snapshot).buildFileAsyncClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileSASTests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileSASTests.groovy new file mode 100644 index 000000000000..48912756114f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileSASTests.groovy @@ -0,0 +1,324 @@ +package com.azure.storage.file.spock + +import com.azure.storage.common.AccountSASPermission +import com.azure.storage.common.AccountSASResourceType +import com.azure.storage.common.AccountSASService +import com.azure.storage.common.Constants +import com.azure.storage.common.IPRange +import com.azure.storage.common.SASProtocol +import com.azure.storage.common.credentials.SASTokenCredential +import com.azure.storage.file.FileClient +import com.azure.storage.file.FileSASPermission +import com.azure.storage.file.FileServiceClient +import com.azure.storage.file.FileServiceSASSignatureValues +import com.azure.storage.file.ShareClient +import com.azure.storage.file.ShareSASPermission +import com.azure.storage.file.models.AccessPolicy +import com.azure.storage.file.models.SignedIdentifier +import com.azure.storage.file.models.StorageException +import spock.lang.Unroll + +import java.nio.ByteBuffer +import java.time.OffsetDateTime + +class FileSASTests extends APISpec { + + private FileClient primaryFileClient + private ShareClient primaryShareClient + private FileServiceClient primaryFileServiceClient + + private String shareName = "sharename" + private String filePath = "filename" + + def setup() { + primaryFileServiceClient = fileServiceBuilderHelper(interceptorManager).buildClient() + primaryShareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + primaryFileClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildFileClient() + + } + + @Unroll + def "FileSASPermissions toString"() { + setup: + def perms = new FileSASPermission() + .read(read) + .write(write) + .delete(delete) + .create(create) + + expect: + perms.toString() == expectedString + + where: + read | write | delete | create || expectedString + true | false | false | false || "r" + false | true | false | false || "w" + false | false | true | false || "d" + false | false | false | true || "c" + true | true | true | true || "rcwd" + } + + @Unroll + def "FileSASPermissions parse"() { + when: + def perms = FileSASPermission.parse(permString) + + then: + perms.read() == read + perms.write() == write + perms.delete() == delete + perms.create() == create + + where: + permString || read | write | delete | create + "r" || true | false | false | false + "w" || false | true | false | false + "d" || false | false | true | false + "c" || false | false | false | true + "rcwd" || true | true | true | true + "dcwr" || true | true | true | true + } + + def "FileSASPermissions parse IA"() { + when: + FileSASPermission.parse("rwaq") + + then: + thrown(IllegalArgumentException) + } + + @Unroll + def "ShareSASPermissions toString"() { + setup: + def perms = new ShareSASPermission() + .read(read) + .write(write) + .delete(delete) + .create(create) + .list(list) + + expect: + perms.toString() == expectedString + + where: + read | write | delete | create | list || expectedString + true | false | false | false | false || "r" + false | true | false | false | false || "w" + false | false | true | false | false || "d" + false | false | false | true | false || "c" + false | false | false | false | true || "l" + true | true | true | true | true || "rcwdl" + } + + @Unroll + def "ShareSASPermissions parse"() { + when: + def perms = ShareSASPermission.parse(permString) + + then: + perms.read() == read + perms.write() == write + perms.delete() == delete + perms.create() == create + perms.list() == list + + where: + permString || read | write | delete | create | list + "r" || true | false | false | false | false + "w" || false | true | false | false | false + "d" || false | false | true | false | false + "c" || false | false | false | true | false + "l" || false | false | false | false | true + "rcwdl" || true | true | true | true | true + "dcwrl" || true | true | true | true | true + } + + def "ShareSASPermissions parse IA"() { + when: + ShareSASPermission.parse("rwaq") + + then: + thrown(IllegalArgumentException) + } + + def "serviceSASSignatureValues canonicalizedResource"() { + setup: + def fileName = primaryFileClient.fileAsyncClient.filePath + def shareName = primaryFileClient.fileAsyncClient.shareName + def accountName = "account" + + when: + def serviceSASSignatureValues = primaryFileClient.fileAsyncClient.configureServiceSASSignatureValues(new FileServiceSASSignatureValues(), accountName) + + then: + serviceSASSignatureValues.canonicalName() == "/file/" + accountName + "/" + shareName + "/" + fileName + } + + def "FileSAS network test download upload"() { + setup: + String data = "test" + primaryFileClient.create(Constants.KB) + primaryFileClient.upload(ByteBuffer.wrap(data.getBytes()), (long) data.length()) + + def permissions = new FileSASPermission() + .read(true) + .write(true) + .create(true) + .delete(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") + def sasProtocol = SASProtocol.HTTPS_HTTP + def cacheControl = "cache" + def contentDisposition = "disposition" + def contentEncoding = "encoding" + def contentLanguage = "language" + def contentType = "type" + + when: + def sas = primaryFileClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + + then: + sas != null + + when: + def client = fileBuilderHelper(interceptorManager, shareName, filePath) + .endpoint(primaryFileClient.getFileUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sas)) + .buildFileClient() + + def downloadResponse = client.downloadWithProperties() + + def responseBody = downloadResponse.body().toIterable().iterator().next() + + client.upload(ByteBuffer.wrap(data.getBytes()), (long) data.length()) + + then: + notThrown(StorageException) + for(int i = 0; i < data.length(); i++) { + responseBody.get(i) == data.getBytes()[i] + } + } + + def "FileSAS network test upload fails"() { + setup: + String data = "test" + primaryFileClient.create(Constants.KB) + + def permissions = new FileSASPermission() + .read(true) + .write(false) + .create(true) + .delete(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") + def sasProtocol = SASProtocol.HTTPS_HTTP + def cacheControl = "cache" + def contentDisposition = "disposition" + def contentEncoding = "encoding" + def contentLanguage = "language" + def contentType = "type" + + when: + def sas = primaryFileClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + + def client = fileBuilderHelper(interceptorManager, shareName, filePath) + .endpoint(primaryFileClient.getFileUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sas)) + .buildFileClient() + + client.upload(ByteBuffer.wrap(data.getBytes()), (long) data.length()) + + then: + thrown(StorageException) + + when: + client.delete() + + then: + notThrown(StorageException) + } + + def "ShareSAS network test identifier permissions create delete"() { + setup: + SignedIdentifier identifier = new SignedIdentifier() + .id("0000") + .accessPolicy(new AccessPolicy().permission("rcwdl") + .expiry(getUTCNow().plusDays(1))) + + primaryShareClient.setAccessPolicy(Arrays.asList(identifier)) + + // Check containerSASPermissions + ShareSASPermission permissions = new ShareSASPermission() + .read(true) + .write(true) + .create(true) + .delete(true) + .list(true) + + OffsetDateTime expiryTime = getUTCNow().plusDays(1) + + when: + String sasWithId = primaryShareClient.generateSAS(identifier.id()) + + ShareClient client1 = shareBuilderHelper(interceptorManager, primaryShareClient.client.shareName) + .endpoint(primaryShareClient.getShareUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sasWithId)) + .buildClient() + + client1.createDirectory("dir") + client1.deleteDirectory("dir") + + String sasWithPermissions = primaryShareClient.generateSAS(expiryTime, permissions) + + def client2 = shareBuilderHelper(interceptorManager, primaryShareClient.client.shareName) + .endpoint(primaryFileClient.getFileUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sasWithPermissions)) + .buildClient() + + client2.createDirectory("dir") + client2.deleteDirectory("dir") + + then: + notThrown(StorageException) + } + + def "AccountSAS FileService network test create delete share succeeds"() { + setup: + def service = new AccountSASService() + .file(true) + def resourceType = new AccountSASResourceType() + .container(true) + .service(true) + .object(true) + def permissions = new AccountSASPermission() + .read(true) + .create(true) + .delete(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sas = primaryFileServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + + then: + sas != null + + when: + def scBuilder = fileServiceBuilderHelper(interceptorManager) + scBuilder.endpoint(primaryFileServiceClient.getFileServiceUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sas)) + def sc = scBuilder.buildClient() + sc.createShare("create") + sc.deleteShare("create") + + then: + notThrown(StorageException) + } + + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAPITests.groovy new file mode 100644 index 000000000000..702ca5e4ffe0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAPITests.groovy @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.CorsRule +import com.azure.storage.file.models.FileServiceProperties +import com.azure.storage.file.models.ListSharesOptions +import com.azure.storage.file.models.Metrics +import com.azure.storage.file.models.RetentionPolicy +import com.azure.storage.file.models.ShareItem +import com.azure.storage.file.models.ShareProperties +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageException +import spock.lang.Unroll + +class FileServiceAPITests extends APISpec { + def shareName + + static def testMetadata = Collections.singletonMap("testmetadata", "value") + static def reallyLongString = "thisisareallylongstringthatexceedsthe64characterlimitallowedoncertainproperties" + static def TOO_MANY_RULES = new ArrayList<>() + static def INVALID_ALLOWED_HEADER = Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString)) + static def INVALID_EXPOSED_HEADER = Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString)) + static def INVALID_ALLOWED_ORIGIN = Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString)) + static def INVALID_ALLOWED_METHOD = Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD")) + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceClient = fileServiceBuilderHelper(interceptorManager).buildClient() + for (int i = 0; i < 6; i++) { + TOO_MANY_RULES.add(new CorsRule()) + } + } + + def "Get file service URL"() { + given: + def accountName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accountName) + when: + def fileServiceURL = primaryFileServiceClient.getFileServiceUrl().toString() + then: + expectURL.equals(fileServiceURL) + } + + def "Get share does not create a share"() { + given: + def shareClient = primaryFileServiceClient.getShareClient(shareName) + expect: + shareClient instanceof ShareClient + } + + def "Create share"() { + when: + def createShareResponse = primaryFileServiceClient.createShareWithResponse(shareName, null, null, null) + then: + FileTestHelper.assertResponseStatusCode(createShareResponse, 201) + } + + def "Create share max overloads"() { + when: + def createShareResponse = primaryFileServiceClient.createShareWithResponse(shareName, testMetadata, 1, null) + then: + FileTestHelper.assertResponseStatusCode(createShareResponse, 201) + } + + @Unroll + def "Create share with invalid args"() { + when: + primaryFileServiceClient.createShareWithResponse(shareName, metadata, quota, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + metadata | quota | statusCode | errMsg + Collections.singletonMap("invalid#", "value") | 1 | 400 | StorageErrorCode.INVALID_METADATA + testMetadata | -1 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Delete share"() { + given: + primaryFileServiceClient.createShare(shareName) + when: + def deleteShareResponse = primaryFileServiceClient.deleteShareWithResponse(shareName, null, null) + then: + FileTestHelper.assertResponseStatusCode(deleteShareResponse, 202) + } + + def "Delete share does not exist"() { + when: + primaryFileServiceClient.deleteShare(testResourceName.randomName(methodName, 60)) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + @Unroll + def "List shares with filter"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().properties(new ShareProperties().quota(i + 1)).name(shareName + i) + if (i == 2) { + share.metadata(testMetadata) + } + + testShares.add(share) + primaryFileServiceClient.createShareWithResponse(share.name(), share.metadata(), share.properties().quota(), null) + } + when: + def shares = primaryFileServiceClient.listShares(options).iterator() + then: + for (int i = 0; i < limits; i++) { + FileTestHelper.assertSharesAreEqual(testShares.pop(), shares.next(), includeMetadata, includeSnapshot) + } + !shares.hasNext() + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter") | 3 | false | true + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter").includeMetadata(true) | 3 | true | true + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter").includeMetadata(false) | 3 | false | true + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter").maxResults(2) | 3 | false | true + } + + @Unroll + def "List shares with args"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().name(shareName + i).properties(new ShareProperties().quota(2)) + .metadata(testMetadata) + def shareClient = primaryFileServiceClient.getShareClient(share.name()) + shareClient.createWithResponse(share.metadata(), share.properties().quota(), null) + if (i == 2) { + def snapshot = shareClient.createSnapshot().snapshot() + testShares.add(new ShareItem().name(share.name()).metadata(share.metadata()).properties(share.properties()).snapshot(snapshot)) + } + testShares.add(share) + } + when: + def shares = primaryFileServiceClient.listShares(options).iterator() + then: + for (int i = 0; i < limits; i++) { + FileTestHelper.assertSharesAreEqual(testShares.pop(), shares.next(), includeMetadata, includeSnapshot) + } + !shares.hasNext() + + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceapitestslistshareswithargs") | 3 | false | false + new ListSharesOptions().prefix("fileserviceapitestslistshareswithargs") .includeMetadata(true) | 3 | true | false + new ListSharesOptions().prefix("fileserviceapitestslistshareswithargs") .includeMetadata(true).includeSnapshots(true) | 4 | true | true + } + + def "Set and get properties"() { + given: + def originalProperties = primaryFileServiceClient.getProperties() + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(new ArrayList<>()) + when: + def getPropertiesBeforeResponse = primaryFileServiceClient.getPropertiesWithResponse(null) + def setPropertiesResponse = primaryFileServiceClient.setPropertiesWithResponse(updatedProperties, null) + def getPropertiesAfterResponse = primaryFileServiceClient.getPropertiesWithResponse(null) + then: + FileTestHelper.assertResponseStatusCode(getPropertiesBeforeResponse, 200) + FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, getPropertiesBeforeResponse.value()) + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 202) + FileTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + FileTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, getPropertiesAfterResponse.value()) + } + + @Unroll + def "Set and get properties with invalid args"() { + given: + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + + when: + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(coreList) + primaryFileServiceClient.setProperties(updatedProperties) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + coreList | statusCode | errMsg + TOO_MANY_RULES | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_EXPOSED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_ORIGIN | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_METHOD | 400 | StorageErrorCode.INVALID_XML_NODE_VALUE + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAsyncAPITests.groovy new file mode 100644 index 000000000000..73c31276d1f0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAsyncAPITests.groovy @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.ShareAsyncClient +import com.azure.storage.file.models.CorsRule +import com.azure.storage.file.models.FileServiceProperties +import com.azure.storage.file.models.ListSharesOptions +import com.azure.storage.file.models.Metrics +import com.azure.storage.file.models.RetentionPolicy +import com.azure.storage.file.models.ShareItem +import com.azure.storage.file.models.ShareProperties +import com.azure.storage.file.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Unroll + +class FileServiceAsyncAPITests extends APISpec { + def shareName + + static def testMetadata = Collections.singletonMap("testmetadata", "value") + static def reallyLongString = "thisisareallylongstringthatexceedsthe64characterlimitallowedoncertainproperties" + static def TOO_MANY_RULES = new ArrayList<>() + static def INVALID_ALLOWED_HEADER = Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString)) + static def INVALID_EXPOSED_HEADER = Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString)) + static def INVALID_ALLOWED_ORIGIN = Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString)) + static def INVALID_ALLOWED_METHOD = Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD")) + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceAsyncClient = fileServiceBuilderHelper(interceptorManager).buildAsyncClient() + for (int i = 0; i < 6; i++) { + TOO_MANY_RULES.add(new CorsRule()) + } + } + + def "Get file service URL"() { + given: + def accountName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accountName) + when: + def fileServiceURL = primaryFileServiceAsyncClient.getFileServiceUrl().toString() + then: + expectURL.equals(fileServiceURL) + } + + def "Get share does not create a share"() { + when: + def shareAsyncClient = primaryFileServiceAsyncClient.getShareAsyncClient(shareName) + then: + shareAsyncClient instanceof ShareAsyncClient + } + + def "Create share"() { + when: + def createShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.createShareWithResponse(shareName, null, null)) + then: + createShareVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create share with metadata"() { + when: + def createShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.createShareWithResponse(shareName, metadata, quota)) + then: + createShareVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + } + where: + metadata | quota + null | null + testMetadata | null + null | 1 + testMetadata | 1 + } + + @Unroll + def "Create share with invalid args"() { + when: + def createShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.createShareWithResponse(shareName, metadata, quota)) + then: + createShareVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + metadata | quota | statusCode | errMsg + Collections.singletonMap("invalid#", "value") | 1 | 400 | StorageErrorCode.INVALID_METADATA + testMetadata | -1 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + testMetadata | 0 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + testMetadata | 5200 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Delete share"() { + given: + primaryFileServiceAsyncClient.createShare(shareName) + when: + def deleteShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.deleteShareWithResponse(shareName, null)) + then: + deleteShareVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + } + } + + def "Delete share does not exist"() { + when: + def deleteShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.deleteShare(testResourceName.randomName(methodName, 60))) + then: + deleteShareVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + @Unroll + def "List shares with filter"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().name(shareName + i).properties(new ShareProperties().quota(i + 1)) + if (i == 2) { + share.metadata(testMetadata) + } + testShares.add(share) + primaryFileServiceAsyncClient.createShareWithResponse(share.name(), share.metadata(), share.properties().quota()).block() + } + + when: + def sharesVerifier = StepVerifier.create(primaryFileServiceAsyncClient.listShares(options)) + + then: + sharesVerifier.thenConsumeWhile { + FileTestHelper.assertSharesAreEqual(testShares.pop(), it, includeMetadata, includeSnapshot) + }.verifyComplete() + + for (int i = 0; i < 3 - limits; i++) { + testShares.pop() + } + + testShares.isEmpty() + + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter") | 3 | false | true + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter").includeMetadata(true) | 3 | true | true + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter").includeMetadata(false) | 3 | false | true + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter").maxResults(2) | 3 | false | true + } + + @Unroll + def "List shares with args"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().name(shareName + i).properties(new ShareProperties().quota(2)) + .metadata(testMetadata) + def shareAsyncClient = primaryFileServiceAsyncClient.getShareAsyncClient(share.name()) + shareAsyncClient.createWithResponse(share.metadata(), share.properties().quota()).block() + if (i == 2) { + StepVerifier.create(shareAsyncClient.createSnapshotWithResponse(null)) + .assertNext { + testShares.add(new ShareItem().name(share.name()).metadata(share.metadata()).properties(share.properties()).snapshot(it.value().snapshot())) + FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + testShares.add(share) + } + when: + def sharesVerifier = StepVerifier.create(primaryFileServiceAsyncClient.listShares(options)) + then: + sharesVerifier.assertNext { + assert FileTestHelper.assertSharesAreEqual(testShares.pop(), it, includeMetadata, includeSnapshot) + }.expectNextCount(limits - 1).verifyComplete() + + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithargs") | 3 | false | false + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithargs").includeMetadata(true) | 3 | true | false + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithargs").includeMetadata(true).includeSnapshots(true) | 4 | true | true + } + + def "Set and get properties"() { + given: + def originalProperties = primaryFileServiceAsyncClient.getProperties().block() + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(new ArrayList<>()) + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryFileServiceAsyncClient.getPropertiesWithResponse()) + def setPropertiesVerifier = StepVerifier.create(primaryFileServiceAsyncClient.setPropertiesWithResponse(updatedProperties)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryFileServiceAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesBeforeVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, it.value()) + }.verifyComplete() + setPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + } + + getPropertiesAfterVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, it.value()) + }.verifyComplete() + } + + @Unroll + def "Set and get properties with invalid args"() { + given: + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + + when: + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(coreList) + def setPropertyVerifier = StepVerifier.create(primaryFileServiceAsyncClient.setProperties(updatedProperties)) + then: + setPropertyVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + coreList | statusCode | errMsg + TOO_MANY_RULES | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_EXPOSED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_ORIGIN | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_METHOD | 400 | StorageErrorCode.INVALID_XML_NODE_VALUE + + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileTestHelper.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileTestHelper.groovy new file mode 100644 index 000000000000..4fc58b325adf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileTestHelper.groovy @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.http.rest.Response +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.core.util.logging.ClientLogger +import com.azure.storage.file.models.CorsRule +import com.azure.storage.file.models.FileServiceProperties +import com.azure.storage.file.models.Metrics +import com.azure.storage.file.models.RetentionPolicy +import com.azure.storage.file.models.ShareItem +import com.azure.storage.file.models.SignedIdentifier +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageException +import com.azure.storage.file.models.StorageServiceProperties + +import java.nio.file.Files +import java.nio.file.Paths +import java.security.NoSuchAlgorithmException +import java.time.Duration + +class FileTestHelper { + private static final ClientLogger logger = new ClientLogger(FileTestHelper.class) + + static boolean assertResponseStatusCode(Response response, int expectedStatusCode) { + return expectedStatusCode == response.statusCode() + } + + static boolean assertExceptionStatusCodeAndMessage(T throwable, int expectedStatusCode, StorageErrorCode errMessage) { + return assertExceptionStatusCode(throwable, expectedStatusCode) && assertExceptionErrorMessage(throwable, errMessage) + } + + static boolean assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { + return throwable instanceof StorageException && + ((StorageException) throwable).statusCode() == expectedStatusCode + } + + static boolean assertExceptionErrorMessage(Throwable throwable, StorageErrorCode errMessage) { + return throwable instanceof StorageException && + ((StorageException) throwable).errorCode() == errMessage + } + + static boolean assertFileServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()) && + assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()) && + assertCorsAreEqual(expected.cors(), actual.cors()) + } + } + + static boolean assertMetricsAreEqual(Metrics expected, Metrics actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.enabled(), actual.enabled()) && + Objects.equals(expected.includeAPIs(), actual.includeAPIs()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.days(), actual.days()) && + Objects.equals(expected.enabled(), actual.enabled()) + } + } + + 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.allowedHeaders(), actual.allowedHeaders()) && + Objects.equals(expected.allowedMethods(), actual.allowedMethods()) && + Objects.equals(expected.allowedOrigins(), actual.allowedOrigins()) && + Objects.equals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()) + } + } + + static boolean assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { + if (expected == null) { + return actual == null + } + if (expected.accessPolicy() == null) { + return actual.accessPolicy() == null + } + return Objects.equals(expected.id(), actual.id()) && + Objects.equals(expected.accessPolicy().permission(), actual.accessPolicy().permission()) && + Objects.equals(expected.accessPolicy().start(), actual.accessPolicy().start()) && + Objects.equals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()) + } + + 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 + } + } + + static boolean assertSharesAreEqual(ShareItem expected, ShareItem actual, boolean includeMetadata, boolean includeSnapshot) { + if (expected == null) { + return actual == null + } else { + if (!Objects.equals(expected.name(), actual.name())) { + return false + } + + if (includeMetadata && !Objects.equals(expected.metadata(), actual.metadata())) { + return false + } + if (includeSnapshot && !Objects.equals(expected.snapshot(), actual.snapshot())) { + return false + } + + if (expected.properties() == null) { + return actual.properties() == null + } else { + return Objects.equals(expected.properties().quota(), actual.properties().quota()) + } + } + } + + static boolean assertFileServicePropertiesAreEqual(FileServiceProperties expected, FileServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()) && + assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()) && + assertCorsAreEqual(expected.cors(), actual.cors()) + } + } + + static boolean assertTwoFilesAreSame(File f1, File f2) throws IOException, NoSuchAlgorithmException { + List uploadFileString = Files.readAllLines(f1.toPath()) + List downloadFileString = Files.readAllLines(f2.toPath()) + if (uploadFileString != null && downloadFileString != null) { + downloadFileString.removeAll(uploadFileString) + } + while (!downloadFileString.isEmpty()) { + if (!downloadFileString.get(0).trim().isEmpty()) { + return false + } + downloadFileString.remove(0) + } + return true + } + + static String createRandomFileWithLength(int size, String folder, String fileName) { + def path = Paths.get(folder) + if (path == null) { + throw logger.logExceptionAsError(new RuntimeException("The folder path does not exist.")) + } + + if (!Files.exists(path)) { + Files.createDirectory(path) + } + def randomFile = new File(folder, fileName) + RandomAccessFile raf = new RandomAccessFile(randomFile, "rw") + raf.setLength(size) + raf.close() + return randomFile.getPath() + } + + static void deleteFolderIfExists(String folder) { + // Clean up all temporary generated files + def dir = new File(folder) + if (dir.isDirectory()) { + File[] children = dir.listFiles() + for (int i = 0; i < children.length; i++) { + Files.delete(children[i].toPath()) + } + } + } + + // TODO : Move this into a common package test class? + static byte[] getRandomBuffer(int length) { + final Random randGenerator = new Random() + final byte[] buff = new byte[length] + randGenerator.nextBytes(buff) + return buff + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAPITests.groovy new file mode 100644 index 000000000000..d473b8db5ba7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAPITests.groovy @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryClient +import com.azure.storage.file.FileClient +import com.azure.storage.file.FileSmbProperties +import com.azure.storage.file.ShareClient +import com.azure.storage.file.ShareClientBuilder +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.NtfsFileAttributes +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageException +import spock.lang.Ignore +import spock.lang.Requires +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class ShareAPITests extends APISpec { + ShareClient primaryShareClient + def shareName + static def testMetadata + static def smbProperties + static def filePermission = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL" + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceClient = fileServiceBuilderHelper(interceptorManager).buildClient() + primaryShareClient = primaryFileServiceClient.getShareClient(shareName) + testMetadata = Collections.singletonMap("testmetadata", "value") + smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL)) + } + + def "Get share URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def shareURL = primaryShareClient.getShareUrl().toString() + then: + expectURL.equals(shareURL) + } + + def "Get root directory client"() { + given: + def directoryClient = primaryShareClient.getRootDirectoryClient() + expect: + directoryClient instanceof DirectoryClient + } + + def "Get file client does not create a file"() { + given: + def fileClient = primaryShareClient.getFileClient("testFile") + expect: + fileClient instanceof FileClient + } + + def "Create share"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.createWithResponse(null, null, null), 201) + } + + @Unroll + def "Create share with args"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.createWithResponse(metadata, quota, null), 201) + where: + metadata | quota + null | null + null | 1 + testMetadata | null + testMetadata | 1 + } + + @Unroll + def "Create share with invalid args"() { + when: + primaryShareClient.createWithResponse(metadata, quota, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMessage) + where: + metadata | quota | statusCode | errMessage + Collections.singletonMap("", "value") | 1 | 400 | StorageErrorCode.EMPTY_METADATA_KEY + Collections.singletonMap("metadata!", "value") | 1 | 400 | StorageErrorCode.INVALID_METADATA + testMetadata | 6000 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Create snapshot"() { + given: + primaryShareClient.create() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotResponse = primaryShareClient.createSnapshotWithResponse(null, null) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(createSnapshotResponse.value().snapshot()).buildClient() + then: + Objects.equals(createSnapshotResponse.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + } + + def "Create snapshot error"() { + when: + primaryShareClient.createSnapshot() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Create snapshot metadata"() { + given: + primaryShareClient.create() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotResponse = primaryShareClient.createSnapshotWithResponse(testMetadata, null) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(createSnapshotResponse.value().snapshot()).buildClient() + then: + Objects.equals(createSnapshotResponse.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + } + + def "Create snapshot metadata error"() { + when: + primaryShareClient.createSnapshotWithResponse(Collections.singletonMap("", "value"), null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "Delete share"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.deleteWithResponse(null), 202) + } + + def "Delete share error"() { + when: + primaryShareClient.delete() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Get properties"() { + given: + primaryShareClient.createWithResponse(testMetadata, 1, null) + when: + def getPropertiesResponse = primaryShareClient.getPropertiesWithResponse(null) + then: + FileTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + testMetadata.equals(getPropertiesResponse.value().metadata()) + getPropertiesResponse.value().quota() == 1L + } + + def "Get properties error"() { + when: + primaryShareClient.getProperties() + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Set quota"() { + given: + primaryShareClient.createWithResponse(null, 1, null) + when: + def getQuotaBeforeResponse = primaryShareClient.getProperties() + def setQuotaResponse = primaryShareClient.setQuotaWithResponse(2, null) + def getQuotaAfterResponse = primaryShareClient.getProperties() + then: + getQuotaBeforeResponse.quota() == 1 + FileTestHelper.assertResponseStatusCode(setQuotaResponse, 200) + getQuotaAfterResponse.quota() == 2 + } + + def "Set quota error"() { + when: + primaryShareClient.setQuota(2) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Set metadata"() { + given: + primaryShareClient.createWithResponse(testMetadata, null, null) + def metadataAfterSet = Collections.singletonMap("afterset", "value") + when: + def getMetadataBeforeResponse = primaryShareClient.getProperties() + def setMetadataResponse = primaryShareClient.setMetadataWithResponse(metadataAfterSet, null) + def getMetadataAfterResponse = primaryShareClient.getProperties() + then: + testMetadata.equals(getMetadataBeforeResponse.metadata()) + FileTestHelper.assertResponseStatusCode(setMetadataResponse, 200) + metadataAfterSet.equals(getMetadataAfterResponse.metadata()) + } + + def "Set metadata error"() { + when: + primaryShareClient.setMetadata(testMetadata) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Create directory"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createDirectoryWithResponse("testCreateDirectory", null, null, null, null), 201) + } + + def "Create directory file permission"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createDirectoryWithResponse("testCreateDirectory", null, filePermission, null, null), 201) + } + + def "Create directory file permission key"() { + given: + primaryShareClient.create() + def filePermissionKey = primaryShareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createDirectoryWithResponse("testCreateDirectory", smbProperties, null, null, null), 201) + } + + def "Create directory invalid name"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createDirectory("test/directory") + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + + def "Create directory metadata"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createDirectoryWithResponse("testCreateDirectory", null, null, testMetadata, null), 201) + } + + def "Create directory metadata error"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createDirectoryWithResponse("testdirectory", null, null, Collections.singletonMap("", "value"), null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "Create file"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createFileWithResponse("testCreateFile", 1024, null, null, null, null, null), 201) + } + + def "Create file file permission"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createFileWithResponse("testCreateFile", 1024, null, null, filePermission, null, null), 201) + } + + def "Create file file permission key"() { + given: + primaryShareClient.create() + def filePermissionKey = primaryShareClient.createPermission(filePermission) + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(filePermissionKey) + + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createFileWithResponse("testCreateFile", 1024, null, smbProperties, null, null, null), 201) + } + + @Unroll + def "Create file invalid args"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createFileWithResponse(fileName, maxSize, null, null, null, null, null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + fileName | maxSize | statusCode | errMsg + "testfile:" | 1024 | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryShareClient.create() + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createFileWithResponse("testCreateFile", 1024, null, smbProperties, filePermission, testMetadata, null), 201) + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryShareClient.create() + + when: + primaryShareClient.createFileWithResponse(fileName, maxSize, httpHeaders, null, null, metadata, null) + + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, errMsg) + + where: + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + } + + def "Delete directory"() { + given: + def directoryName = "testCreateDirectory" + primaryShareClient.create() + primaryShareClient.createDirectory(directoryName) + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.deleteDirectoryWithResponse(directoryName, null), 202) + } + + def "Delete directory error"() { + given: + primaryShareClient.create() + when: + primaryShareClient.deleteDirectory("testdirectory") + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryShareClient.create() + primaryShareClient.createFile(fileName, 1024) + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.deleteFileWithResponse(fileName, null), 202) + } + + def "Delete file error"() { + given: + primaryShareClient.create() + when: + primaryShareClient.deleteFile("testdirectory") + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Create permission"() { + given: + primaryShareClient.create() + + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createPermissionWithResponse(filePermission, null), 201) + } + + // Only run this test in live mode as BlobOutputStream dynamically assigns blocks + @Ignore + def "Create and get permission"() { + given: + primaryShareClient.create() + def permissionKey = primaryShareClient.createPermission(filePermission) + + when: + def permission = primaryShareClient.getPermission(permissionKey) + + then: + permission == filePermission + } + + def "Create permission error"() { + given: + primaryShareClient.create() + + when: + primaryShareClient.createPermissionWithResponse("abcde", null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.FILE_INVALID_PERMISSION) + } + + def "Get permission error"() { + given: + primaryShareClient.create() + + when: + primaryShareClient.getPermissionWithResponse("abcde", null) + then: + def e = thrown(StorageException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = shareBuilderHelper(interceptorManager, shareName).snapshot(snapshot).buildClient() + then: + snapshot.equals(shareSnapshotClient.getSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAsyncAPITests.groovy new file mode 100644 index 000000000000..4986731f32c9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAsyncAPITests.groovy @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryAsyncClient +import com.azure.storage.file.FileAsyncClient +import com.azure.storage.file.FileSmbProperties +import com.azure.storage.file.ShareAsyncClient +import com.azure.storage.file.ShareClientBuilder +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileProperties +import com.azure.storage.file.models.NtfsFileAttributes +import com.azure.storage.file.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Requires +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class ShareAsyncAPITests extends APISpec { + ShareAsyncClient primaryShareAsyncClient + def shareName + static def testMetadata + static def smbProperties + static def filePermission = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL" + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceAsyncClient = fileServiceBuilderHelper(interceptorManager).buildAsyncClient() + primaryShareAsyncClient = primaryFileServiceAsyncClient.getShareAsyncClient(shareName) + testMetadata = Collections.singletonMap("testmetadata", "value") + smbProperties = new FileSmbProperties() + .ntfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL)) + } + + def "Get share URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def shareURL = primaryShareAsyncClient.getShareUrl().toString() + then: + expectURL.equals(shareURL) + } + + def "Get root directory client"() { + given: + def directoryClient = primaryShareAsyncClient.getRootDirectoryClient() + expect: + directoryClient instanceof DirectoryAsyncClient + } + + def "Get file client does not create a file"() { + given: + def fileClient = primaryShareAsyncClient.getFileClient("testFile") + expect: + fileClient instanceof FileAsyncClient + } + + def "Create share"() { + expect: + StepVerifier.create(primaryShareAsyncClient.createWithResponse(null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create share with args"() { + expect: + StepVerifier.create(primaryShareAsyncClient.createWithResponse(metadata, quota)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + where: + metadata | quota + null | null + null | 1 + testMetadata | null + testMetadata | 1 + } + + @Unroll + def "Create share with invalid args"() { + when: + def createShareVerifier = StepVerifier.create(primaryShareAsyncClient.createWithResponse(metadata, quota)) + then: + createShareVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMessage) + } + + where: + metadata | quota | statusCode | errMessage + Collections.singletonMap("", "value") | 1 | 400 | StorageErrorCode.EMPTY_METADATA_KEY + Collections.singletonMap("metadata!", "value") | 1 | 400 | StorageErrorCode.INVALID_METADATA + testMetadata | 6000 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Create snapshot"() { + given: + primaryShareAsyncClient.create().block() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshotWithResponse(null)) + + then: + createSnapshotVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(it.value().snapshot()).buildClient() + assert Objects.equals(it.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + }.verifyComplete() + + } + + def "Create snapshot error"() { + when: + def createShareShnapshotErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshot()) + then: + createShareShnapshotErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Create snapshot metadata"() { + given: + primaryShareAsyncClient.create().block() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshotWithResponse(testMetadata)) + then: + createSnapshotVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(it.value().snapshot()).buildClient() + assert Objects.equals(it.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + }.verifyComplete() + } + + def "Create snapshot metadata error"() { + when: + def createSnapshotErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshotWithResponse(Collections.singletonMap("", "value"))) + then: + createSnapshotErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "Delete share"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.deleteWithResponse()) + .assertNext { + FileTestHelper.assertResponseStatusCode(it, 201) + } + } + + def "Delete share error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.delete()) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + primaryShareAsyncClient.createWithResponse(testMetadata, 1).block() + when: + def getPropertiesVerifier = StepVerifier.create(primaryShareAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert testMetadata.equals(it.value().metadata()) + assert it.value().quota() == 1L + }.verifyComplete() + } + + def "Get properties error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.getProperties()) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Set quota"() { + given: + primaryShareAsyncClient.createWithResponse(null, 1).block() + when: + def getQuotaBeforeVerifier = StepVerifier.create(primaryShareAsyncClient.getProperties()) + def setQuotaVerifier = StepVerifier.create(primaryShareAsyncClient.setQuota(2)) + def getQuotaAfterVerifier = StepVerifier.create(primaryShareAsyncClient.getProperties()) + then: + getQuotaBeforeVerifier.assertNext { + assert it.quota() == 1 + } + setQuotaVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(setQuotaResponse, 200) + } + getQuotaAfterVerifier.assertNext { + assert it.quota() == 2 + } + } + + def "Set quota error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.setQuota(2)) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Set metadata"() { + given: + primaryShareAsyncClient.createWithResponse(testMetadata, null).block() + def metadataAfterSet = Collections.singletonMap("afterset", "value") + when: + def getMetadataBeforeVerifer = StepVerifier.create(primaryShareAsyncClient.getProperties()) + def setMetadataVerifier = StepVerifier.create(primaryShareAsyncClient.setMetadataWithResponse(metadataAfterSet)) + def getMetadataAfterVerifier = StepVerifier.create(primaryShareAsyncClient.getProperties()) + then: + getMetadataBeforeVerifer.assertNext { + assert testMetadata.equals(it.metadata()) + } + setMetadataVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + } + getMetadataAfterVerifier.assertNext { + assert metadataAfterSet.equals(it.metadata()) + } + } + + def "Set metadata error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.setMetadata(testMetadata)) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Create directory"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testCreateDirectory", null, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory invalid name"() { + given: + primaryShareAsyncClient.create().block() + when: + def createDirectoryVerifier = StepVerifier.create(primaryShareAsyncClient.createDirectory("test/directory")) + then: + createDirectoryVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + } + + def "Create directory metadata"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testCreateDirectory", null, null, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory file permission"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testCreateDirectory", null, filePermission, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory file permission key"() { + given: + primaryShareAsyncClient.create().block() + def permissionKey = primaryShareAsyncClient.createPermission(filePermission).block() + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(permissionKey) + expect: + StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testCreateDirectory", smbProperties, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory metadata error"() { + given: + primaryShareAsyncClient.create().block() + when: + def createDirErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testdirectory", null, null, Collections.singletonMap("", "value"))) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "Create file"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createFileWithResponse("testCreateFile", 1024, null, null, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create file file permission"() { + given: + primaryShareAsyncClient.create().block() + + expect: + StepVerifier.create(primaryShareAsyncClient.createFileWithResponse("testCreateFile", 1024, null, null, filePermission, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create file file permission key"() { + given: + primaryShareAsyncClient.create().block() + def permissionKey = primaryShareAsyncClient.createPermission(filePermission).block() + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + .filePermissionKey(permissionKey) + + expect: + StepVerifier.create(primaryShareAsyncClient.createFileWithResponse("testCreateFile", 1024, null, smbProperties, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file invalid args"() { + given: + primaryShareAsyncClient.create().block() + when: + def createFileErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createFileWithResponse(fileName, maxSize, null, null, null, null)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + fileName | maxSize | statusCode | errMsg + "testfile:" | 1024 | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryShareAsyncClient.create().block() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("txt") + smbProperties.fileCreationTime(getUTCNow()) + .fileLastWriteTime(getUTCNow()) + expect: + StepVerifier.create(primaryShareAsyncClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, smbProperties, filePermission, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryShareAsyncClient.create().block() + + when: + + def createFileVerifier = StepVerifier.create(primaryShareAsyncClient.createFileWithResponse(fileName, maxSize, httpHeaders, null, null, metadata)) + + then: + createFileVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, errMsg) + } + + where: + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + + } + + def "Delete directory"() { + given: + def directoryName = "testCreateDirectory" + primaryShareAsyncClient.create().block() + primaryShareAsyncClient.createDirectory(directoryName).block() + expect: + StepVerifier.create(primaryShareAsyncClient.deleteDirectoryWithResponse(directoryName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete directory error"() { + given: + primaryShareAsyncClient.create().block() + when: + def deleteDirErrorVerifier = StepVerifier.create(primaryShareAsyncClient.deleteDirectory("testdirectory")) + then: + deleteDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryShareAsyncClient.create().block() + primaryShareAsyncClient.createFile(fileName, 1024).block() + expect: + StepVerifier.create(primaryShareAsyncClient.deleteFileWithResponse(fileName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + + } + + def "Delete file error"() { + given: + primaryShareAsyncClient.create().block() + when: + def deleteFileErrorVerifier = StepVerifier.create(primaryShareAsyncClient.deleteFile("testdirectory")) + then: + deleteFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Create permission"() { + given: + primaryShareAsyncClient.create().block() + + expect: + StepVerifier.create(primaryShareAsyncClient.createPermissionWithResponse(filePermission)) + .assertNext() { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Ignore + def "Create and get permission"() { + given: + primaryShareAsyncClient.create().block() + def filePermissionKey = primaryShareAsyncClient.createPermission(filePermission).block() + + expect: + StepVerifier.create(primaryShareAsyncClient.getPermissionWithResponse(filePermissionKey)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + } + + def "Create permission error"() { + given: + primaryShareAsyncClient.create().block() + + expect: + // Invalid permission + StepVerifier.create(primaryShareAsyncClient.createPermissionWithResponse("abcde")) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.FILE_INVALID_PERMISSION) + } + } + + def "Get permission error"() { + given: + primaryShareAsyncClient.create().block() + + expect: + // Invalid permission key + StepVerifier.create(primaryShareAsyncClient.getPermissionWithResponse("abcde")) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = shareBuilderHelper(interceptorManager, shareName).snapshot(snapshot).buildAsyncClient() + then: + snapshot.equals(shareSnapshotClient.getSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectory.json new file mode 100644 index 000000000000..596b167cc844 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectory.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectory16319850e30f4984?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cee73288-165c-4e00-9e0d-5f08eb2232c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7B98B6BD\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b62-301a-000d-1e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:58 GMT", + "x-ms-client-request-id" : "cee73288-165c-4e00-9e0d-5f08eb2232c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectory16319850e30f4984/directoryapitestscreatedirectory5133917824bdaf39?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "416e6c7b-65c3-4259-aef9-c64bd50cb378" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:59.4274565Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:58 GMT", + "ETag" : "\"0x8D7325B7BA89B05\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:59.4274565Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b66-301a-000d-2044-645aef000000", + "x-ms-client-request-id" : "416e6c7b-65c3-4259-aef9-c64bd50cb378", + "x-ms-file-last-write-time" : "2019-09-05T23:47:59.4274565Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectory16319850e30f4984", "directoryapitestscreatedirectory5133917824bdaf39" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryError.json new file mode 100644 index 000000000000..1cd666d3f154 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectoryerror43847b7ef08451?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "034c98ac-788d-4f1a-ae3c-5f27aa90597c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7BD59906\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b6a-301a-000d-2344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:59 GMT", + "x-ms-client-request-id" : "034c98ac-788d-4f1a-ae3c-5f27aa90597c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectoryerror11375d11ffda6b/directoryapitestscreatedirectoryerror22427fd8092b5d?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4c2a4078-1d9d-4eaf-a2df-33f637d78bf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "07339b6e-301a-000d-2544-645aef000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:07339b6e-301a-000d-2544-645aef000000\nTime:2019-09-05T23:47:59.8283160Z", + "Date" : "Thu, 05 Sep 2019 23:47:59 GMT", + "x-ms-client-request-id" : "4c2a4078-1d9d-4eaf-a2df-33f637d78bf3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectoryerror43847b7ef08451", "directoryapitestscreatedirectoryerror22427fd8092b5d", "directoryapitestscreatedirectoryerror11375d11ffda6b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryErrorWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryErrorWithMetadata.json new file mode 100644 index 000000000000..472517d40872 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryErrorWithMetadata.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectoryerrorwithmetadata30321b37?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7a332b95-dd02-49a0-84c9-293c4ca6395e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7C4794B0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b77-301a-000d-2d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:59 GMT", + "x-ms-client-request-id" : "7a332b95-dd02-49a0-84c9-293c4ca6395e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectoryerrorwithmetadata30321b37/directoryapitestscreatedirectoryerrorwithmetadata852261d2?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7504bec0-e80d-4a0c-8f35-a86c1fcf8875" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "959", + "StatusCode" : "403", + "x-ms-request-id" : "07339b79-301a-000d-2e44-645aef000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:07339b79-301a-000d-2e44-645aef000000\nTime:2019-09-05T23:48:00.5663209ZThe MAC signature found in the HTTP request 'fdceDpxLUq90lMfGTWkfSAzE2d8yHdba4QsT83HxD/o=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 05 Sep 2019 23:48:00 GMT\n\n\n\n\n\nx-ms-client-request-id:7504bec0-e80d-4a0c-8f35-a86c1fcf8875\nx-ms-file-attributes:None\nx-ms-file-creation-time:Now\nx-ms-file-last-write-time:Now\nx-ms-file-permission:Inherit\nx-ms-meta-testmeta:value\nx-ms-version:2019-02-02\n/gapradev/directoryapitestscreatedirectoryerrorwithmetadata30321b37/directoryapitestscreatedirectoryerrorwithmetadata852261d2\nrestype:directory'.", + "Date" : "Thu, 05 Sep 2019 23:47:59 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectoryerrorwithmetadata30321b37", "directoryapitestscreatedirectoryerrorwithmetadata852261d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryPermissionAndKeyError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryPermissionAndKeyError0.json new file mode 100644 index 000000000000..296c893e7915 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryPermissionAndKeyError0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorypermissionandkeyerror049974?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b2db91c6-6589-477e-af2b-276685fc5265" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7D06EDD9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b8b-301a-000d-3e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:01 GMT", + "x-ms-client-request-id" : "b2db91c6-6589-477e-af2b-276685fc5265" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectorypermissionandkeyerror049974", "directoryapitestscreatedirectorypermissionandkeyerror011607" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryPermissionAndKeyError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryPermissionAndKeyError1.json new file mode 100644 index 000000000000..8706e38c8d96 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryPermissionAndKeyError1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorypermissionandkeyerror178714?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b8340824-ce1a-44a8-84ac-82b94aac8f6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7D321C47\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b90-301a-000d-4244-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:01 GMT", + "x-ms-client-request-id" : "b8340824-ce1a-44a8-84ac-82b94aac8f6b" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectorypermissionandkeyerror178714", "directoryapitestscreatedirectorypermissionandkeyerror151768" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithFilePermission.json new file mode 100644 index 000000000000..63402fc3703c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithFilePermission.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithfilepermission635199e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3ef36778-2fd9-45fe-be88-ce3237645c13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7C7EF893\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b7d-301a-000d-3244-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:00 GMT", + "x-ms-client-request-id" : "3ef36778-2fd9-45fe-be88-ce3237645c13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithfilepermission635199e/directoryapitestscreatedirectorywithfilepermission68499a9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "99bee2ca-6478-4ab9-b01b-f9fce99f4823" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:00.9354983Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:00 GMT", + "ETag" : "\"0x8D7325B7C8EB6E7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:00.9354983Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b7f-301a-000d-3344-645aef000000", + "x-ms-client-request-id" : "99bee2ca-6478-4ab9-b01b-f9fce99f4823", + "x-ms-file-last-write-time" : "2019-09-05T23:48:00.9354983Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectorywithfilepermission635199e", "directoryapitestscreatedirectorywithfilepermission68499a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithFilePermissionKey.json new file mode 100644 index 000000000000..4555b67b52f5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithFilePermissionKey.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithfilepermissionkey844023?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "144a6217-e435-488d-9b21-73dbd490bdc5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7CBAC928\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b83-301a-000d-3744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:00 GMT", + "x-ms-client-request-id" : "144a6217-e435-488d-9b21-73dbd490bdc5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithfilepermissionkey844023?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "77a95f83-10e6-4e89-845b-4c25ee886c91", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b85-301a-000d-3844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:00 GMT", + "x-ms-client-request-id" : "77a95f83-10e6-4e89-845b-4c25ee886c91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithfilepermissionkey844023/directoryapitestscreatedirectorywithfilepermissionkey93289c?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8580dac3-2369-450f-b19f-ec7a52a12c6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:01.3850000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:00 GMT", + "ETag" : "\"0x8D7325B7CD34D90\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:01.3850000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b86-301a-000d-3944-645aef000000", + "x-ms-client-request-id" : "8580dac3-2369-450f-b19f-ec7a52a12c6f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:01.3850000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectorywithfilepermissionkey844023", "directoryapitestscreatedirectorywithfilepermissionkey93289c", "2019-09-05T23:48:01.385Z", "2019-09-05T23:48:01.385Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithMetadata.json new file mode 100644 index 000000000000..1e18d45b6987 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithMetadata.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithmetadata64871718d9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "47ad5cdc-c9ce-47ca-a90a-d0aa8e55047f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7C0E0E16\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b71-301a-000d-2844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:59 GMT", + "x-ms-client-request-id" : "47ad5cdc-c9ce-47ca-a90a-d0aa8e55047f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatedirectorywithmetadata64871718d9/directoryapitestscreatedirectorywithmetadata2870643d8a?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ed2ee7ec-ae4c-4975-880f-c6a80f457c6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:00.1944768Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:59 GMT", + "ETag" : "\"0x8D7325B7C1DA4C0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:00.1944768Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b73-301a-000d-2944-645aef000000", + "x-ms-client-request-id" : "ed2ee7ec-ae4c-4975-880f-c6a80f457c6f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:00.1944768Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectorywithmetadata64871718d9", "directoryapitestscreatedirectorywithmetadata2870643d8a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFile.json new file mode 100644 index 000000000000..aec16f20d904 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFile.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefile391913b669438979149?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b14938c4-ec5e-4ec4-aef3-c083665a8424" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B87613EA9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cae-301a-000d-2d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:18 GMT", + "x-ms-client-request-id" : "b14938c4-ec5e-4ec4-aef3-c083665a8424" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefile391913b669438979149/directoryapitestscreatefile14835eba8695b96a840?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5bb25256-cffb-4082-84c0-69c67720f239" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:19.2229702Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:18 GMT", + "ETag" : "\"0x8D7325B87752946\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:19.2229702Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cb0-301a-000d-2e44-645aef000000", + "x-ms-client-request-id" : "5bb25256-cffb-4082-84c0-69c67720f239", + "x-ms-file-last-write-time" : "2019-09-05T23:48:19.2229702Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefile391913b669438979149/directoryapitestscreatefile14835eba8695b96a840%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "17474ae1-0366-42f7-a350-881bb7c4b933" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:19.3229737Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:18 GMT", + "ETag" : "\"0x8D7325B87846BA9\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:19.3229737Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339cb1-301a-000d-2f44-645aef000000", + "x-ms-client-request-id" : "17474ae1-0366-42f7-a350-881bb7c4b933", + "x-ms-file-last-write-time" : "2019-09-05T23:48:19.3229737Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefile391913b669438979149", "directoryapitestscreatefile14835eba8695b96a840" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..5921a1d592f0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefileinvalidargs054794117e0623?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f60fc61f-6e3a-4514-b2a4-d607b705393b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B87AF109E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cb5-301a-000d-3344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:18 GMT", + "x-ms-client-request-id" : "f60fc61f-6e3a-4514-b2a4-d607b705393b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefileinvalidargs054794117e0623/directoryapitestscreatefileinvalidargs05333882458988?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "94a6337a-8a96-483d-a8be-a5608557531f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:19.7079840Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:19 GMT", + "ETag" : "\"0x8D7325B87BF2B20\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:19.7079840Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cb7-301a-000d-3444-645aef000000", + "x-ms-client-request-id" : "94a6337a-8a96-483d-a8be-a5608557531f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:19.7079840Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefileinvalidargs054794117e0623/directoryapitestscreatefileinvalidargs05333882458988%2ftestfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "22df1815-9f92-46c6-89ce-7888dce92450" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "07339cba-301a-000d-3544-645aef000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:07339cba-301a-000d-3544-645aef000000\nTime:2019-09-05T23:48:19.8044500Z", + "Date" : "Thu, 05 Sep 2019 23:48:19 GMT", + "x-ms-client-request-id" : "22df1815-9f92-46c6-89ce-7888dce92450", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefileinvalidargs054794117e0623", "directoryapitestscreatefileinvalidargs05333882458988" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..4554fd95ccad --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefileinvalidargs108762454085f9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f295a31e-3cbe-474c-a354-e6b5a349c3ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B87F73D5D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cbe-301a-000d-3944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:19 GMT", + "x-ms-client-request-id" : "f295a31e-3cbe-474c-a354-e6b5a349c3ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefileinvalidargs108762454085f9/directoryapitestscreatefileinvalidargs1890938aee1261?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "da5ec205-1e4d-460a-b155-9314d38ce77e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:20.2549978Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:19 GMT", + "ETag" : "\"0x8D7325B8812A2DA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:20.2549978Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cc0-301a-000d-3a44-645aef000000", + "x-ms-client-request-id" : "da5ec205-1e4d-460a-b155-9314d38ce77e", + "x-ms-file-last-write-time" : "2019-09-05T23:48:20.2549978Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefileinvalidargs108762454085f9/directoryapitestscreatefileinvalidargs1890938aee1261%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5e3f2808-c066-41bc-948c-9d9277423998" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "07339cc4-301a-000d-3e44-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:07339cc4-301a-000d-3e44-645aef000000\nTime:2019-09-05T23:48:20.3424535Z", + "Date" : "Thu, 05 Sep 2019 23:48:19 GMT", + "x-ms-client-request-id" : "5e3f2808-c066-41bc-948c-9d9277423998", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefileinvalidargs108762454085f9", "directoryapitestscreatefileinvalidargs1890938aee1261" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..190cd757ce33 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverload.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverload5553834575d0b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3c1b461f-a6f4-4668-be2a-1f124f5e03f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8848E014\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ccc-301a-000d-4344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "x-ms-client-request-id" : "3c1b461f-a6f4-4668-be2a-1f124f5e03f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverload5553834575d0b/directoryapitestscreatefilemaxoverload79406c8281aa1?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ab6768d3-3f57-4ac7-8a87-b0d619eb08e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:20.7200116Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "ETag" : "\"0x8D7325B88599774\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:20.7200116Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cce-301a-000d-4444-645aef000000", + "x-ms-client-request-id" : "ab6768d3-3f57-4ac7-8a87-b0d619eb08e4", + "x-ms-file-last-write-time" : "2019-09-05T23:48:20.7200116Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverload5553834575d0b/directoryapitestscreatefilemaxoverload79406c8281aa1%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c360a14f-6a7c-4982-a269-16b8b13a4764" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:20.7770000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "ETag" : "\"0x8D7325B88624990\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:20.7770000Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339ccf-301a-000d-4544-645aef000000", + "x-ms-client-request-id" : "c360a14f-6a7c-4982-a269-16b8b13a4764", + "x-ms-file-last-write-time" : "2019-09-05T23:48:20.7770000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverload5553834575d0b", "directoryapitestscreatefilemaxoverload79406c8281aa1", "2019-09-05T23:48:20.777Z", "2019-09-05T23:48:20.777Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..5e9ff730ab99 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs0304107f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ae390468-e957-4728-a88d-227f2d7256ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8895EEAB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cd4-301a-000d-4a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "x-ms-client-request-id" : "ae390468-e957-4728-a88d-227f2d7256ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs0304107f/directoryapitestscreatefilemaxoverloadinvalidargs09680045?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2a740b92-e853-48fe-8ea4-f629c3449f64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:21.2230235Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "ETag" : "\"0x8D7325B88A6585B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:21.2230235Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cd6-301a-000d-4b44-645aef000000", + "x-ms-client-request-id" : "2a740b92-e853-48fe-8ea4-f629c3449f64", + "x-ms-file-last-write-time" : "2019-09-05T23:48:21.2230235Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs0304107f/directoryapitestscreatefilemaxoverloadinvalidargs09680045%2ftestfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "87f6a384-521e-47e7-b93e-0492c8abd2b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "07339cd7-301a-000d-4c44-645aef000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:07339cd7-301a-000d-4c44-645aef000000\nTime:2019-09-05T23:48:21.3164657Z", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "x-ms-client-request-id" : "87f6a384-521e-47e7-b93e-0492c8abd2b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs0304107f", "directoryapitestscreatefilemaxoverloadinvalidargs09680045" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..d7eb9488022b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs11631764?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7a8b8f9f-92f4-464b-b25f-e1226ac2527b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B88DE6966\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cdb-301a-000d-5044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:20 GMT", + "x-ms-client-request-id" : "7a8b8f9f-92f4-464b-b25f-e1226ac2527b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs11631764/directoryapitestscreatefilemaxoverloadinvalidargs114565e2?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "10879155-c93b-4f93-ad87-06fbbe218295" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:21.6940381Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:21 GMT", + "ETag" : "\"0x8D7325B88EE375D\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:21.6940381Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cde-301a-000d-5244-645aef000000", + "x-ms-client-request-id" : "10879155-c93b-4f93-ad87-06fbbe218295", + "x-ms-file-last-write-time" : "2019-09-05T23:48:21.6940381Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs11631764/directoryapitestscreatefilemaxoverloadinvalidargs114565e2%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "87b8bf1e-7171-40e1-872e-388e3443483a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "07339cdf-301a-000d-5344-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:07339cdf-301a-000d-5344-645aef000000\nTime:2019-09-05T23:48:21.7884635Z", + "Date" : "Thu, 05 Sep 2019 23:48:21 GMT", + "x-ms-client-request-id" : "87b8bf1e-7171-40e1-872e-388e3443483a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs11631764", "directoryapitestscreatefilemaxoverloadinvalidargs114565e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..0aa07ac332b3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs27224321?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "de389832-1ce9-4207-b20d-dc57b3359fcd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8925ABEC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ce3-301a-000d-5744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:21 GMT", + "x-ms-client-request-id" : "de389832-1ce9-4207-b20d-dc57b3359fcd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs27224321/directoryapitestscreatefilemaxoverloadinvalidargs27898610?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d4071684-c099-4f9d-9b33-7732655a09fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:22.1710507Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:21 GMT", + "ETag" : "\"0x8D7325B893700AB\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:22.1710507Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ce5-301a-000d-5844-645aef000000", + "x-ms-client-request-id" : "d4071684-c099-4f9d-9b33-7732655a09fc", + "x-ms-file-last-write-time" : "2019-09-05T23:48:22.1710507Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs27224321/directoryapitestscreatefilemaxoverloadinvalidargs27898610%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "388c51bb-c5ce-49bc-a100-e3d81615a263" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "310", + "StatusCode" : "400", + "x-ms-request-id" : "07339ce7-301a-000d-5a44-645aef000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:07339ce7-301a-000d-5a44-645aef000000\nTime:2019-09-05T23:48:22.2624713Zx-ms-content-md5", + "Date" : "Thu, 05 Sep 2019 23:48:21 GMT", + "x-ms-client-request-id" : "388c51bb-c5ce-49bc-a100-e3d81615a263", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs27224321", "directoryapitestscreatefilemaxoverloadinvalidargs27898610" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..6232dbbfc64d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs391656ce?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "146507b7-98c2-45b3-ab3e-9d38c64845aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B896FAD3E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ceb-301a-000d-5d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:21 GMT", + "x-ms-client-request-id" : "146507b7-98c2-45b3-ab3e-9d38c64845aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs391656ce/directoryapitestscreatefilemaxoverloadinvalidargs398672e4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c74cde40-3d7c-4631-b2ff-9f862625a3e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:22.6440603Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:22 GMT", + "ETag" : "\"0x8D7325B897F2D9B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:22.6440603Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cee-301a-000d-5f44-645aef000000", + "x-ms-client-request-id" : "c74cde40-3d7c-4631-b2ff-9f862625a3e3", + "x-ms-file-last-write-time" : "2019-09-05T23:48:22.6440603Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs391656ce/directoryapitestscreatefilemaxoverloadinvalidargs398672e4%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b8041444-bd20-4de2-9374-f78c184fb466" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339cef-301a-000d-6044-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339cef-301a-000d-6044-645aef000000\nTime:2019-09-05T23:48:22.7304741Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:22 GMT", + "x-ms-client-request-id" : "b8041444-bd20-4de2-9374-f78c184fb466", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs391656ce", "directoryapitestscreatefilemaxoverloadinvalidargs398672e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectory.json new file mode 100644 index 000000000000..3dfff95305d0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectory.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectory49612a0781c8808?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ee0366a7-4520-41a7-8589-21ac89b22212" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B84F82CCA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c6d-301a-000d-7544-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:14 GMT", + "x-ms-client-request-id" : "ee0366a7-4520-41a7-8589-21ac89b22212" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectory49612a0781c8808/directoryapitestscreatesubdirectory638647ecb805fd8?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5f52f7b2-b760-4491-ad2a-47443de6f941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:15.1598669Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:14 GMT", + "ETag" : "\"0x8D7325B85092E4D\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:15.1598669Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c70-301a-000d-7744-645aef000000", + "x-ms-client-request-id" : "5f52f7b2-b760-4491-ad2a-47443de6f941", + "x-ms-file-last-write-time" : "2019-09-05T23:48:15.1598669Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectory49612a0781c8808/directoryapitestscreatesubdirectory638647ecb805fd8%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8021445f-e9c6-4add-ad78-6bd611d6a040" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:15.2568663Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:14 GMT", + "ETag" : "\"0x8D7325B8517FB57\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:15.2568663Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c71-301a-000d-7844-645aef000000", + "x-ms-client-request-id" : "8021445f-e9c6-4add-ad78-6bd611d6a040", + "x-ms-file-last-write-time" : "2019-09-05T23:48:15.2568663Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectory49612a0781c8808", "directoryapitestscreatesubdirectory638647ecb805fd8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryFilePermission.json new file mode 100644 index 000000000000..958be9bf4916 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryFilePermission.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermission72052a5d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b06b3da5-99ab-4519-8415-af99056aefd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B861F482F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c8b-301a-000d-0f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "x-ms-client-request-id" : "b06b3da5-99ab-4519-8415-af99056aefd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermission72052a5d/directoryapitestscreatesubdirectoryfilepermission484619c6?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e8bf15a1-78cc-422d-9b74-84e486fc0453" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:17.0919158Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "ETag" : "\"0x8D7325B862FFCF6\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:17.0919158Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c8e-301a-000d-1144-645aef000000", + "x-ms-client-request-id" : "e8bf15a1-78cc-422d-9b74-84e486fc0453", + "x-ms-file-last-write-time" : "2019-09-05T23:48:17.0919158Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermission72052a5d/directoryapitestscreatesubdirectoryfilepermission484619c6%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2f2f003e-66e4-4095-9068-a97b55d1919f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:17.1859204Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "ETag" : "\"0x8D7325B863E5504\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:17.1859204Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c8f-301a-000d-1244-645aef000000", + "x-ms-client-request-id" : "2f2f003e-66e4-4095-9068-a97b55d1919f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:17.1859204Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectoryfilepermission72052a5d", "directoryapitestscreatesubdirectoryfilepermission484619c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryFilePermissionKey.json new file mode 100644 index 000000000000..6f2bbf8670bd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryFilePermissionKey.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermissionkey862340?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fe2c4260-75f0-4f33-a1a3-47051665ae65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8667C300\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c94-301a-000d-1644-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "x-ms-client-request-id" : "fe2c4260-75f0-4f33-a1a3-47051665ae65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermissionkey862340/directoryapitestscreatesubdirectoryfilepermissionkey42397b?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f84d38eb-3873-4b68-874e-7ccec32ddd55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:17.5709284Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "ETag" : "\"0x8D7325B86791464\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:17.5709284Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c96-301a-000d-1744-645aef000000", + "x-ms-client-request-id" : "f84d38eb-3873-4b68-874e-7ccec32ddd55", + "x-ms-file-last-write-time" : "2019-09-05T23:48:17.5709284Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermissionkey862340?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "14ffc701-b5f2-48f6-8151-875353724d86", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c98-301a-000d-1944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "x-ms-client-request-id" : "14ffc701-b5f2-48f6-8151-875353724d86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryfilepermissionkey862340/directoryapitestscreatesubdirectoryfilepermissionkey42397b%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6279fc99-3b4f-4d43-a4b5-6c6d6f06ff1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:17.7170000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "ETag" : "\"0x8D7325B868F5E50\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:17.7170000Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c9a-301a-000d-1b44-645aef000000", + "x-ms-client-request-id" : "6279fc99-3b4f-4d43-a4b5-6c6d6f06ff1a", + "x-ms-file-last-write-time" : "2019-09-05T23:48:17.7170000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectoryfilepermissionkey862340", "directoryapitestscreatesubdirectoryfilepermissionkey42397b", "2019-09-05T23:48:17.717Z", "2019-09-05T23:48:17.717Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryInvalidName.json new file mode 100644 index 000000000000..48ec9655f062 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryInvalidName.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryinvalidname049432afe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "71d4b32b-516e-4b2a-a2c9-bed125e0c9b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8542F18C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c76-301a-000d-7d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:14 GMT", + "x-ms-client-request-id" : "71d4b32b-516e-4b2a-a2c9-bed125e0c9b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryinvalidname049432afe/directoryapitestscreatesubdirectoryinvalidname809185dea?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3f915ca2-622f-4861-8c6b-4947c2b3970b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:15.6428776Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:15 GMT", + "ETag" : "\"0x8D7325B8552E1E8\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:15.6428776Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c79-301a-000d-7f44-645aef000000", + "x-ms-client-request-id" : "3f915ca2-622f-4861-8c6b-4947c2b3970b", + "x-ms-file-last-write-time" : "2019-09-05T23:48:15.6428776Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectoryinvalidname049432afe/directoryapitestscreatesubdirectoryinvalidname809185dea%2ftest%2fsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eca06e86-196e-4188-b1cc-3571f14aa855" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "07339c7a-301a-000d-8044-645aef000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:07339c7a-301a-000d-8044-645aef000000\nTime:2019-09-05T23:48:15.7454289Z", + "Date" : "Thu, 05 Sep 2019 23:48:15 GMT", + "x-ms-client-request-id" : "eca06e86-196e-4188-b1cc-3571f14aa855", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectoryinvalidname049432afe", "directoryapitestscreatesubdirectoryinvalidname809185dea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadata.json new file mode 100644 index 000000000000..4f2898dddde5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadata.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectorymetadata02084ff390e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7c7c9493-b94a-4f65-8152-6163af10479b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B858E52BF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c7d-301a-000d-0344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:15 GMT", + "x-ms-client-request-id" : "7c7c9493-b94a-4f65-8152-6163af10479b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectorymetadata02084ff390e/directoryapitestscreatesubdirectorymetadata43354110efa?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7374d87e-0ff4-4c24-9ebf-6ab84ddcfeb8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:16.1408926Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:15 GMT", + "ETag" : "\"0x8D7325B859EDF9E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:16.1408926Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c7f-301a-000d-0444-645aef000000", + "x-ms-client-request-id" : "7374d87e-0ff4-4c24-9ebf-6ab84ddcfeb8", + "x-ms-file-last-write-time" : "2019-09-05T23:48:16.1408926Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectorymetadata02084ff390e/directoryapitestscreatesubdirectorymetadata43354110efa%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f5cce6fd-30e2-4f8f-bd92-20175e46e91d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:16.2368939Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:15 GMT", + "ETag" : "\"0x8D7325B85AD85AB\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:16.2368939Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c80-301a-000d-0544-645aef000000", + "x-ms-client-request-id" : "f5cce6fd-30e2-4f8f-bd92-20175e46e91d", + "x-ms-file-last-write-time" : "2019-09-05T23:48:16.2368939Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectorymetadata02084ff390e", "directoryapitestscreatesubdirectorymetadata43354110efa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadataError.json new file mode 100644 index 000000000000..a2d83c551350 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadataError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectorymetadataerror2277154d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "205231f6-af19-4da7-92e5-9c8542c91f97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B85D769A8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c84-301a-000d-0944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:15 GMT", + "x-ms-client-request-id" : "205231f6-af19-4da7-92e5-9c8542c91f97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectorymetadataerror2277154d/directoryapitestscreatesubdirectorymetadataerror599810c4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "da2595b5-4836-4c22-a877-0c97f72dfcf2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:16.6229043Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "ETag" : "\"0x8D7325B85E86C33\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:16.6229043Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c86-301a-000d-0a44-645aef000000", + "x-ms-client-request-id" : "da2595b5-4836-4c22-a877-0c97f72dfcf2", + "x-ms-file-last-write-time" : "2019-09-05T23:48:16.6229043Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestscreatesubdirectorymetadataerror2277154d/directoryapitestscreatesubdirectorymetadataerror599810c4%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "669413c5-b490-4251-a76d-bb9034a494eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339c87-301a-000d-0b44-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339c87-301a-000d-0b44-645aef000000\nTime:2019-09-05T23:48:16.7094292Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:16 GMT", + "x-ms-client-request-id" : "669413c5-b490-4251-a76d-bb9034a494eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectorymetadataerror2277154d", "directoryapitestscreatesubdirectorymetadataerror599810c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..baa447029530 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectory.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletedirectory050209fb37dc8b0a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0ee3f30c-b168-4c1d-b2f0-24eee2f60cdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7D5F1FBA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b95-301a-000d-4544-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:01 GMT", + "x-ms-client-request-id" : "0ee3f30c-b168-4c1d-b2f0-24eee2f60cdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletedirectory050209fb37dc8b0a/directoryapitestsdeletedirectory8288289c394b3138?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8bbffcc3-d3d2-4cb8-97ec-8bdc7fa81eac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:02.4045332Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:01 GMT", + "ETag" : "\"0x8D7325B7D6EDF14\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:02.4045332Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b9a-301a-000d-4944-645aef000000", + "x-ms-client-request-id" : "8bbffcc3-d3d2-4cb8-97ec-8bdc7fa81eac", + "x-ms-file-last-write-time" : "2019-09-05T23:48:02.4045332Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletedirectory050209fb37dc8b0a/directoryapitestsdeletedirectory8288289c394b3138?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7ca936bb-363e-4780-9e4e-6c52964775b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339b9b-301a-000d-4a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:01 GMT", + "x-ms-client-request-id" : "7ca936bb-363e-4780-9e4e-6c52964775b2" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletedirectory050209fb37dc8b0a", "directoryapitestsdeletedirectory8288289c394b3138" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..65d8ba56b387 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectoryError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletedirectoryerror60205885eb25f9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3784b5e5-7bfc-4bb3-acb3-c1dff6e8dac3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7DA9964A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b9f-301a-000d-4e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:02 GMT", + "x-ms-client-request-id" : "3784b5e5-7bfc-4bb3-acb3-c1dff6e8dac3" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletedirectoryerror60205885eb25f9/directoryapitestsdeletedirectoryerror325287d8805f90?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eb423b24-543f-4545-9737-8857db959fab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339ba1-301a-000d-4f44-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339ba1-301a-000d-4f44-645aef000000\nTime:2019-09-05T23:48:02.8903358Z", + "Date" : "Thu, 05 Sep 2019 23:48:02 GMT", + "x-ms-client-request-id" : "eb423b24-543f-4545-9737-8857db959fab", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletedirectoryerror60205885eb25f9", "directoryapitestsdeletedirectoryerror325287d8805f90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFile.json new file mode 100644 index 000000000000..07ce11f22054 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFile.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefile99758198400131ebf44?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1ea5984d-a968-4f9d-8210-a83da07e0b63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B89B764A8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cf2-301a-000d-6344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:22 GMT", + "x-ms-client-request-id" : "1ea5984d-a968-4f9d-8210-a83da07e0b63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefile99758198400131ebf44/directoryapitestsdeletefile01008a449b15f0bd444?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "32950358-fb94-4be0-a1dd-9d0385067081" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:23.1210711Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:22 GMT", + "ETag" : "\"0x8D7325B89C7F6D7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:23.1210711Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cf5-301a-000d-6544-645aef000000", + "x-ms-client-request-id" : "32950358-fb94-4be0-a1dd-9d0385067081", + "x-ms-file-last-write-time" : "2019-09-05T23:48:23.1210711Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefile99758198400131ebf44/directoryapitestsdeletefile01008a449b15f0bd444%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1f1b688a-4227-4980-8130-d6f8683b6187" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:23.2380784Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:22 GMT", + "ETag" : "\"0x8D7325B89D9D170\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:23.2380784Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339cf6-301a-000d-6644-645aef000000", + "x-ms-client-request-id" : "1f1b688a-4227-4980-8130-d6f8683b6187", + "x-ms-file-last-write-time" : "2019-09-05T23:48:23.2380784Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefile99758198400131ebf44/directoryapitestsdeletefile01008a449b15f0bd444%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "df0e48ca-737b-403e-88bf-a1f69eacea37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339cf9-301a-000d-6844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:22 GMT", + "x-ms-client-request-id" : "df0e48ca-737b-403e-88bf-a1f69eacea37" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletefile99758198400131ebf44", "directoryapitestsdeletefile01008a449b15f0bd444" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFileError.json new file mode 100644 index 000000000000..3703a1eb0dd2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFileError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefileerror30025ee03edb433a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d368e11d-f7e8-47a3-a224-62b3f1bc039f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8A13DCC1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339cfc-301a-000d-6b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:23 GMT", + "x-ms-client-request-id" : "d368e11d-f7e8-47a3-a224-62b3f1bc039f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefileerror30025ee03edb433a/directoryapitestsdeletefileerror35170ee45abda48e?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "646224b4-e037-49bf-9d67-d8a77a827598" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:23.7230935Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:23 GMT", + "ETag" : "\"0x8D7325B8A23D357\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:23.7230935Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339cff-301a-000d-6d44-645aef000000", + "x-ms-client-request-id" : "646224b4-e037-49bf-9d67-d8a77a827598", + "x-ms-file-last-write-time" : "2019-09-05T23:48:23.7230935Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletefileerror30025ee03edb433a/directoryapitestsdeletefileerror35170ee45abda48e%2ftestfile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "93a1681c-5a0e-4c9a-a19f-bf53d1d030a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339d01-301a-000d-6f44-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339d01-301a-000d-6f44-645aef000000\nTime:2019-09-05T23:48:23.8234863Z", + "Date" : "Thu, 05 Sep 2019 23:48:23 GMT", + "x-ms-client-request-id" : "93a1681c-5a0e-4c9a-a19f-bf53d1d030a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletefileerror30025ee03edb433a", "directoryapitestsdeletefileerror35170ee45abda48e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectory.json new file mode 100644 index 000000000000..8ef29acff59b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectory.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectory488569428436ca1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "10e040be-4291-443a-97c8-b58ee8682de8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B86C154FF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c9d-301a-000d-1e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "x-ms-client-request-id" : "10e040be-4291-443a-97c8-b58ee8682de8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectory488569428436ca1/directoryapitestsdeletesubdirectory694127d84bc5db9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "85960c4d-e2e9-48fd-b39e-04fedfbe7996" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:18.1459455Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "ETag" : "\"0x8D7325B86D0D1FF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:18.1459455Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c9f-301a-000d-1f44-645aef000000", + "x-ms-client-request-id" : "85960c4d-e2e9-48fd-b39e-04fedfbe7996", + "x-ms-file-last-write-time" : "2019-09-05T23:48:18.1459455Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectory488569428436ca1/directoryapitestsdeletesubdirectory694127d84bc5db9%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8e16f28b-ed79-40de-80e0-703b56b2a08f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:18.2409462Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "ETag" : "\"0x8D7325B86DF50F6\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:18.2409462Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339ca1-301a-000d-2144-645aef000000", + "x-ms-client-request-id" : "8e16f28b-ed79-40de-80e0-703b56b2a08f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:18.2409462Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectory488569428436ca1/directoryapitestsdeletesubdirectory694127d84bc5db9%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f2c9d462-0eea-4c63-acb4-c44b055c147b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339ca3-301a-000d-2344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "x-ms-client-request-id" : "f2c9d462-0eea-4c63-acb4-c44b055c147b" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletesubdirectory488569428436ca1", "directoryapitestsdeletesubdirectory694127d84bc5db9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectoryError.json new file mode 100644 index 000000000000..1289c5448b77 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectoryError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectoryerror63803d69e659?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2c0d84fa-7530-4c55-b77e-f107eb0e4b0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8717644D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ca7-301a-000d-2744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:17 GMT", + "x-ms-client-request-id" : "2c0d84fa-7530-4c55-b77e-f107eb0e4b0c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectoryerror63803d69e659/directoryapitestsdeletesubdirectoryerror39652e6b901d?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a9d09f4c-a7f3-4a34-8c76-fb6aba052281" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:18.7169564Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:18 GMT", + "ETag" : "\"0x8D7325B8727F31C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:18.7169564Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ca9-301a-000d-2844-645aef000000", + "x-ms-client-request-id" : "a9d09f4c-a7f3-4a34-8c76-fb6aba052281", + "x-ms-file-last-write-time" : "2019-09-05T23:48:18.7169564Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsdeletesubdirectoryerror63803d69e659/directoryapitestsdeletesubdirectoryerror39652e6b901d%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f8b28450-a42c-449d-92a4-10ef7a0136fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339caa-301a-000d-2944-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339caa-301a-000d-2944-645aef000000\nTime:2019-09-05T23:48:18.8164451Z", + "Date" : "Thu, 05 Sep 2019 23:48:18 GMT", + "x-ms-client-request-id" : "f8b28450-a42c-449d-92a4-10ef7a0136fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletesubdirectoryerror63803d69e659", "directoryapitestsdeletesubdirectoryerror39652e6b901d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsForceCloseHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsForceCloseHandlesError.json new file mode 100644 index 000000000000..5be3f9b74689 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsForceCloseHandlesError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsforceclosehandleserror18455c4539dfc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2c747ca8-e530-43a0-a7a1-e67657c439c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B84AAA935\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c63-301a-000d-6e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:13 GMT", + "x-ms-client-request-id" : "2c747ca8-e530-43a0-a7a1-e67657c439c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsforceclosehandleserror18455c4539dfc/directoryapitestsforceclosehandleserror52457c7342a44?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "98fe0446-065c-4496-b578-8646d8dae0fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:14.6488539Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:14 GMT", + "ETag" : "\"0x8D7325B84BB34DB\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:14.6488539Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c66-301a-000d-7044-645aef000000", + "x-ms-client-request-id" : "98fe0446-065c-4496-b578-8646d8dae0fc", + "x-ms-file-last-write-time" : "2019-09-05T23:48:14.6488539Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsforceclosehandleserror18455c4539dfc/directoryapitestsforceclosehandleserror52457c7342a44?comp=forceclosehandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5be31081-2140-4ca7-8609-b6cff7c8b40c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "328", + "StatusCode" : "400", + "x-ms-request-id" : "07339c68-301a-000d-7144-645aef000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:07339c68-301a-000d-7144-645aef000000\nTime:2019-09-05T23:48:14.7814159Zx-ms-handle-idhandleId", + "Date" : "Thu, 05 Sep 2019 23:48:14 GMT", + "x-ms-client-request-id" : "5be31081-2140-4ca7-8609-b6cff7c8b40c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsforceclosehandleserror18455c4539dfc", "directoryapitestsforceclosehandleserror52457c7342a44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetDirectoryURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetDirectoryURL.json new file mode 100644 index 000000000000..3efde4ae7df2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetDirectoryURL.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetdirectoryurl63320c15846ffdc2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d9499181-7396-4e9e-b0a6-d7b8ce2e2319" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7B1332F3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b54-301a-000d-1344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:57 GMT", + "x-ms-client-request-id" : "d9499181-7396-4e9e-b0a6-d7b8ce2e2319" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetdirectoryurl63320c15846ffdc2", "directoryapitestsgetdirectoryurl51185d2da17b208b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetFileClient.json new file mode 100644 index 000000000000..219568b55d97 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetFileClient.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetfileclient885151a77299da5ec?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "abbe5392-3c97-4388-a81a-2a73c420f0a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7B6C4F8F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b5e-301a-000d-1b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:58 GMT", + "x-ms-client-request-id" : "abbe5392-3c97-4388-a81a-2a73c420f0a5" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetfileclient885151a77299da5ec", "directoryapitestsgetfileclient48896cfd8db9ead4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetProperties.json new file mode 100644 index 000000000000..8bdf9aa4a5ff --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetProperties.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetproperties759714376ceada7df?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d7b3f127-751c-4d9b-9bcf-f431aff6e2c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7DE16F46\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ba6-301a-000d-5444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:02 GMT", + "x-ms-client-request-id" : "d7b3f127-751c-4d9b-9bcf-f431aff6e2c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetproperties759714376ceada7df/directoryapitestsgetproperties286433a71bdf33da3?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ac636c1e-d330-4f75-ba36-a7c7fb0bb0ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:03.2675585Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:02 GMT", + "ETag" : "\"0x8D7325B7DF28F01\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:03.2675585Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ba8-301a-000d-5544-645aef000000", + "x-ms-client-request-id" : "ac636c1e-d330-4f75-ba36-a7c7fb0bb0ca", + "x-ms-file-last-write-time" : "2019-09-05T23:48:03.2675585Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetproperties759714376ceada7df/directoryapitestsgetproperties286433a71bdf33da3?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9e44a72d-d6ff-4dca-8f56-39ae54aae382" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:03.2675585Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:02 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7325B7DF28F01\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:03.2675585Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ba9-301a-000d-5644-645aef000000", + "x-ms-client-request-id" : "9e44a72d-d6ff-4dca-8f56-39ae54aae382", + "x-ms-file-last-write-time" : "2019-09-05T23:48:03.2675585Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetproperties759714376ceada7df", "directoryapitestsgetproperties286433a71bdf33da3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..8db1e69ec2b4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetPropertiesError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetpropertieserror00863b76b4ce749?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e69c34ae-3045-4b5b-94c6-e9e79408a2e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7E2BBEEE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bad-301a-000d-5a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:03 GMT", + "x-ms-client-request-id" : "e69c34ae-3045-4b5b-94c6-e9e79408a2e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetpropertieserror00863b76b4ce749/directoryapitestsgetpropertieserror384763946ce5098?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b2f7bf76-2a99-4220-a574-91a2b06125ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339baf-301a-000d-5b44-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339baf-301a-000d-5b44-645aef000000\nTime:2019-09-05T23:48:03.7463392Z", + "Date" : "Thu, 05 Sep 2019 23:48:03 GMT", + "x-ms-client-request-id" : "b2f7bf76-2a99-4220-a574-91a2b06125ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetpropertieserror00863b76b4ce749", "directoryapitestsgetpropertieserror384763946ce5098" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..ff789037302c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSnapshotId.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetsnapshotid319841a435d2feeea?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1b6607a4-0888-48fc-82a7-92bc2535dc89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8A5C7E94\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d05-301a-000d-7344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:23 GMT", + "x-ms-client-request-id" : "1b6607a4-0888-48fc-82a7-92bc2535dc89" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetsnapshotid319841a435d2feeea", "directoryapitestsgetsnapshotid10408398d3424e3f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSubDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSubDirectoryClient.json new file mode 100644 index 000000000000..fbedf0694cce --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSubDirectoryClient.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestsgetsubdirectoryclient1133811157f3e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "45999f87-fbfc-4041-8dfa-095321d0f48b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7B40AB8D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b59-301a-000d-1744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:58 GMT", + "x-ms-client-request-id" : "45999f87-fbfc-4041-8dfa-095321d0f48b" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetsubdirectoryclient1133811157f3e", "directoryapitestsgetsubdirectoryclient9631571f11929" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories.json new file mode 100644 index 000000000000..ddf5300f842e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories.json @@ -0,0 +1,278 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "695e059d-5a05-41cc-8ae2-76f5c0cd12d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D730D96389CAE1\"", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e7c18afd-101a-0044-50c2-62ec1a000000", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "x-ms-client-request-id" : "695e059d-5a05-41cc-8ae2-76f5c0cd12d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "74ce2c46-87a4-49c8-82e3-a167b5b963bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.2850457Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963935319\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-04T01:44:13.2850457Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18aff-101a-0044-51c2-62ec1a000000", + "x-ms-client-request-id" : "74ce2c46-87a4-49c8-82e3-a167b5b963bf", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.2850457Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f840?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0c4bf496-0aa9-4510-af88-28f9e98fe669" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.3280875Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D96399E46B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-04T01:44:13.3280875Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b00-101a-0044-52c2-62ec1a000000", + "x-ms-client-request-id" : "0c4bf496-0aa9-4510-af88-28f9e98fe669", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.3280875Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f840%2fdirectoryapitestslistfilesanddirectories76034a8e0f843", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "389c63cb-97a9-405c-b732-61d024e284b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.3681258Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963A0006A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:44:13.3681258Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b01-101a-0044-53c2-62ec1a000000", + "x-ms-client-request-id" : "389c63cb-97a9-405c-b732-61d024e284b6", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.3681258Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f840%2fdirectoryapitestslistfilesanddirectories76034a8e0f844", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c0e60181-f2bd-4a33-a254-ec7f30e780f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.4101646Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963A66A8E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:44:13.4101646Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b02-101a-0044-54c2-62ec1a000000", + "x-ms-client-request-id" : "c0e60181-f2bd-4a33-a254-ec7f30e780f5", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.4101646Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f841?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "171f2646-ebf0-45c5-b197-c67bf1e647e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.4502020Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963AC8684\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-04T01:44:13.4502020Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b04-101a-0044-55c2-62ec1a000000", + "x-ms-client-request-id" : "171f2646-ebf0-45c5-b197-c67bf1e647e9", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.4502020Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f841%2fdirectoryapitestslistfilesanddirectories76034a8e0f845", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9b876c21-d673-49eb-8633-bafc7d98d5d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.4882389Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963B25455\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:44:13.4882389Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b05-101a-0044-56c2-62ec1a000000", + "x-ms-client-request-id" : "9b876c21-d673-49eb-8633-bafc7d98d5d6", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.4882389Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f841%2fdirectoryapitestslistfilesanddirectories76034a8e0f846", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4edcf857-50ac-41de-b36b-3854a4cbafd4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.5252732Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963B7FAFC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:44:13.5252732Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b06-101a-0044-57c2-62ec1a000000", + "x-ms-client-request-id" : "4edcf857-50ac-41de-b36b-3854a4cbafd4", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.5252732Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486%2fdirectoryapitestslistfilesanddirectories76034a8e0f842", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "66b9ff97-bc09-4168-be03-e92ac893bf25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:13.6163605Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "ETag" : "\"0x8D730D963C5E115\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:44:13.6163605Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18b07-101a-0044-58c2-62ec1a000000", + "x-ms-client-request-id" : "66b9ff97-bc09-4168-be03-e92ac893bf25", + "x-ms-file-last-write-time" : "2019-09-04T01:44:13.6163605Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories63607f0c6cee/directoryapitestslistfilesanddirectories20740795b486?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "926dcb90-57a8-463e-86f8-1da872970c45" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e7c18b08-101a-0044-59c2-62ec1a000000", + "Body" : "directoryapitestslistfilesanddirectories76034a8e0f840directoryapitestslistfilesanddirectories76034a8e0f841directoryapitestslistfilesanddirectories76034a8e0f8421024", + "Date" : "Wed, 04 Sep 2019 01:44:13 GMT", + "x-ms-client-request-id" : "926dcb90-57a8-463e-86f8-1da872970c45", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectories63607f0c6cee", "directoryapitestslistfilesanddirectories20740795b486", "directoryapitestslistfilesanddirectories76034a8e0f84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories0.json new file mode 100644 index 000000000000..1ec969c48517 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories0.json @@ -0,0 +1,220 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6c71cc86-2c27-4895-bebc-aab3a5310b63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8040E42A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bf1-301a-000d-0b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "x-ms-client-request-id" : "6c71cc86-2c27-4895-bebc-aab3a5310b63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bf095730-8fbf-4786-80f7-1f5327fe4483" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:07.2426629Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "ETag" : "\"0x8D7325B80511C85\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:07.2426629Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bf3-301a-000d-0c44-645aef000000", + "x-ms-client-request-id" : "bf095730-8fbf-4786-80f7-1f5327fe4483", + "x-ms-file-last-write-time" : "2019-09-05T23:48:07.2426629Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7%2fa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0eff8e7b-2718-42eb-91e1-4edebf526b54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:07.3766632Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "ETag" : "\"0x8D7325B80658EE8\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:07.3766632Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339bf6-301a-000d-0e44-645aef000000", + "x-ms-client-request-id" : "0eff8e7b-2718-42eb-91e1-4edebf526b54", + "x-ms-file-last-write-time" : "2019-09-05T23:48:07.3766632Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7%2fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "069e2636-8c6b-4949-a992-a15d6ec87b35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:07.4866660Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "ETag" : "\"0x8D7325B807657E4\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:07.4866660Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339bf8-301a-000d-1044-645aef000000", + "x-ms-client-request-id" : "069e2636-8c6b-4949-a992-a15d6ec87b35", + "x-ms-file-last-write-time" : "2019-09-05T23:48:07.4866660Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7%2fc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5962d294-1733-4e69-b931-5c4232a38bef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:07.5956695Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "ETag" : "\"0x8D7325B8086F9D7\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:07.5956695Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339bf9-301a-000d-1144-645aef000000", + "x-ms-client-request-id" : "5962d294-1733-4e69-b931-5c4232a38bef", + "x-ms-file-last-write-time" : "2019-09-05T23:48:07.5956695Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7%2fd?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f8cb0653-a2a8-436e-8dc4-7825885212c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:07.7016720Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "ETag" : "\"0x8D7325B80972690\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:07.7016720Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339bfb-301a-000d-1344-645aef000000", + "x-ms-client-request-id" : "f8cb0653-a2a8-436e-8dc4-7825885212c4", + "x-ms-file-last-write-time" : "2019-09-05T23:48:07.7016720Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7%2fe?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cac99871-b580-4445-90cd-57fa484b0df0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:07.8166744Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "ETag" : "\"0x8D7325B80A8B2D8\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:07.8166744Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339bfc-301a-000d-1444-645aef000000", + "x-ms-client-request-id" : "cac99871-b580-4445-90cd-57fa484b0df0", + "x-ms-file-last-write-time" : "2019-09-05T23:48:07.8166744Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories001393e085061/directoryapitestslistfilesanddirectories080887c4265b7?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "944c350d-658b-47cc-aa20-553b230514bb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339bfe-301a-000d-1644-645aef000000", + "Body" : "a2b2c2de", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "x-ms-client-request-id" : "944c350d-658b-47cc-aa20-553b230514bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectories001393e085061", "directoryapitestslistfilesanddirectories080887c4265b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories1.json new file mode 100644 index 000000000000..17b90303c5fc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories1.json @@ -0,0 +1,220 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e9013a8f-1829-40cb-921f-aa156661a8a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B80E784B6\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c03-301a-000d-1b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "x-ms-client-request-id" : "e9013a8f-1829-40cb-921f-aa156661a8a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6f9937c3-3bc3-4b69-9e60-df595430e1a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:08.3436865Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "ETag" : "\"0x8D7325B80F91D41\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:08.3436865Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c05-301a-000d-1c44-645aef000000", + "x-ms-client-request-id" : "6f9937c3-3bc3-4b69-9e60-df595430e1a4", + "x-ms-file-last-write-time" : "2019-09-05T23:48:08.3436865Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c%2fa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ce588c01-31c6-4498-b54e-834232e3c714" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:08.4556911Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "ETag" : "\"0x8D7325B810A346F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:08.4556911Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c07-301a-000d-1e44-645aef000000", + "x-ms-client-request-id" : "ce588c01-31c6-4498-b54e-834232e3c714", + "x-ms-file-last-write-time" : "2019-09-05T23:48:08.4556911Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c%2fc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3c6d6141-97f1-4742-bc8c-5dc608273886" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:08.5566948Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:07 GMT", + "ETag" : "\"0x8D7325B81199DE4\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:08.5566948Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c0a-301a-000d-2044-645aef000000", + "x-ms-client-request-id" : "3c6d6141-97f1-4742-bc8c-5dc608273886", + "x-ms-file-last-write-time" : "2019-09-05T23:48:08.5566948Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c%2fe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a3a1fcfc-66d1-406a-a04c-11fe3ab9c010" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:08.6566974Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "ETag" : "\"0x8D7325B8128E03E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:08.6566974Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c0c-301a-000d-2244-645aef000000", + "x-ms-client-request-id" : "a3a1fcfc-66d1-406a-a04c-11fe3ab9c010", + "x-ms-file-last-write-time" : "2019-09-05T23:48:08.6566974Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c%2fb?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2b4e68fe-4f1a-4a49-a26d-330358e5a097" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:08.7566987Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "ETag" : "\"0x8D7325B8138228B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:08.7566987Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c0d-301a-000d-2344-645aef000000", + "x-ms-client-request-id" : "2b4e68fe-4f1a-4a49-a26d-330358e5a097", + "x-ms-file-last-write-time" : "2019-09-05T23:48:08.7566987Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c%2fd?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "333c0669-0417-4ecd-8efa-e380a7d23b29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:08.8507001Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "ETag" : "\"0x8D7325B81467A79\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:08.8507001Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c0f-301a-000d-2544-645aef000000", + "x-ms-client-request-id" : "333c0669-0417-4ecd-8efa-e380a7d23b29", + "x-ms-file-last-write-time" : "2019-09-05T23:48:08.8507001Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectories1877158cf0173/directoryapitestslistfilesanddirectories1045916d2eb2c?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ed661ec5-5ea2-45a9-8725-5aba895e0b14" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c10-301a-000d-2644-645aef000000", + "Body" : "a2bc2de2", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "x-ms-client-request-id" : "ed661ec5-5ea2-45a9-8725-5aba895e0b14", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectories1877158cf0173", "directoryapitestslistfilesanddirectories1045916d2eb2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs0.json new file mode 100644 index 000000000000..67325acdea70 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs0.json @@ -0,0 +1,278 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6709afce-badd-4906-a7bc-c0b1bd86dfd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B817DF89E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c13-301a-000d-2944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "x-ms-client-request-id" : "6709afce-badd-4906-a7bc-c0b1bd86dfd7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dd480f06-a77c-4166-8ee1-2f6bbdc2a881" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.3247198Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "ETag" : "\"0x8D7325B818ECEDE\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:09.3247198Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c15-301a-000d-2a44-645aef000000", + "x-ms-client-request-id" : "dd480f06-a77c-4166-8ee1-2f6bbdc2a881", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.3247198Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344190?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "44b62bb9-55fa-4ef6-a567-94901389db5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.4397168Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "ETag" : "\"0x8D7325B81A05AF0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:09.4397168Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c17-301a-000d-2c44-645aef000000", + "x-ms-client-request-id" : "44b62bb9-55fa-4ef6-a567-94901389db5e", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.4397168Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344190%2fdirectoryapitestslistfilesanddirectoriesargs053498344193", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c3de7844-3784-4ab7-978e-59e1d43585ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.5547192Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:08 GMT", + "ETag" : "\"0x8D7325B81B1E738\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:09.5547192Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "07339c18-301a-000d-2d44-645aef000000", + "x-ms-client-request-id" : "c3de7844-3784-4ab7-978e-59e1d43585ec", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.5547192Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344190%2fdirectoryapitestslistfilesanddirectoriesargs053498344194", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "376b69a5-6ad0-471e-bfc7-735ad032211b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.6557225Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "ETag" : "\"0x8D7325B81C150A9\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:09.6557225Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "07339c19-301a-000d-2e44-645aef000000", + "x-ms-client-request-id" : "376b69a5-6ad0-471e-bfc7-735ad032211b", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.6557225Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344191?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bfcb4f1f-2259-4150-a1f8-f99fdaff71cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.7497235Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "ETag" : "\"0x8D7325B81CFA893\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:09.7497235Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c1c-301a-000d-3044-645aef000000", + "x-ms-client-request-id" : "bfcb4f1f-2259-4150-a1f8-f99fdaff71cd", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.7497235Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344191%2fdirectoryapitestslistfilesanddirectoriesargs053498344195", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "44227703-638a-49d2-90d2-d488bef89cbd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.8517269Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "ETag" : "\"0x8D7325B81DF3915\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:09.8517269Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "07339c1e-301a-000d-3144-645aef000000", + "x-ms-client-request-id" : "44227703-638a-49d2-90d2-d488bef89cbd", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.8517269Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344191%2fdirectoryapitestslistfilesanddirectoriesargs053498344196", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "18a6cd29-f186-42e9-8631-58cb88e719e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:09.9477355Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "ETag" : "\"0x8D7325B81EDDF6B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:09.9477355Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "07339c20-301a-000d-3344-645aef000000", + "x-ms-client-request-id" : "18a6cd29-f186-42e9-8631-58cb88e719e4", + "x-ms-file-last-write-time" : "2019-09-05T23:48:09.9477355Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f%2fdirectoryapitestslistfilesanddirectoriesargs053498344192", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9a909a8f-6ef4-40ed-bf0b-bbc61d8a55c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:10.0467335Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "ETag" : "\"0x8D7325B81FCFA87\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:10.0467335Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c21-301a-000d-3444-645aef000000", + "x-ms-client-request-id" : "9a909a8f-6ef4-40ed-bf0b-bbc61d8a55c3", + "x-ms-file-last-write-time" : "2019-09-05T23:48:10.0467335Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs0380123a8e7/directoryapitestslistfilesanddirectoriesargs091362b807f?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f811aa2a-255c-49a1-8714-1841788492dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c23-301a-000d-3644-645aef000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs053498344190directoryapitestslistfilesanddirectoriesargs053498344191directoryapitestslistfilesanddirectoriesargs0534983441921024", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "x-ms-client-request-id" : "f811aa2a-255c-49a1-8714-1841788492dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectoriesargs0380123a8e7", "directoryapitestslistfilesanddirectoriesargs091362b807f", "directoryapitestslistfilesanddirectoriesargs05349834419" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs1.json new file mode 100644 index 000000000000..414e8e9ca2f1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs1.json @@ -0,0 +1,320 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d3ded129-2e70-4a01-8684-9872c49c0837" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B823736CF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c26-301a-000d-3944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "x-ms-client-request-id" : "d3ded129-2e70-4a01-8684-9872c49c0837" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c06fa3cf-6b3d-46a3-a61e-bcc8cd9fdae4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:10.5377597Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:09 GMT", + "ETag" : "\"0x8D7325B8247E73D\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:10.5377597Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c28-301a-000d-3a44-645aef000000", + "x-ms-client-request-id" : "c06fa3cf-6b3d-46a3-a61e-bcc8cd9fdae4", + "x-ms-file-last-write-time" : "2019-09-05T23:48:10.5377597Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27690?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dd7b5786-5a5c-4f12-a4ed-ee665623cb6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:10.6387476Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B82575014\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:10.6387476Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c2a-301a-000d-3c44-645aef000000", + "x-ms-client-request-id" : "dd7b5786-5a5c-4f12-a4ed-ee665623cb6e", + "x-ms-file-last-write-time" : "2019-09-05T23:48:10.6387476Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27690%2fdirectoryapitestslistfilesanddirectoriesargs173601c27693", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a957f080-5170-4a91-83ff-f2671caf2971" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:10.7517523Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B82688E53\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:10.7517523Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "07339c2b-301a-000d-3d44-645aef000000", + "x-ms-client-request-id" : "a957f080-5170-4a91-83ff-f2671caf2971", + "x-ms-file-last-write-time" : "2019-09-05T23:48:10.7517523Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27690%2fdirectoryapitestslistfilesanddirectoriesargs173601c27694", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6e3debbf-ad6d-4792-a3b9-503cca32ce9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:10.8547537Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B827845D1\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:10.8547537Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "07339c2d-301a-000d-3f44-645aef000000", + "x-ms-client-request-id" : "6e3debbf-ad6d-4792-a3b9-503cca32ce9a", + "x-ms-file-last-write-time" : "2019-09-05T23:48:10.8547537Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27691?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c11c59c6-1ccc-4a3f-b443-e85712cc7d4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:10.9497581Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B8286C4ED\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:10.9497581Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c2e-301a-000d-4044-645aef000000", + "x-ms-client-request-id" : "c11c59c6-1ccc-4a3f-b443-e85712cc7d4d", + "x-ms-file-last-write-time" : "2019-09-05T23:48:10.9497581Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27691%2fdirectoryapitestslistfilesanddirectoriesargs173601c27695", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0310f762-aff6-4072-901a-6e48a2deb7a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:11.0517579Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B8296554B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:11.0517579Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "07339c2f-301a-000d-4144-645aef000000", + "x-ms-client-request-id" : "0310f762-aff6-4072-901a-6e48a2deb7a2", + "x-ms-file-last-write-time" : "2019-09-05T23:48:11.0517579Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27691%2fdirectoryapitestslistfilesanddirectoriesargs173601c27696", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "12fb3e6b-fbfb-4057-bd45-431c7ae5492d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:11.1527612Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B82A5BEBC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:11.1527612Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "07339c30-301a-000d-4244-645aef000000", + "x-ms-client-request-id" : "12fb3e6b-fbfb-4057-bd45-431c7ae5492d", + "x-ms-file-last-write-time" : "2019-09-05T23:48:11.1527612Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085%2fdirectoryapitestslistfilesanddirectoriesargs173601c27692", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "09dfbd63-7d53-4329-bd4f-72818dac2f65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:11.2597652Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "ETag" : "\"0x8D7325B82B61294\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:11.2597652Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c31-301a-000d-4344-645aef000000", + "x-ms-client-request-id" : "09dfbd63-7d53-4329-bd4f-72818dac2f65", + "x-ms-file-last-write-time" : "2019-09-05T23:48:11.2597652Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085?prefix=directoryapitestslistfilesanddirectoriesargs&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0cb567ec-6ff4-4147-8186-59e68a06a94c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c34-301a-000d-4644-645aef000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs1directoryapitestslistfilesanddirectoriesargs173601c276901!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzM2MDFjMjc2OTE-", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "x-ms-client-request-id" : "0cb567ec-6ff4-4147-8186-59e68a06a94c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085?prefix=directoryapitestslistfilesanddirectoriesargs&marker=1%2176%21ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzM2MDFjMjc2OTE-&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a68c6420-939d-4dab-b95a-1695914f3a18" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c35-301a-000d-4744-645aef000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs1!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzM2MDFjMjc2OTE-1directoryapitestslistfilesanddirectoriesargs173601c276911!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzM2MDFjMjc2OTI-", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "x-ms-client-request-id" : "a68c6420-939d-4dab-b95a-1695914f3a18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs10360314977/directoryapitestslistfilesanddirectoriesargs194178a3085?prefix=directoryapitestslistfilesanddirectoriesargs&marker=1%2176%21ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzM2MDFjMjc2OTI-&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b2f72bd6-e4ae-49a1-9d4e-2460dc586294" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c36-301a-000d-4844-645aef000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs1!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzM2MDFjMjc2OTI-1directoryapitestslistfilesanddirectoriesargs173601c276921024", + "Date" : "Thu, 05 Sep 2019 23:48:10 GMT", + "x-ms-client-request-id" : "b2f72bd6-e4ae-49a1-9d4e-2460dc586294", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectoriesargs10360314977", "directoryapitestslistfilesanddirectoriesargs194178a3085", "directoryapitestslistfilesanddirectoriesargs173601c2769" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs2.json new file mode 100644 index 000000000000..1ae60226b986 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs2.json @@ -0,0 +1,278 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "29910f4a-2140-4449-96f8-b8e5562b8859" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B830869E0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c3b-301a-000d-4d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "x-ms-client-request-id" : "29910f4a-2140-4449-96f8-b8e5562b8859" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "601c381b-8596-42fc-ad47-377ed3ed3d92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:11.9057801Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B8318A589\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:11.9057801Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c3e-301a-000d-4f44-645aef000000", + "x-ms-client-request-id" : "601c381b-8596-42fc-ad47-377ed3ed3d92", + "x-ms-file-last-write-time" : "2019-09-05T23:48:11.9057801Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e0?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6ef08b57-0810-453a-bb8f-d85b20e5f7bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.0067825Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B83280EF1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:12.0067825Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c3f-301a-000d-5044-645aef000000", + "x-ms-client-request-id" : "6ef08b57-0810-453a-bb8f-d85b20e5f7bd", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.0067825Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e0%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e4e00268-625e-4b45-a77f-dff69f07a9d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.1107890Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B8337EDB2\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:12.1107890Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "07339c40-301a-000d-5144-645aef000000", + "x-ms-client-request-id" : "e4e00268-625e-4b45-a77f-dff69f07a9d5", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.1107890Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e0%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e5e5daf1-616c-4e83-ae3d-8a6ae1dc5aad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.2137877Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B8347A515\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:12.2137877Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "07339c41-301a-000d-5244-645aef000000", + "x-ms-client-request-id" : "e5e5daf1-616c-4e83-ae3d-8a6ae1dc5aad", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.2137877Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e1?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "639c005b-eddc-496b-b8a4-03c1751fbf99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.3087912Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B83562428\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:12.3087912Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c44-301a-000d-5344-645aef000000", + "x-ms-client-request-id" : "639c005b-eddc-496b-b8a4-03c1751fbf99", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.3087912Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e1%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "67dc6db2-5db8-4398-8ad4-234781b790ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.4097962Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B83658DAA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:12.4097962Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "07339c45-301a-000d-5444-645aef000000", + "x-ms-client-request-id" : "67dc6db2-5db8-4398-8ad4-234781b790ef", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.4097962Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e1%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "654d7ba2-750e-4fa8-944f-5c8a166b5208" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.5107959Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:11 GMT", + "ETag" : "\"0x8D7325B8374F6F7\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:12.5107959Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "07339c47-301a-000d-5644-645aef000000", + "x-ms-client-request-id" : "654d7ba2-750e-4fa8-944f-5c8a166b5208", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.5107959Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded%2fdirectoryapitestslistfilesanddirectoriesargs298560a8f6e2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1a175667-3c1d-4c73-87de-0e7d004e6ab1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:12.6107990Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "ETag" : "\"0x8D7325B83843956\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:12.6107990Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "07339c49-301a-000d-5844-645aef000000", + "x-ms-client-request-id" : "1a175667-3c1d-4c73-87de-0e7d004e6ab1", + "x-ms-file-last-write-time" : "2019-09-05T23:48:12.6107990Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs2825485f744/directoryapitestslistfilesanddirectoriesargs2024994cded?prefix=noOp&maxresults=3&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "216e4028-1ddb-4427-afd1-be39c4a2e404" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c4a-301a-000d-5944-645aef000000", + "Body" : "noOp3", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "x-ms-client-request-id" : "216e4028-1ddb-4427-afd1-be39c4a2e404", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectoriesargs2825485f744", "directoryapitestslistfilesanddirectoriesargs2024994cded", "directoryapitestslistfilesanddirectoriesargs298560a8f6e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles0.json new file mode 100644 index 000000000000..074e729036c9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles0.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandles063066c755b15b8f2e4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0df355c4-1efb-46f7-b526-c68a138d7bd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B83BDB062\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c4e-301a-000d-5c44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "x-ms-client-request-id" : "0df355c4-1efb-46f7-b526-c68a138d7bd3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandles063066c755b15b8f2e4/directoryapitestslisthandles015492dc35e7cb789f4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e4cae6a3-00c4-415c-a963-453feb0514f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:13.0898142Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "ETag" : "\"0x8D7325B83CD50DE\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:13.0898142Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c50-301a-000d-5d44-645aef000000", + "x-ms-client-request-id" : "e4cae6a3-00c4-415c-a963-453feb0514f0", + "x-ms-file-last-write-time" : "2019-09-05T23:48:13.0898142Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandles063066c755b15b8f2e4/directoryapitestslisthandles015492dc35e7cb789f4?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bfc81413-200d-4a54-aa48-ce9aa75f8eea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c51-301a-000d-5e44-645aef000000", + "Body" : "2", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "x-ms-client-request-id" : "bfc81413-200d-4a54-aa48-ce9aa75f8eea", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslisthandles063066c755b15b8f2e4", "directoryapitestslisthandles015492dc35e7cb789f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles1.json new file mode 100644 index 000000000000..1ca6e9ec5268 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles1.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandles1317876b1f42ca21fe4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "565df075-a954-40f8-97f3-4aa352a50941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B840567F1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c54-301a-000d-6144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "x-ms-client-request-id" : "565df075-a954-40f8-97f3-4aa352a50941" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandles1317876b1f42ca21fe4/directoryapitestslisthandles13333387257e8172384?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "52d832d8-0342-4ba6-9d42-ef539bb02d7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:13.5608248Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:12 GMT", + "ETag" : "\"0x8D7325B84152FB8\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:13.5608248Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339c57-301a-000d-6344-645aef000000", + "x-ms-client-request-id" : "52d832d8-0342-4ba6-9d42-ef539bb02d7c", + "x-ms-file-last-write-time" : "2019-09-05T23:48:13.5608248Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandles1317876b1f42ca21fe4/directoryapitestslisthandles13333387257e8172384?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "be360f7e-02ba-410c-a0d1-2c19b6371b6b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339c58-301a-000d-6444-645aef000000", + "Body" : "", + "Date" : "Thu, 05 Sep 2019 23:48:13 GMT", + "x-ms-client-request-id" : "be360f7e-02ba-410c-a0d1-2c19b6371b6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslisthandles1317876b1f42ca21fe4", "directoryapitestslisthandles13333387257e8172384" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandlesError.json new file mode 100644 index 000000000000..8f3261be661b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandlesError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandleserror119838a1d8c02cd9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cd47fe92-1c80-4b44-b785-c4a76c629b81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B844DE2DD\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339c5c-301a-000d-6844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:13 GMT", + "x-ms-client-request-id" : "cd47fe92-1c80-4b44-b785-c4a76c629b81" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestslisthandleserror119838a1d8c02cd9/directoryapitestslisthandleserror674112f942a33a24?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8895af96-505f-4871-8415-e370093f87b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339c5e-301a-000d-6944-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339c5e-301a-000d-6944-645aef000000\nTime:2019-09-05T23:48:14.2664134Z", + "Date" : "Thu, 05 Sep 2019 23:48:13 GMT", + "x-ms-client-request-id" : "8895af96-505f-4871-8415-e370093f87b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslisthandleserror119838a1d8c02cd9", "directoryapitestslisthandleserror674112f942a33a24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadata.json new file mode 100644 index 000000000000..9893834b15ea --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadata.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadata98703b7addd36424e4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a99b612f-fb78-4407-94a6-b980c2368b35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7F8D4B65\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bde-301a-000d-7a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:05 GMT", + "x-ms-client-request-id" : "a99b612f-fb78-4407-94a6-b980c2368b35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadata98703b7addd36424e4/directoryapitestssetmetadata84115a3dc5bde5a8a4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8b1ba5a5-c33a-4566-8d2f-394c79990f58" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:06.0646313Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:05 GMT", + "ETag" : "\"0x8D7325B7F9D5BA9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:06.0646313Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339be0-301a-000d-7b44-645aef000000", + "x-ms-client-request-id" : "8b1ba5a5-c33a-4566-8d2f-394c79990f58", + "x-ms-file-last-write-time" : "2019-09-05T23:48:06.0646313Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadata98703b7addd36424e4/directoryapitestssetmetadata84115a3dc5bde5a8a4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "31524ee8-41c9-45ca-8311-7d90685a0f1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:06.0646313Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:05 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7325B7F9D5BA9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-09-05T23:48:06.0646313Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339be1-301a-000d-7c44-645aef000000", + "x-ms-client-request-id" : "31524ee8-41c9-45ca-8311-7d90685a0f1a", + "x-ms-file-last-write-time" : "2019-09-05T23:48:06.0646313Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadata98703b7addd36424e4/directoryapitestssetmetadata84115a3dc5bde5a8a4?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ccb7c1d9-06f0-464f-b7fd-407dd37fdda6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7FBAF67E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339be3-301a-000d-7e44-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:05 GMT", + "x-ms-client-request-id" : "ccb7c1d9-06f0-464f-b7fd-407dd37fdda6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadata98703b7addd36424e4/directoryapitestssetmetadata84115a3dc5bde5a8a4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3f6eda91-f5bf-4f1d-8fac-c3da6be060b1" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:06.0646313Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:05 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7325B7FBAF67E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:06.2586494Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339be5-301a-000d-8044-645aef000000", + "x-ms-client-request-id" : "3f6eda91-f5bf-4f1d-8fac-c3da6be060b1", + "x-ms-file-last-write-time" : "2019-09-05T23:48:06.0646313Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetmetadata98703b7addd36424e4", "directoryapitestssetmetadata84115a3dc5bde5a8a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadataError.json new file mode 100644 index 000000000000..47a3352c6065 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadataError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadataerror70952e8798a69069?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bc8e6a80-db0c-4df4-b36d-e62d1dcc2ee1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7FF3D573\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339be8-301a-000d-0344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "x-ms-client-request-id" : "bc8e6a80-db0c-4df4-b36d-e62d1dcc2ee1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadataerror70952e8798a69069/directoryapitestssetmetadataerror339708f1cb273489?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4e00a1fd-50d3-4510-ae9b-37cabaddf36a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:06.7426480Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "ETag" : "\"0x8D7325B8004D0B0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:06.7426480Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339beb-301a-000d-0544-645aef000000", + "x-ms-client-request-id" : "4e00a1fd-50d3-4510-ae9b-37cabaddf36a", + "x-ms-file-last-write-time" : "2019-09-05T23:48:06.7426480Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetmetadataerror70952e8798a69069/directoryapitestssetmetadataerror339708f1cb273489?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ec228c68-e06f-400a-b344-7d2640d93292" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339bec-301a-000d-0644-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339bec-301a-000d-0644-645aef000000\nTime:2019-09-05T23:48:06.8343672Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:06 GMT", + "x-ms-client-request-id" : "ec228c68-e06f-400a-b344-7d2640d93292", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetmetadataerror70952e8798a69069", "directoryapitestssetmetadataerror339708f1cb273489" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesError0.json new file mode 100644 index 000000000000..5f6fe03039c9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesError0.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertieserror047099db93f2c92?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5c565ebd-2086-4705-80b6-98187e7372bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7F11D999\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bd0-301a-000d-7044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:04 GMT", + "x-ms-client-request-id" : "5c565ebd-2086-4705-80b6-98187e7372bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertieserror047099db93f2c92/directoryapitestssetpropertieserror0134296aea4763f?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "999f09d9-3d94-45bf-b909-e4ac043cb1bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:05.2546084Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:04 GMT", + "ETag" : "\"0x8D7325B7F21C224\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:05.2546084Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bd2-301a-000d-7144-645aef000000", + "x-ms-client-request-id" : "999f09d9-3d94-45bf-b909-e4ac043cb1bb", + "x-ms-file-last-write-time" : "2019-09-05T23:48:05.2546084Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetpropertieserror047099db93f2c92", "directoryapitestssetpropertieserror0134296aea4763f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesError1.json new file mode 100644 index 000000000000..ddf992490da5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesError1.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertieserror120208f9727570f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7294793e-8384-4a50-955a-a3023bf10f89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7F4EBBB0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bd5-301a-000d-7444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:04 GMT", + "x-ms-client-request-id" : "7294793e-8384-4a50-955a-a3023bf10f89" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertieserror120208f9727570f/directoryapitestssetpropertieserror19220913b91af4b?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2c55aef6-027e-472a-baf6-d8991a3b624b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:05.6566174Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:05 GMT", + "ETag" : "\"0x8D7325B7F5F199E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:05.6566174Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bda-301a-000d-7644-645aef000000", + "x-ms-client-request-id" : "2c55aef6-027e-472a-baf6-d8991a3b624b", + "x-ms-file-last-write-time" : "2019-09-05T23:48:05.6566174Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetpropertieserror120208f9727570f", "directoryapitestssetpropertieserror19220913b91af4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesFilePermission.json new file mode 100644 index 000000000000..2c230d1ece2e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesFilePermission.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermission825870ade5?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "953a3d6c-6667-4be7-87e8-636901fbd30b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7E64A945\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bb4-301a-000d-6044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:03 GMT", + "x-ms-client-request-id" : "953a3d6c-6667-4be7-87e8-636901fbd30b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermission825870ade5/directoryapitestssetpropertiesfilepermission7103339072?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "07fcaa45-037c-4fdb-a09f-d4c357c1db95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:04.1235793Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:03 GMT", + "ETag" : "\"0x8D7325B7E752D51\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:04.1235793Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bb7-301a-000d-6244-645aef000000", + "x-ms-client-request-id" : "07fcaa45-037c-4fdb-a09f-d4c357c1db95", + "x-ms-file-last-write-time" : "2019-09-05T23:48:04.1235793Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermission825870ade5/directoryapitestssetpropertiesfilepermission7103339072?restype=directory&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3bdb6647-b44d-470a-878f-24a2c09cd8ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:04.1235793Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:04 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:03 GMT", + "ETag" : "\"0x8D7325B7E86B995\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:04.2385813Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bb9-301a-000d-6444-645aef000000", + "x-ms-client-request-id" : "3bdb6647-b44d-470a-878f-24a2c09cd8ab", + "x-ms-file-last-write-time" : "2019-09-05T23:48:04.1235793Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetpropertiesfilepermission825870ade5", "directoryapitestssetpropertiesfilepermission7103339072" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesFilePermissionKey.json new file mode 100644 index 000000000000..236ccae75177 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetPropertiesFilePermissionKey.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermissionkey52799b729?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c2ed6d84-2328-40b4-a965-ac0191887e7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7EB33E9C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bc4-301a-000d-6744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:03 GMT", + "x-ms-client-request-id" : "c2ed6d84-2328-40b4-a965-ac0191887e7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermissionkey52799b729?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4e429dd5-7f28-4662-b7ea-eab7dcd7bf10", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339bc7-301a-000d-6944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:04 GMT", + "x-ms-client-request-id" : "4e429dd5-7f28-4662-b7ea-eab7dcd7bf10" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermissionkey52799b729/directoryapitestssetpropertiesfilepermissionkey24672b4ab?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "80628ad5-5a08-4ec9-a438-b175455a1142" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:04.7315952Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:04 GMT", + "ETag" : "\"0x8D7325B7ED1F3F0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:04.7315952Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bca-301a-000d-6b44-645aef000000", + "x-ms-client-request-id" : "80628ad5-5a08-4ec9-a438-b175455a1142", + "x-ms-file-last-write-time" : "2019-09-05T23:48:04.7315952Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryapitestssetpropertiesfilepermissionkey52799b729/directoryapitestssetpropertiesfilepermissionkey24672b4ab?restype=directory&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9b161f41-722a-4dcd-9ff8-e702409319a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:04.6860000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:04 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:04 GMT", + "ETag" : "\"0x8D7325B7EE1364F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:04.8315983Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339bcc-301a-000d-6c44-645aef000000", + "x-ms-client-request-id" : "9b161f41-722a-4dcd-9ff8-e702409319a7", + "x-ms-file-last-write-time" : "2019-09-05T23:48:04.6860000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetpropertiesfilepermissionkey52799b729", "directoryapitestssetpropertiesfilepermissionkey24672b4ab", "2019-09-05T23:48:04.686Z", "2019-09-05T23:48:04.686Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirPermissionAndKeyError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirPermissionAndKeyError0.json new file mode 100644 index 000000000000..6b9518ef3a28 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirPermissionAndKeyError0.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirpermissionandkeyerror0277026?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D70E212C95F\"", + "Last-Modified" : "Fri, 30 Aug 2019 17:38:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d6143ed5-401a-0007-5f59-5ffe58000000", + "Date" : "Fri, 30 Aug 2019 17:38:33 GMT", + "x-ms-client-request-id" : "c4ef0eef-f0b3-495d-a8b9-97fc61e5b13d" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirpermissionandkeyerror0277026", "directoryasyncapitestscreatedirpermissionandkeyerror0450608" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirPermissionAndKeyError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirPermissionAndKeyError1.json new file mode 100644 index 000000000000..77f93bc5b0b8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirPermissionAndKeyError1.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirpermissionandkeyerror136394a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D70E2625B48\"", + "Last-Modified" : "Fri, 30 Aug 2019 17:38:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d6143eda-401a-0007-6259-5ffe58000000", + "Date" : "Fri, 30 Aug 2019 17:38:34 GMT", + "x-ms-client-request-id" : "537d8b1f-ca6d-4cb8-a52d-96a44f211240" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirpermissionandkeyerror136394a", "directoryasyncapitestscreatedirpermissionandkeyerror1759121" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirWithFilePermKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirWithFilePermKey.json new file mode 100644 index 000000000000..f8f349158751 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirWithFilePermKey.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirwithfilepermkey8289545e0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "63d7d850-2f9c-42a0-bb6e-b076b3e6c3ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA635CF44\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b5f-601a-0000-5b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:09 GMT", + "x-ms-client-request-id" : "63d7d850-2f9c-42a0-bb6e-b076b3e6c3ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirwithfilepermkey8289545e0?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "340d6129-fdb3-49a6-872b-9f6dff410634", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b64-601a-0000-5f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:10 GMT", + "x-ms-client-request-id" : "340d6129-fdb3-49a6-872b-9f6dff410634" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirwithfilepermkey8289545e0/directoryasyncapitestscreatedirwithfilepermkey300182345?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a9476595-567e-495d-b305-0c0d65eb5d15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:10.9640000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:10 GMT", + "ETag" : "\"0x8D7325BA64C3740\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:10.9640000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45b66-601a-0000-6144-64923b000000", + "x-ms-client-request-id" : "a9476595-567e-495d-b305-0c0d65eb5d15", + "x-ms-file-last-write-time" : "2019-09-05T23:49:10.9640000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirwithfilepermkey8289545e0", "directoryasyncapitestscreatedirwithfilepermkey300182345", "2019-09-05T23:49:10.964Z", "2019-09-05T23:49:10.964Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectory.json new file mode 100644 index 000000000000..cbf2102beaec --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectory.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectory18961719a2c85b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f2f5f5b3-9d20-40bc-bb2f-1509c8c10cd4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA4E4BD8A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45afd-601a-0000-0244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:07 GMT", + "x-ms-client-request-id" : "f2f5f5b3-9d20-40bc-bb2f-1509c8c10cd4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectory18961719a2c85b/directoryasyncapitestscreatedirectory4497387b12c488?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "aff8a142-ac52-4f7b-8f9c-81e6ccaca539" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:08.7072575Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:07 GMT", + "ETag" : "\"0x8D7325BA4F3DD3F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:08.7072575Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45b02-601a-0000-0644-64923b000000", + "x-ms-client-request-id" : "aff8a142-ac52-4f7b-8f9c-81e6ccaca539", + "x-ms-file-last-write-time" : "2019-09-05T23:49:08.7072575Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectory18961719a2c85b", "directoryasyncapitestscreatedirectory4497387b12c488" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryError.json new file mode 100644 index 000000000000..61bd73b3d042 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectoryerror43330167f9a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b40c898a-d363-49dc-bbc8-cdc3d2a89e45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA51EB978\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b0b-601a-0000-0f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:08 GMT", + "x-ms-client-request-id" : "b40c898a-d363-49dc-bbc8-cdc3d2a89e45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectoryerror284317b123d/directoryasyncapitestscreatedirectoryerror67151e583c5?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0ccb6f23-4368-4e37-9c9b-64cf68b79f29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c45b0f-601a-0000-1244-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c45b0f-601a-0000-1244-64923b000000\nTime:2019-09-05T23:49:09.1391462Z", + "Date" : "Thu, 05 Sep 2019 23:49:08 GMT", + "x-ms-client-request-id" : "0ccb6f23-4368-4e37-9c9b-64cf68b79f29", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectoryerror43330167f9a", "directoryasyncapitestscreatedirectoryerror67151e583c5", "directoryasyncapitestscreatedirectoryerror284317b123d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryErrorWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryErrorWithMetadata.json new file mode 100644 index 000000000000..26ba906f09ba --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryErrorWithMetadata.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectoryerrorwithmetadata62422?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "286aa742-1449-4ac4-a147-20277ba1ba7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA5B3F4DD\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b35-601a-0000-3644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:09 GMT", + "x-ms-client-request-id" : "286aa742-1449-4ac4-a147-20277ba1ba7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectoryerrorwithmetadata62422/directoryasyncapitestscreatedirectoryerrorwithmetadata98530?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b4afface-6fba-4e8f-a1f7-62b6c1369d3a" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "963", + "StatusCode" : "403", + "x-ms-request-id" : "36c45b3b-601a-0000-3a44-64923b000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:36c45b3b-601a-0000-3a44-64923b000000\nTime:2019-09-05T23:49:10.1721553ZThe MAC signature found in the HTTP request 'WCYVzYpzy1gxV4siXE0zCleTDhjVtER9bmtWHyugB5c=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 05 Sep 2019 23:49:10 GMT\n\n\n\n\n\nx-ms-client-request-id:b4afface-6fba-4e8f-a1f7-62b6c1369d3a\nx-ms-file-attributes:None\nx-ms-file-creation-time:Now\nx-ms-file-last-write-time:Now\nx-ms-file-permission:Inherit\nx-ms-meta-testmeta:value\nx-ms-version:2019-02-02\n/gapradev/directoryasyncapitestscreatedirectoryerrorwithmetadata62422/directoryasyncapitestscreatedirectoryerrorwithmetadata98530\nrestype:directory'.", + "Date" : "Thu, 05 Sep 2019 23:49:09 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectoryerrorwithmetadata62422", "directoryasyncapitestscreatedirectoryerrorwithmetadata98530" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryPermissionAndKeyError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryPermissionAndKeyError0.json new file mode 100644 index 000000000000..a1c49f514832 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryPermissionAndKeyError0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/6243d4f0be024f66a51837291984e36df6007cb32c9846d38634373259100726?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "0153d56d-301a-0040-7659-5f9503000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:0153d56d-301a-0040-7659-5f9503000000\nTime:2019-08-30T17:38:08.8583821Z", + "Date" : "Fri, 30 Aug 2019 17:38:08 GMT", + "x-ms-client-request-id" : "499316b7-60b3-4760-932a-912a500ff93c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "6243d4f0be024f66a51837291984e36df6007cb32c9846d38634373259100726", "e34cc16f4b72443891aaef091d2bfa00fd5c4580c3c94abba2b7e58f74e076bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryPermissionAndKeyError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryPermissionAndKeyError1.json new file mode 100644 index 000000000000..efa103227731 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryPermissionAndKeyError1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/b07ed56828ee4d8c8de2aaa7f25dc0677dd67304cd874df5b449ea8509098a42?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "0153d584-301a-0040-0a59-5f9503000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:0153d584-301a-0040-0a59-5f9503000000\nTime:2019-08-30T17:38:09.3323893Z", + "Date" : "Fri, 30 Aug 2019 17:38:08 GMT", + "x-ms-client-request-id" : "aad0e558-356a-4297-8e84-91d864ead27f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "b07ed56828ee4d8c8de2aaa7f25dc0677dd67304cd874df5b449ea8509098a42", "41bebd890661465994a9647703675d5dea1d9c56bb194e0bb3da75c056ed4bf2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermKey.json new file mode 100644 index 000000000000..b475f20a4b73 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermKey.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectorywithfilepermkey63098c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D6E585F4035\"", + "Last-Modified" : "Fri, 30 Aug 2019 17:20:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f2556d82-901a-003b-1957-5fd79f000000", + "Date" : "Fri, 30 Aug 2019 17:20:24 GMT", + "x-ms-client-request-id" : "52cf64e2-b36a-480e-b8bf-63116f8c32f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectorywithfilepermkey63098c/directoryasyncapitestscreatedirectorywithfilepermkey189691?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-30T17:20:24.9050000Z", + "Last-Modified" : "Fri, 30 Aug 2019 17:20:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 30 Aug 2019 17:20:24 GMT", + "ETag" : "\"0x8D72D6E58679390\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-30T17:20:24.9050000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "f2556d84-901a-003b-1a57-5fd79f000000", + "x-ms-client-request-id" : "51a35349-923c-43db-bf14-54c2f1cad7d8", + "x-ms-file-last-write-time" : "2019-08-30T17:20:24.9050000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectorywithfilepermkey63098c", "directoryasyncapitestscreatedirectorywithfilepermkey189691", "2019-08-30T17:20:24.905Z", "2019-08-30T17:20:24.905Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermission.json new file mode 100644 index 000000000000..2317a5ebf8d2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermission.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectorywithfilepermission00147?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8295fce9-e224-4911-aa80-1b632134fe90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA5FC96B8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b4c-601a-0000-4944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:09 GMT", + "x-ms-client-request-id" : "8295fce9-e224-4911-aa80-1b632134fe90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectorywithfilepermission00147/directoryasyncapitestscreatedirectorywithfilepermission00656?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a8180b0d-dd69-4fad-981c-12e0b28321c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:10.5433064Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:09 GMT", + "ETag" : "\"0x8D7325BA60C05E8\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:10.5433064Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45b53-601a-0000-4f44-64923b000000", + "x-ms-client-request-id" : "a8180b0d-dd69-4fad-981c-12e0b28321c2", + "x-ms-file-last-write-time" : "2019-09-05T23:49:10.5433064Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectorywithfilepermission00147", "directoryasyncapitestscreatedirectorywithfilepermission00656" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermissionKey.json new file mode 100644 index 000000000000..239be3a34275 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithFilePermissionKey.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/34d0a16735cd469ab7234db9808a006485a0c445b4c248ae99921794ea9c06d8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "c0eb288b-c01a-0026-7456-5fda23000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:c0eb288b-c01a-0026-7456-5fda23000000\nTime:2019-08-30T17:18:34.3649242Z", + "Date" : "Fri, 30 Aug 2019 17:18:33 GMT", + "x-ms-client-request-id" : "756bc794-de99-467f-a06c-1bd15ffecdcc", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "34d0a16735cd469ab7234db9808a006485a0c445b4c248ae99921794ea9c06d8", "3390a5e251ed4e05910ff2874c974033fe01b72598244499a1e73d95a41b46f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithMetadata.json new file mode 100644 index 000000000000..6d1c648e73cd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithMetadata.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectorywithmetadata63346a9e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6a5620d5-1baa-49c5-b6dc-52f44bcd448e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA5600841\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b20-601a-0000-2344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:08 GMT", + "x-ms-client-request-id" : "6a5620d5-1baa-49c5-b6dc-52f44bcd448e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatedirectorywithmetadata63346a9e/directoryasyncapitestscreatedirectorywithmetadata32553d0c?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b68cf929-7a36-4111-9522-1ccd92eb8d89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:09.5142830Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:08 GMT", + "ETag" : "\"0x8D7325BA56F01AE\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:09.5142830Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45b25-601a-0000-2744-64923b000000", + "x-ms-client-request-id" : "b68cf929-7a36-4111-9522-1ccd92eb8d89", + "x-ms-file-last-write-time" : "2019-09-05T23:49:09.5142830Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectorywithmetadata63346a9e", "directoryasyncapitestscreatedirectorywithmetadata32553d0c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFile.json new file mode 100644 index 000000000000..907a69dd0538 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFile.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefile58943b2c51b2c3e8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3550846e-1f99-47c1-b608-7fc51a270648" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAFEA1CC5\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45e69-601a-0000-3144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:26 GMT", + "x-ms-client-request-id" : "3550846e-1f99-47c1-b608-7fc51a270648" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefile58943b2c51b2c3e8/directoryasyncapitestscreatefile22409a4ac4f67669?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "60a33728-0b7f-41fd-935c-da6c43a96f94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:27.2027395Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:26 GMT", + "ETag" : "\"0x8D7325BAFFA0D03\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:27.2027395Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e6d-601a-0000-3444-64923b000000", + "x-ms-client-request-id" : "60a33728-0b7f-41fd-935c-da6c43a96f94", + "x-ms-file-last-write-time" : "2019-09-05T23:49:27.2027395Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefile58943b2c51b2c3e8/directoryasyncapitestscreatefile22409a4ac4f67669%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d271c879-648d-4dc0-b2c8-2fb22b4d3d7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:27.3097426Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:26 GMT", + "ETag" : "\"0x8D7325BB00A60D2\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:27.3097426Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e71-601a-0000-3844-64923b000000", + "x-ms-client-request-id" : "d271c879-648d-4dc0-b2c8-2fb22b4d3d7d", + "x-ms-file-last-write-time" : "2019-09-05T23:49:27.3097426Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefile58943b2c51b2c3e8", "directoryasyncapitestscreatefile22409a4ac4f67669" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..7ed424737e5d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs05611192513?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5318bd10-de3c-4a81-8ff4-8beb254f8dbb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB0375252\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45e7b-601a-0000-4244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:26 GMT", + "x-ms-client-request-id" : "5318bd10-de3c-4a81-8ff4-8beb254f8dbb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs05611192513/directoryasyncapitestscreatefileinvalidargs025853f597d?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bd042d41-dff1-4ded-a7c6-e7bdf22c13ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:27.7077585Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:26 GMT", + "ETag" : "\"0x8D7325BB0471C51\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:27.7077585Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e81-601a-0000-4744-64923b000000", + "x-ms-client-request-id" : "bd042d41-dff1-4ded-a7c6-e7bdf22c13ca", + "x-ms-file-last-write-time" : "2019-09-05T23:49:27.7077585Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs05611192513/directoryasyncapitestscreatefileinvalidargs025853f597d%2ftestfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0da9aa28-997c-4ea4-9b0c-f48ee1b65002" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "36c45e84-601a-0000-4a44-64923b000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:36c45e84-601a-0000-4a44-64923b000000\nTime:2019-09-05T23:49:27.8192884Z", + "Date" : "Thu, 05 Sep 2019 23:49:26 GMT", + "x-ms-client-request-id" : "0da9aa28-997c-4ea4-9b0c-f48ee1b65002", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefileinvalidargs05611192513", "directoryasyncapitestscreatefileinvalidargs025853f597d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..3d59bb5233a5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs1840836a3e2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e32fe102-d990-470d-b8e5-bd2808072c4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB081A1F1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45e90-601a-0000-5544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:27 GMT", + "x-ms-client-request-id" : "e32fe102-d990-470d-b8e5-bd2808072c4d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs1840836a3e2/directoryasyncapitestscreatefileinvalidargs198122e9b81?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "51d98808-1a6e-403b-849c-a188e179b0b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:28.1887647Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:27 GMT", + "ETag" : "\"0x8D7325BB090819F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:28.1887647Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e94-601a-0000-5844-64923b000000", + "x-ms-client-request-id" : "51d98808-1a6e-403b-849c-a188e179b0b3", + "x-ms-file-last-write-time" : "2019-09-05T23:49:28.1887647Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs1840836a3e2/directoryasyncapitestscreatefileinvalidargs198122e9b81%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9b65eb28-37b9-4855-9bdf-385c66575cfc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "36c45e96-601a-0000-5a44-64923b000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:36c45e96-601a-0000-5a44-64923b000000\nTime:2019-09-05T23:49:28.2822888Z", + "Date" : "Thu, 05 Sep 2019 23:49:27 GMT", + "x-ms-client-request-id" : "9b65eb28-37b9-4855-9bdf-385c66575cfc", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefileinvalidargs1840836a3e2", "directoryasyncapitestscreatefileinvalidargs198122e9b81" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..651e86988804 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverload.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverload69884dac78c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "81e88440-58ff-406d-94f4-f187d8f61c21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB0C7F9EF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45e9f-601a-0000-6344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:27 GMT", + "x-ms-client-request-id" : "81e88440-58ff-406d-94f4-f187d8f61c21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverload69884dac78c/directoryasyncapitestscreatefilemaxoverload0513903fee2?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a30ceeb5-3390-40a3-b8e7-004df109895a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:28.6527784Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:27 GMT", + "ETag" : "\"0x8D7325BB0D74F28\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:28.6527784Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ea4-601a-0000-6744-64923b000000", + "x-ms-client-request-id" : "a30ceeb5-3390-40a3-b8e7-004df109895a", + "x-ms-file-last-write-time" : "2019-09-05T23:49:28.6527784Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverload69884dac78c/directoryasyncapitestscreatefilemaxoverload0513903fee2%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "708e5fd0-b2af-43c6-9940-3de33ef5e669" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:28.7080000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:27 GMT", + "ETag" : "\"0x8D7325BB0DFBC40\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:28.7080000Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ea6-601a-0000-6944-64923b000000", + "x-ms-client-request-id" : "708e5fd0-b2af-43c6-9940-3de33ef5e669", + "x-ms-file-last-write-time" : "2019-09-05T23:49:28.7080000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverload69884dac78c", "directoryasyncapitestscreatefilemaxoverload0513903fee2", "2019-09-05T23:49:28.708Z", "2019-09-05T23:49:28.708Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..b1ae9972f9e1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs078330?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4f9c58d0-0bc0-4b24-81b9-3cfd20688f88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB11074B8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45eb2-601a-0000-7544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:28 GMT", + "x-ms-client-request-id" : "4f9c58d0-0bc0-4b24-81b9-3cfd20688f88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs078330/directoryasyncapitestscreatefilemaxoverloadinvalidargs085623?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "01039485-a90b-44f0-ae27-287806df49cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:29.1317905Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:28 GMT", + "ETag" : "\"0x8D7325BB1206691\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:29.1317905Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45eb6-601a-0000-7844-64923b000000", + "x-ms-client-request-id" : "01039485-a90b-44f0-ae27-287806df49cf", + "x-ms-file-last-write-time" : "2019-09-05T23:49:29.1317905Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs078330/directoryasyncapitestscreatefilemaxoverloadinvalidargs085623%2ftestfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4824c66f-e38a-4302-87c3-96346055008f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "36c45eb7-601a-0000-7944-64923b000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:36c45eb7-601a-0000-7944-64923b000000\nTime:2019-09-05T23:49:29.2362964Z", + "Date" : "Thu, 05 Sep 2019 23:49:28 GMT", + "x-ms-client-request-id" : "4824c66f-e38a-4302-87c3-96346055008f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs078330", "directoryasyncapitestscreatefilemaxoverloadinvalidargs085623" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..13f83156bcff --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs137869?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a434a908-5e04-425b-957e-8b99c524f28e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB159B2DF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45ec0-601a-0000-0244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:28 GMT", + "x-ms-client-request-id" : "a434a908-5e04-425b-957e-8b99c524f28e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs137869/directoryasyncapitestscreatefilemaxoverloadinvalidargs100449?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "47c54b7c-1635-4c69-83c2-21db0f0472c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:29.6088031Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:28 GMT", + "ETag" : "\"0x8D7325BB1692FDF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:29.6088031Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ec5-601a-0000-0644-64923b000000", + "x-ms-client-request-id" : "47c54b7c-1635-4c69-83c2-21db0f0472c5", + "x-ms-file-last-write-time" : "2019-09-05T23:49:29.6088031Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs137869/directoryasyncapitestscreatefilemaxoverloadinvalidargs100449%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7ae407bb-b816-4690-b333-4fe7c76865a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "36c45ec8-601a-0000-0944-64923b000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:36c45ec8-601a-0000-0944-64923b000000\nTime:2019-09-05T23:49:29.7003046Z", + "Date" : "Thu, 05 Sep 2019 23:49:28 GMT", + "x-ms-client-request-id" : "7ae407bb-b816-4690-b333-4fe7c76865a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs137869", "directoryasyncapitestscreatefilemaxoverloadinvalidargs100449" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..2b8bb0a7a840 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs246153?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f4a59d86-2cff-448f-8661-dd5a0b57cb5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB19F6E9A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45ed3-601a-0000-1344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:29 GMT", + "x-ms-client-request-id" : "f4a59d86-2cff-448f-8661-dd5a0b57cb5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs246153/directoryasyncapitestscreatefilemaxoverloadinvalidargs235350?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "644ae563-6818-4962-a49e-834175894d0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:30.0658154Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:29 GMT", + "ETag" : "\"0x8D7325BB1AEEBEA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:30.0658154Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ed7-601a-0000-1544-64923b000000", + "x-ms-client-request-id" : "644ae563-6818-4962-a49e-834175894d0f", + "x-ms-file-last-write-time" : "2019-09-05T23:49:30.0658154Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs246153/directoryasyncapitestscreatefilemaxoverloadinvalidargs235350%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4b320b4b-1875-451f-a925-a0b6a50d1d38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "310", + "StatusCode" : "400", + "x-ms-request-id" : "36c45ed9-601a-0000-1744-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c45ed9-601a-0000-1744-64923b000000\nTime:2019-09-05T23:49:30.1663038Zx-ms-content-md5", + "Date" : "Thu, 05 Sep 2019 23:49:29 GMT", + "x-ms-client-request-id" : "4b320b4b-1875-451f-a925-a0b6a50d1d38", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs246153", "directoryasyncapitestscreatefilemaxoverloadinvalidargs235350" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..d4ecb0969adb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs307519?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "15144de3-9a88-4363-aa56-fb701e6be6c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB1E6FEF9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45ee4-601a-0000-2044-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:29 GMT", + "x-ms-client-request-id" : "15144de3-9a88-4363-aa56-fb701e6be6c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs307519/directoryasyncapitestscreatefilemaxoverloadinvalidargs372882?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dc54ce6f-a887-460b-86da-01fafe9937b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:30.5318258Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:29 GMT", + "ETag" : "\"0x8D7325BB1F60772\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:30.5318258Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ee7-601a-0000-2244-64923b000000", + "x-ms-client-request-id" : "dc54ce6f-a887-460b-86da-01fafe9937b8", + "x-ms-file-last-write-time" : "2019-09-05T23:49:30.5318258Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs307519/directoryasyncapitestscreatefilemaxoverloadinvalidargs372882%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fd455848-c20b-4531-82e7-66373309d552" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c45eee-601a-0000-2944-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c45eee-601a-0000-2944-64923b000000\nTime:2019-09-05T23:49:30.6283076Zvalue", + "Date" : "Thu, 05 Sep 2019 23:49:29 GMT", + "x-ms-client-request-id" : "fd455848-c20b-4531-82e7-66373309d552", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs307519", "directoryasyncapitestscreatefilemaxoverloadinvalidargs372882" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectory.json new file mode 100644 index 000000000000..aa6304ab15d1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectory.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectory681293c5b8a5?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5d0ecfcc-05da-4b64-bee4-2d9ba359494b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAD8E9F6E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45da8-601a-0000-7d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "x-ms-client-request-id" : "5d0ecfcc-05da-4b64-bee4-2d9ba359494b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectory681293c5b8a5/directoryasyncapitestscreatesubdirectory30165144935a?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "47ebb493-5433-49da-99c1-23c135b38eaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:23.2436401Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "ETag" : "\"0x8D7325BAD9DF0B1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:23.2436401Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45dab-601a-0000-7f44-64923b000000", + "x-ms-client-request-id" : "47ebb493-5433-49da-99c1-23c135b38eaf", + "x-ms-file-last-write-time" : "2019-09-05T23:49:23.2436401Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectory681293c5b8a5/directoryasyncapitestscreatesubdirectory30165144935a%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0fea0cd5-59d0-4650-a4a7-83411e73968d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:23.3416405Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "ETag" : "\"0x8D7325BADACE4D5\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:23.3416405Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45dad-601a-0000-0144-64923b000000", + "x-ms-client-request-id" : "0fea0cd5-59d0-4650-a4a7-83411e73968d", + "x-ms-file-last-write-time" : "2019-09-05T23:49:23.3416405Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectory681293c5b8a5", "directoryasyncapitestscreatesubdirectory30165144935a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermKey.json new file mode 100644 index 000000000000..7f8b4b746dcc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermKey.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermkey13503aa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ba4d81ba-cb96-4e76-9a46-71218fcc5abe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732E350AA923B\"", + "Last-Modified" : "Fri, 06 Sep 2019 16:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "350ba241-701a-001c-4ecc-64c05b000000", + "Date" : "Fri, 06 Sep 2019 16:00:17 GMT", + "x-ms-client-request-id" : "ba4d81ba-cb96-4e76-9a46-71218fcc5abe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermkey13503aa?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "687a1f20-f1dd-48ec-848a-9a8a8a4155f3", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "350ba247-701a-001c-51cc-64c05b000000", + "Date" : "Fri, 06 Sep 2019 16:00:18 GMT", + "x-ms-client-request-id" : "687a1f20-f1dd-48ec-848a-9a8a8a4155f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermkey13503aa/directoryasyncapitestscreatesubdirectoryfilepermkey0612861?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "deec0ced-b313-4c23-83cc-a71f021e87d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-06T16:00:19.4346571Z", + "Last-Modified" : "Fri, 06 Sep 2019 16:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 16:00:18 GMT", + "ETag" : "\"0x8D732E351033E4B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-06T16:00:19.4346571Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "350ba24a-701a-001c-54cc-64c05b000000", + "x-ms-client-request-id" : "deec0ced-b313-4c23-83cc-a71f021e87d9", + "x-ms-file-last-write-time" : "2019-09-06T16:00:19.4346571Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermkey13503aa/directoryasyncapitestscreatesubdirectoryfilepermkey0612861%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "28b4cf56-0bc7-4b3c-889d-4c1e7c6f6497" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-06T16:00:19.3790000Z", + "Last-Modified" : "Fri, 06 Sep 2019 16:00:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 16:00:18 GMT", + "ETag" : "\"0x8D732E350FAC030\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-06T16:00:19.3790000Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "350ba24d-701a-001c-57cc-64c05b000000", + "x-ms-client-request-id" : "28b4cf56-0bc7-4b3c-889d-4c1e7c6f6497", + "x-ms-file-last-write-time" : "2019-09-06T16:00:19.3790000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectoryfilepermkey13503aa", "directoryasyncapitestscreatesubdirectoryfilepermkey0612861", "2019-09-06T16:00:19.379Z", "2019-09-06T16:00:19.379Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermission.json new file mode 100644 index 000000000000..7d859b130724 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermission.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermission28142?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e1b93c6a-6693-4365-b22a-08dd6e831ff7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAEB370DD\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45dff-601a-0000-4f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:24 GMT", + "x-ms-client-request-id" : "e1b93c6a-6693-4365-b22a-08dd6e831ff7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermission28142/directoryasyncapitestscreatesubdirectoryfilepermission04127?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7ac31ffe-c81e-4127-934e-4676ca125c35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:25.1706880Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:24 GMT", + "ETag" : "\"0x8D7325BAEC3FC00\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:25.1706880Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e06-601a-0000-5544-64923b000000", + "x-ms-client-request-id" : "7ac31ffe-c81e-4127-934e-4676ca125c35", + "x-ms-file-last-write-time" : "2019-09-05T23:49:25.1706880Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryfilepermission28142/directoryasyncapitestscreatesubdirectoryfilepermission04127%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1429b750-10d7-4a18-a07a-1555654fa756" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:25.2696895Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:24 GMT", + "ETag" : "\"0x8D7325BAED3173F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:25.2696895Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e0b-601a-0000-5944-64923b000000", + "x-ms-client-request-id" : "1429b750-10d7-4a18-a07a-1555654fa756", + "x-ms-file-last-write-time" : "2019-09-05T23:49:25.2696895Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectoryfilepermission28142", "directoryasyncapitestscreatesubdirectoryfilepermission04127" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermissionKey.json new file mode 100644 index 000000000000..de164a13b071 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryFilePermissionKey.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/a2b925ff3375494c979daf26ccf3503bd3abd0cd9ff44eeaaab8fe39b051b345?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "c0eb2968-c01a-0026-2e56-5fda23000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:c0eb2968-c01a-0026-2e56-5fda23000000\nTime:2019-08-30T17:18:45.0680208Z", + "Date" : "Fri, 30 Aug 2019 17:18:44 GMT", + "x-ms-client-request-id" : "793611eb-bf7d-49a9-8208-123385e59346", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "a2b925ff3375494c979daf26ccf3503bd3abd0cd9ff44eeaaab8fe39b051b345", "e1bf4bb0512d43b58a450c8319b1c8f6914bdb7162f247d48c858b7be1f2c881" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryInvalidName.json new file mode 100644 index 000000000000..b3e6bb6cda81 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryInvalidName.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryinvalidname33154dd?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "583e17c7-1a05-4ca6-8ce3-ecad1b25c0da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BADD852C2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45dbb-601a-0000-0f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "x-ms-client-request-id" : "583e17c7-1a05-4ca6-8ce3-ecad1b25c0da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryinvalidname33154dd/directoryasyncapitestscreatesubdirectoryinvalidname9766437?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2433df6c-e1a7-47cf-bc55-0c699fbcd9a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:23.7256505Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "ETag" : "\"0x8D7325BADE77D39\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:23.7256505Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45dc0-601a-0000-1344-64923b000000", + "x-ms-client-request-id" : "2433df6c-e1a7-47cf-bc55-0c699fbcd9a5", + "x-ms-file-last-write-time" : "2019-09-05T23:49:23.7256505Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectoryinvalidname33154dd/directoryasyncapitestscreatesubdirectoryinvalidname9766437%2ftest%2fsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dca5ccf4-a010-4fb3-9002-69c7ff411285" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "36c45dc5-601a-0000-1844-64923b000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:36c45dc5-601a-0000-1844-64923b000000\nTime:2019-09-05T23:49:23.8262603Z", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "x-ms-client-request-id" : "dca5ccf4-a010-4fb3-9002-69c7ff411285", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectoryinvalidname33154dd", "directoryasyncapitestscreatesubdirectoryinvalidname9766437" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadata.json new file mode 100644 index 000000000000..8ee2227d41c2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadata.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadata4280977f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "66b6ef44-7b21-44d7-af9d-8345c3047849" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAE227B41\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45dd1-601a-0000-2444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:23 GMT", + "x-ms-client-request-id" : "66b6ef44-7b21-44d7-af9d-8345c3047849" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadata4280977f/directoryasyncapitestscreatesubdirectorymetadata6256069f?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c4ad5127-30e4-42ff-bea3-5c1a8842c913" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:24.2126619Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:23 GMT", + "ETag" : "\"0x8D7325BAE31CD1B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:24.2126619Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45dd8-601a-0000-2a44-64923b000000", + "x-ms-client-request-id" : "c4ad5127-30e4-42ff-bea3-5c1a8842c913", + "x-ms-file-last-write-time" : "2019-09-05T23:49:24.2126619Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadata4280977f/directoryasyncapitestscreatesubdirectorymetadata6256069f%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "84013286-5719-4144-a37e-186bbe7a0303" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:24.3146627Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:23 GMT", + "ETag" : "\"0x8D7325BAE415D83\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:24.3146627Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ddd-601a-0000-2f44-64923b000000", + "x-ms-client-request-id" : "84013286-5719-4144-a37e-186bbe7a0303", + "x-ms-file-last-write-time" : "2019-09-05T23:49:24.3146627Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectorymetadata4280977f", "directoryasyncapitestscreatesubdirectorymetadata6256069f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadataError.json new file mode 100644 index 000000000000..7d133382d120 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadataError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadataerror10246c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7b3dc9eb-f85a-4799-bd1b-9f13cb37a5f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAE6C7CB3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45de9-601a-0000-3b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:23 GMT", + "x-ms-client-request-id" : "7b3dc9eb-f85a-4799-bd1b-9f13cb37a5f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadataerror10246c/directoryasyncapitestscreatesubdirectorymetadataerror226592?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0e267fbf-c913-4514-9d61-7625d8ddf08b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:24.6956757Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:23 GMT", + "ETag" : "\"0x8D7325BAE7B80D5\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:24.6956757Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45dee-601a-0000-3f44-64923b000000", + "x-ms-client-request-id" : "0e267fbf-c913-4514-9d61-7625d8ddf08b", + "x-ms-file-last-write-time" : "2019-09-05T23:49:24.6956757Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadataerror10246c/directoryasyncapitestscreatesubdirectorymetadataerror226592%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "36007756-faf1-4813-afcf-1907f76a0f86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c45df4-601a-0000-4544-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c45df4-601a-0000-4544-64923b000000\nTime:2019-09-05T23:49:24.7912649Zvalue", + "Date" : "Thu, 05 Sep 2019 23:49:23 GMT", + "x-ms-client-request-id" : "36007756-faf1-4813-afcf-1907f76a0f86", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectorymetadataerror10246c", "directoryasyncapitestscreatesubdirectorymetadataerror226592" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..3f7bd274bbf5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectory.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletedirectory41753ccfcc1f12?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "299bf20c-fd0b-4918-926c-1e2ae1674b13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA67F5B85\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b71-601a-0000-6c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:10 GMT", + "x-ms-client-request-id" : "299bf20c-fd0b-4918-926c-1e2ae1674b13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletedirectory41753ccfcc1f12/directoryasyncapitestsdeletedirectory0255662e09533e?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5bf9e6ab-16c2-4e33-9926-27c539cb1bc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:11.4003292Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:10 GMT", + "ETag" : "\"0x8D7325BA68ECB5C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:11.4003292Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45b77-601a-0000-7144-64923b000000", + "x-ms-client-request-id" : "5bf9e6ab-16c2-4e33-9926-27c539cb1bc1", + "x-ms-file-last-write-time" : "2019-09-05T23:49:11.4003292Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletedirectory41753ccfcc1f12/directoryasyncapitestsdeletedirectory0255662e09533e?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c3a71e03-285f-41c9-ad9f-ad74376b3dd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c45b7c-601a-0000-7644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:10 GMT", + "x-ms-client-request-id" : "c3a71e03-285f-41c9-ad9f-ad74376b3dd5" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletedirectory41753ccfcc1f12", "directoryasyncapitestsdeletedirectory0255662e09533e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..06cfe12396e0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectoryError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletedirectoryerror295674b301c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4f826050-8604-4c05-b714-9da2b8bf69e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA6C64FC1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b88-601a-0000-0244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:10 GMT", + "x-ms-client-request-id" : "4f826050-8604-4c05-b714-9da2b8bf69e4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletedirectoryerror295674b301c/directoryasyncapitestsdeletedirectoryerror48525e118fa?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a8f879b6-fd2e-4a16-9bbe-b56063e07c0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c45b8e-601a-0000-0744-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c45b8e-601a-0000-0744-64923b000000\nTime:2019-09-05T23:49:11.8631666Z", + "Date" : "Thu, 05 Sep 2019 23:49:11 GMT", + "x-ms-client-request-id" : "a8f879b6-fd2e-4a16-9bbe-b56063e07c0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletedirectoryerror295674b301c", "directoryasyncapitestsdeletedirectoryerror48525e118fa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFile.json new file mode 100644 index 000000000000..a5d533439c4c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFile.json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefile03938600bc32d5be?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "86c00f8d-3c3b-4ce5-8d1b-16204cd56db7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB22CE1BC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45ef9-601a-0000-3444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:30 GMT", + "x-ms-client-request-id" : "86c00f8d-3c3b-4ce5-8d1b-16204cd56db7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefile03938600bc32d5be/directoryasyncapitestsdeletefile01778b83c2f4bdf9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bb3c38ce-eacc-4ddb-a9c6-ecbaa0f2f2b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:30.9928411Z", + "Connection" : "close", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:30 GMT", + "ETag" : "\"0x8D7325BB23C5FDB\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:30.9928411Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45eff-601a-0000-3944-64923b000000", + "x-ms-client-request-id" : "bb3c38ce-eacc-4ddb-a9c6-ecbaa0f2f2b0", + "x-ms-file-last-write-time" : "2019-09-05T23:49:30.9928411Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefile03938600bc32d5be/directoryasyncapitestsdeletefile01778b83c2f4bdf9%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9af71b1a-a8bb-4791-9e17-dd4846eafa1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835093239654252544", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:31.4538501Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:30 GMT", + "ETag" : "\"0x8D7325BB282B805\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:31.4538501Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "cac51fb5-301a-001d-4f44-649f87000000", + "x-ms-client-request-id" : "9af71b1a-a8bb-4791-9e17-dd4846eafa1c", + "x-ms-file-last-write-time" : "2019-09-05T23:49:31.4538501Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefile03938600bc32d5be/directoryasyncapitestsdeletefile01778b83c2f4bdf9%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b49aa45c-c70e-4c58-8211-bda0b1cb32a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "cac51fb7-301a-001d-5044-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:30 GMT", + "x-ms-client-request-id" : "b49aa45c-c70e-4c58-8211-bda0b1cb32a3" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletefile03938600bc32d5be", "directoryasyncapitestsdeletefile01778b83c2f4bdf9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFileError.json new file mode 100644 index 000000000000..35cf5b0a73e6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFileError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefileerror17427802ad0138?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "849e86ad-29ab-4e55-b2a6-333db478c48a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB2BA243B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fbb-301a-001d-5444-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:30 GMT", + "x-ms-client-request-id" : "849e86ad-29ab-4e55-b2a6-333db478c48a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefileerror17427802ad0138/directoryasyncapitestsdeletefileerror587393c8fb4293?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2dfefae3-62d9-4673-a233-27510949824c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:31.9328640Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:30 GMT", + "ETag" : "\"0x8D7325BB2CBCF80\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:31.9328640Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "cac51fbd-301a-001d-5544-649f87000000", + "x-ms-client-request-id" : "2dfefae3-62d9-4673-a233-27510949824c", + "x-ms-file-last-write-time" : "2019-09-05T23:49:31.9328640Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletefileerror17427802ad0138/directoryasyncapitestsdeletefileerror587393c8fb4293%2ftestfile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "928a6028-267a-4b18-9759-95aa1504babc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "cac51fbe-301a-001d-5644-649f87000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:cac51fbe-301a-001d-5644-649f87000000\nTime:2019-09-05T23:49:32.0270653Z", + "Date" : "Thu, 05 Sep 2019 23:49:31 GMT", + "x-ms-client-request-id" : "928a6028-267a-4b18-9759-95aa1504babc", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletefileerror17427802ad0138", "directoryasyncapitestsdeletefileerror587393c8fb4293" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectory.json new file mode 100644 index 000000000000..d3963ebd3440 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectory.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectory917042a9d763?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e9a8e8c9-98f7-49ed-a9cd-76c77bfe18dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAF46FE95\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45e33-601a-0000-7f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "x-ms-client-request-id" : "e9a8e8c9-98f7-49ed-a9cd-76c77bfe18dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectory917042a9d763/directoryasyncapitestsdeletesubdirectory75540e677eb0?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "80decb48-9a5c-4bd2-aa63-3aea4830e85b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:26.1407146Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "ETag" : "\"0x8D7325BAF57FFAA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:26.1407146Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e37-601a-0000-0244-64923b000000", + "x-ms-client-request-id" : "80decb48-9a5c-4bd2-aa63-3aea4830e85b", + "x-ms-file-last-write-time" : "2019-09-05T23:49:26.1407146Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectory917042a9d763/directoryasyncapitestsdeletesubdirectory75540e677eb0%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9d5c2fb5-f1c8-4b2a-87b9-6cee8a209bf4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:26.2377143Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "ETag" : "\"0x8D7325BAF66CCB7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:26.2377143Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e3c-601a-0000-0744-64923b000000", + "x-ms-client-request-id" : "9d5c2fb5-f1c8-4b2a-87b9-6cee8a209bf4", + "x-ms-file-last-write-time" : "2019-09-05T23:49:26.2377143Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectory917042a9d763/directoryasyncapitestsdeletesubdirectory75540e677eb0%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d53878ea-a66d-4acc-8e67-ed9b85aacb53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c45e43-601a-0000-0e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "x-ms-client-request-id" : "d53878ea-a66d-4acc-8e67-ed9b85aacb53" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletesubdirectory917042a9d763", "directoryasyncapitestsdeletesubdirectory75540e677eb0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectoryError.json new file mode 100644 index 000000000000..6f374f210a9e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectoryError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectoryerror1098471e2c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5e17e9bc-0be0-4bb9-8d48-7de6c2714b21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAFA06945\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45e50-601a-0000-1b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "x-ms-client-request-id" : "5e17e9bc-0be0-4bb9-8d48-7de6c2714b21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectoryerror1098471e2c/directoryasyncapitestsdeletesubdirectoryerror9717927ff8?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1a4bf20f-c7ad-4857-a54d-2cc1ace92a11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:26.7157271Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "ETag" : "\"0x8D7325BAFAFBD17\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:26.7157271Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45e57-601a-0000-1f44-64923b000000", + "x-ms-client-request-id" : "1a4bf20f-c7ad-4857-a54d-2cc1ace92a11", + "x-ms-file-last-write-time" : "2019-09-05T23:49:26.7157271Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsdeletesubdirectoryerror1098471e2c/directoryasyncapitestsdeletesubdirectoryerror9717927ff8%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9b453abf-8eea-4e3e-afcc-153cc3bb7814" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c45e5c-601a-0000-2444-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c45e5c-601a-0000-2444-64923b000000\nTime:2019-09-05T23:49:26.8152804Z", + "Date" : "Thu, 05 Sep 2019 23:49:25 GMT", + "x-ms-client-request-id" : "9b453abf-8eea-4e3e-afcc-153cc3bb7814", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletesubdirectoryerror1098471e2c", "directoryasyncapitestsdeletesubdirectoryerror9717927ff8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsForceCloseHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsForceCloseHandlesError.json new file mode 100644 index 000000000000..da31b7def5bf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsForceCloseHandlesError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsforceclosehandleserror76142cf910?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "00532ccd-8d14-45ac-806e-0a5228cc6b25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAD464B81\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45d90-601a-0000-6744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:21 GMT", + "x-ms-client-request-id" : "00532ccd-8d14-45ac-806e-0a5228cc6b25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsforceclosehandleserror76142cf910/directoryasyncapitestsforceclosehandleserror37920dfcaf?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5d14938f-c7bf-4a6f-b058-ac640d3ad1ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:22.7746281Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:21 GMT", + "ETag" : "\"0x8D7325BAD565FE9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:22.7746281Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d97-601a-0000-6d44-64923b000000", + "x-ms-client-request-id" : "5d14938f-c7bf-4a6f-b058-ac640d3ad1ae", + "x-ms-file-last-write-time" : "2019-09-05T23:49:22.7746281Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsforceclosehandleserror76142cf910/directoryasyncapitestsforceclosehandleserror37920dfcaf?comp=forceclosehandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5617c016-1f9e-4dd5-872c-f9df55e02196" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "328", + "StatusCode" : "400", + "x-ms-request-id" : "36c45d9c-601a-0000-7144-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c45d9c-601a-0000-7144-64923b000000\nTime:2019-09-05T23:49:22.8742494Zx-ms-handle-idhandleId", + "Date" : "Thu, 05 Sep 2019 23:49:22 GMT", + "x-ms-client-request-id" : "5617c016-1f9e-4dd5-872c-f9df55e02196", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsforceclosehandleserror76142cf910", "directoryasyncapitestsforceclosehandleserror37920dfcaf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetDirectoryURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetDirectoryURL.json new file mode 100644 index 000000000000..cb0a89c1d235 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetDirectoryURL.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetdirectoryurl44419c33286fb9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "342d6c8d-ea9d-46d4-a19e-13383ec0f244" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA461D1B0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45ae0-601a-0000-6944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:07 GMT", + "x-ms-client-request-id" : "342d6c8d-ea9d-46d4-a19e-13383ec0f244" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetdirectoryurl44419c33286fb9", "directoryasyncapitestsgetdirectoryurl29494e286503bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetFileClient.json new file mode 100644 index 000000000000..79f45b0eea2d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetFileClient.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetfileclient35951dee8aefe0d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "03ccca9f-975d-4a42-b1e6-876fdd224b72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA4BB1572\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45af3-601a-0000-7944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:07 GMT", + "x-ms-client-request-id" : "03ccca9f-975d-4a42-b1e6-876fdd224b72" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetfileclient35951dee8aefe0d", "directoryasyncapitestsgetfileclient26880290ac73ca9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetProperties.json new file mode 100644 index 000000000000..eac36f17c367 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetProperties.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetproperties980529f9ca44d4e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2232a0be-1fb6-44e8-beba-715d4bcee597" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA6FEEC06\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45b9d-601a-0000-1644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:11 GMT", + "x-ms-client-request-id" : "2232a0be-1fb6-44e8-beba-715d4bcee597" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetproperties980529f9ca44d4e/directoryasyncapitestsgetproperties70100864718e581?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6e97fe5c-bf4b-4923-894d-8f7c7757a61e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:12.2343532Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:11 GMT", + "ETag" : "\"0x8D7325BA70E0E6C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:12.2343532Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ba2-601a-0000-1a44-64923b000000", + "x-ms-client-request-id" : "6e97fe5c-bf4b-4923-894d-8f7c7757a61e", + "x-ms-file-last-write-time" : "2019-09-05T23:49:12.2343532Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetproperties980529f9ca44d4e/directoryasyncapitestsgetproperties70100864718e581?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "48292823-6c62-46e5-9af4-2335d2ec31c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:12.2343532Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:49:11 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7325BA70E0E6C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:12.2343532Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ba6-601a-0000-1e44-64923b000000", + "x-ms-client-request-id" : "48292823-6c62-46e5-9af4-2335d2ec31c6", + "x-ms-file-last-write-time" : "2019-09-05T23:49:12.2343532Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetproperties980529f9ca44d4e", "directoryasyncapitestsgetproperties70100864718e581" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..8808f02ddd6d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetPropertiesError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetpropertieserror123788926b07?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a9a7ae99-f3fc-4f4f-8e7d-2de5d6aa5a88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA746556E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45bb5-601a-0000-2d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:11 GMT", + "x-ms-client-request-id" : "a9a7ae99-f3fc-4f4f-8e7d-2de5d6aa5a88" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetpropertieserror123788926b07/directoryasyncapitestsgetpropertieserror427777cf634b?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9305daa4-c9f2-4623-b7b4-e65163bea69f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c45bbb-601a-0000-3244-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c45bbb-601a-0000-3244-64923b000000\nTime:2019-09-05T23:49:12.6991707Z", + "Date" : "Thu, 05 Sep 2019 23:49:11 GMT", + "x-ms-client-request-id" : "9305daa4-c9f2-4623-b7b4-e65163bea69f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetpropertieserror123788926b07", "directoryasyncapitestsgetpropertieserror427777cf634b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..4cee8b901eb6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSnapshotId.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetsnapshotid1934158eac63c13?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "18f37495-db6f-424c-b176-5e4ff1871e6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB30250D7\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fc1-301a-001d-5944-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:31 GMT", + "x-ms-client-request-id" : "18f37495-db6f-424c-b176-5e4ff1871e6e" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetsnapshotid1934158eac63c13", "directoryasyncapitestsgetsnapshotid81404ca755d0b19" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSubDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSubDirectoryClient.json new file mode 100644 index 000000000000..c7d16a28800b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSubDirectoryClient.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestsgetsubdirectoryclient216790ecf01?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ab13b8bc-8415-4fab-acfd-807eabe4a391" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA48EFC54\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45aea-601a-0000-7144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:07 GMT", + "x-ms-client-request-id" : "ab13b8bc-8415-4fab-acfd-807eabe4a391" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetsubdirectoryclient216790ecf01", "directoryasyncapitestsgetsubdirectoryclient554365ae0cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories.json new file mode 100644 index 000000000000..5e2395987587 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories.json @@ -0,0 +1,192 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093B82CFA1\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd70a-d01a-0112-50f2-56423f000000", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f?restype=directory", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BAE2DD1\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd70e-d01a-0112-51f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b420?restype=directory", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BB8B7B9\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd70f-d01a-0112-52f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b420%2fdirectoryasyncapitestslistfilesanddirectories9439006b423", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BC0F727\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd710-d01a-0112-53f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b420%2fdirectoryasyncapitestslistfilesanddirectories9439006b424", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BC7D6AD\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd712-d01a-0112-54f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b421?restype=directory", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BD127C8\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd713-d01a-0112-55f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b421%2fdirectoryasyncapitestslistfilesanddirectories9439006b425", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BDAC716\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd714-d01a-0112-56f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b421%2fdirectoryasyncapitestslistfilesanddirectories9439006b426", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BE10A35\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd715-d01a-0112-57f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b422", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BE6D7FF\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd716-d01a-0112-58f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c63cd717-d01a-0112-59f2-56423f000000", + "Body" : "directoryasyncapitestslistfilesanddirectories9439006b420directoryasyncapitestslistfilesanddirectories9439006b421directoryasyncapitestslistfilesanddirectories9439006b4221024", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectories325882ed4d", "directoryasyncapitestslistfilesanddirectories28315e317f", "directoryasyncapitestslistfilesanddirectories9439006b42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories0.json new file mode 100644 index 000000000000..4baaca5afa12 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories0.json @@ -0,0 +1,220 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3a742756-7dc8-49eb-8fab-68a539d3801c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA907676F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45c44-601a-0000-3244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:14 GMT", + "x-ms-client-request-id" : "3a742756-7dc8-49eb-8fab-68a539d3801c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "080c5f96-76ff-40be-ae5b-072267e670a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:15.6514412Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:14 GMT", + "ETag" : "\"0x8D7325BA917766C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:15.6514412Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c4b-601a-0000-3844-64923b000000", + "x-ms-client-request-id" : "080c5f96-76ff-40be-ae5b-072267e670a2", + "x-ms-file-last-write-time" : "2019-09-05T23:49:15.6514412Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec%2fa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9be988ee-fa13-461a-8979-51a78cb1ea06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:15.7574418Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:14 GMT", + "ETag" : "\"0x8D7325BA927A312\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:15.7574418Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c4f-601a-0000-3c44-64923b000000", + "x-ms-client-request-id" : "9be988ee-fa13-461a-8979-51a78cb1ea06", + "x-ms-file-last-write-time" : "2019-09-05T23:49:15.7574418Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec%2fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4bb2abcc-74ec-4a6e-8910-ae821b08084a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:15.8534454Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA9364936\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:15.8534454Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c55-601a-0000-4244-64923b000000", + "x-ms-client-request-id" : "4bb2abcc-74ec-4a6e-8910-ae821b08084a", + "x-ms-file-last-write-time" : "2019-09-05T23:49:15.8534454Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec%2fc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9290971d-573f-4d62-9ef9-fe596387652d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:15.9474464Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA944A120\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:15.9474464Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c5b-601a-0000-4844-64923b000000", + "x-ms-client-request-id" : "9290971d-573f-4d62-9ef9-fe596387652d", + "x-ms-file-last-write-time" : "2019-09-05T23:49:15.9474464Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec%2fd?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bd8a6659-5c70-4f86-a9f9-c91cfedca869" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:16.0464484Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA953BC64\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:16.0464484Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c61-601a-0000-4e44-64923b000000", + "x-ms-client-request-id" : "bd8a6659-5c70-4f86-a9f9-c91cfedca869", + "x-ms-file-last-write-time" : "2019-09-05T23:49:16.0464484Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec%2fe?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f6da85c5-b7f1-4cf9-95f2-0dc6fde9afc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:16.1384521Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA961C649\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:16.1384521Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c66-601a-0000-5344-64923b000000", + "x-ms-client-request-id" : "f6da85c5-b7f1-4cf9-95f2-0dc6fde9afc1", + "x-ms-file-last-write-time" : "2019-09-05T23:49:16.1384521Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories041168050b/directoryasyncapitestslistfilesanddirectories01490380ec?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0b37fd88-8c33-449d-bd16-b0f0553e0a5f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45c69-601a-0000-5644-64923b000000", + "Body" : "a2b2c2de", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "x-ms-client-request-id" : "0b37fd88-8c33-449d-bd16-b0f0553e0a5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectories041168050b", "directoryasyncapitestslistfilesanddirectories01490380ec" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories1.json new file mode 100644 index 000000000000..eb7762bdd69f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories1.json @@ -0,0 +1,220 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3bf5c10b-7192-40dd-92a2-4aa69289308d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA99CC9CB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45c78-601a-0000-6544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "x-ms-client-request-id" : "3bf5c10b-7192-40dd-92a2-4aa69289308d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3190276d-54a9-4a9c-ba9e-2d39289cc9d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:16.6214646Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA9AB79F6\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:16.6214646Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c7d-601a-0000-6944-64923b000000", + "x-ms-client-request-id" : "3190276d-54a9-4a9c-ba9e-2d39289cc9d7", + "x-ms-file-last-write-time" : "2019-09-05T23:49:16.6214646Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0%2fa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dd4bd7ce-a16f-4efb-9f9f-33d7e671579d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:16.7274675Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA9BBA6B3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:16.7274675Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c80-601a-0000-6c44-64923b000000", + "x-ms-client-request-id" : "dd4bd7ce-a16f-4efb-9f9f-33d7e671579d", + "x-ms-file-last-write-time" : "2019-09-05T23:49:16.7274675Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0%2fc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "23a85349-aed6-4737-849f-fc3f99a9798c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:16.8204705Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:15 GMT", + "ETag" : "\"0x8D7325BA9C9D7A1\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:16.8204705Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c82-601a-0000-6e44-64923b000000", + "x-ms-client-request-id" : "23a85349-aed6-4737-849f-fc3f99a9798c", + "x-ms-file-last-write-time" : "2019-09-05T23:49:16.8204705Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0%2fe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b254dda8-c127-422a-86ff-21b9b3806712" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:16.9144724Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "ETag" : "\"0x8D7325BA9D82F94\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:16.9144724Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c87-601a-0000-7344-64923b000000", + "x-ms-client-request-id" : "b254dda8-c127-422a-86ff-21b9b3806712", + "x-ms-file-last-write-time" : "2019-09-05T23:49:16.9144724Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0%2fb?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b03fe99a-3499-4950-920e-15ce2f927f72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.0114744Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "ETag" : "\"0x8D7325BA9E6FCB8\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:17.0114744Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c8a-601a-0000-7644-64923b000000", + "x-ms-client-request-id" : "b03fe99a-3499-4950-920e-15ce2f927f72", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.0114744Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0%2fd?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d1f2fb5e-8492-4bdf-8d8b-448e282f5987" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.1084801Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "ETag" : "\"0x8D7325BA9F5CA01\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:17.1084801Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c8e-601a-0000-7a44-64923b000000", + "x-ms-client-request-id" : "d1f2fb5e-8492-4bdf-8d8b-448e282f5987", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.1084801Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectories1923512778/directoryasyncapitestslistfilesanddirectories1098941da0?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2a8f81d7-4eec-4325-9805-e0cc67e6f607" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45c91-601a-0000-7d44-64923b000000", + "Body" : "a2bc2de2", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "x-ms-client-request-id" : "2a8f81d7-4eec-4325-9805-e0cc67e6f607", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectories1923512778", "directoryasyncapitestslistfilesanddirectories1098941da0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs0.json new file mode 100644 index 000000000000..cad587f2e89a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs0.json @@ -0,0 +1,278 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2edc1bf8-ac64-4ee8-b6ee-2baae5ab1839" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAA30F3B8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45ca6-601a-0000-0a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "x-ms-client-request-id" : "2edc1bf8-ac64-4ee8-b6ee-2baae5ab1839" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5291369f-4f49-4bc7-b946-67988d6f7ff4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.5934889Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "ETag" : "\"0x8D7325BAA3FCBA9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:17.5934889Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45caa-601a-0000-0d44-64923b000000", + "x-ms-client-request-id" : "5291369f-4f49-4bc7-b946-67988d6f7ff4", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.5934889Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851610?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "55b077e5-f33b-453a-af9c-9ba4ed4ad6d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.6874912Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "ETag" : "\"0x8D7325BAA4E23A0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:17.6874912Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45caf-601a-0000-1244-64923b000000", + "x-ms-client-request-id" : "55b077e5-f33b-453a-af9c-9ba4ed4ad6d8", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.6874912Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851610%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851613", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eec7323b-c070-467a-b60d-f9320e305803" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.7884945Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:16 GMT", + "ETag" : "\"0x8D7325BAA5D8D11\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:17.7884945Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cb2-601a-0000-1544-64923b000000", + "x-ms-client-request-id" : "eec7323b-c070-467a-b60d-f9320e305803", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.7884945Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851610%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851614", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4d91ac9b-a1f9-4837-a759-fe2b929c5d04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.8874955Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "ETag" : "\"0x8D7325BAA6CA84B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:17.8874955Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cb8-601a-0000-1a44-64923b000000", + "x-ms-client-request-id" : "4d91ac9b-a1f9-4837-a759-fe2b929c5d04", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.8874955Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851611?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "93a8361c-423d-4ae0-a490-88febb8f6722" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:17.9854991Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "ETag" : "\"0x8D7325BAA7B9C8F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:17.9854991Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cbb-601a-0000-1d44-64923b000000", + "x-ms-client-request-id" : "93a8361c-423d-4ae0-a490-88febb8f6722", + "x-ms-file-last-write-time" : "2019-09-05T23:49:17.9854991Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851611%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851615", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e9920bbc-9e5d-4be8-9d21-53f7ed802109" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:18.0835045Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "ETag" : "\"0x8D7325BAA8A90E5\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:18.0835045Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cbf-601a-0000-2144-64923b000000", + "x-ms-client-request-id" : "e9920bbc-9e5d-4be8-9d21-53f7ed802109", + "x-ms-file-last-write-time" : "2019-09-05T23:49:18.0835045Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851611%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851616", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a8894951-8550-4357-813e-0ce378df7ee9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:18.1795068Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "ETag" : "\"0x8D7325BAA9936FC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:18.1795068Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cc4-601a-0000-2644-64923b000000", + "x-ms-client-request-id" : "a8894951-8550-4357-813e-0ce378df7ee9", + "x-ms-file-last-write-time" : "2019-09-05T23:49:18.1795068Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f%2fdirectoryasyncapitestslistfilesanddirectoriesargs059851612", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "701aaf46-33cd-4d3e-b59e-1d3b6c488975" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:18.2765097Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "ETag" : "\"0x8D7325BAAA80429\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:18.2765097Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cc8-601a-0000-2a44-64923b000000", + "x-ms-client-request-id" : "701aaf46-33cd-4d3e-b59e-1d3b6c488975", + "x-ms-file-last-write-time" : "2019-09-05T23:49:18.2765097Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs09955450/directoryasyncapitestslistfilesanddirectoriesargs0789869f?prefix=directoryasyncapitestslistfilesanddirectoriesargs&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f56a7e1e-690f-4236-b452-0942a30dda47" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45ccb-601a-0000-2d44-64923b000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargsdirectoryasyncapitestslistfilesanddirectoriesargs059851610directoryasyncapitestslistfilesanddirectoriesargs059851611directoryasyncapitestslistfilesanddirectoriesargs0598516121024", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "x-ms-client-request-id" : "f56a7e1e-690f-4236-b452-0942a30dda47", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectoriesargs09955450", "directoryasyncapitestslistfilesanddirectoriesargs0789869f", "directoryasyncapitestslistfilesanddirectoriesargs05985161" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs1.json new file mode 100644 index 000000000000..e44c9d1da876 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs1.json @@ -0,0 +1,320 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9e1f6a8f-5b3f-4985-b2e7-63d62bf3f376" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAAE15848\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45cd7-601a-0000-3944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "x-ms-client-request-id" : "9e1f6a8f-5b3f-4985-b2e7-63d62bf3f376" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d3219903-bf79-44b1-b62b-d39269774d49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:18.7515201Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:17 GMT", + "ETag" : "\"0x8D7325BAAF07F41\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:18.7515201Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cdb-601a-0000-3c44-64923b000000", + "x-ms-client-request-id" : "d3219903-bf79-44b1-b62b-d39269774d49", + "x-ms-file-last-write-time" : "2019-09-05T23:49:18.7515201Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454500?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "de2f2a4f-3c64-4cb1-8915-b6a51b2ab8f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:18.8475224Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAAFF2558\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:18.8475224Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cde-601a-0000-3f44-64923b000000", + "x-ms-client-request-id" : "de2f2a4f-3c64-4cb1-8915-b6a51b2ab8f8", + "x-ms-file-last-write-time" : "2019-09-05T23:49:18.8475224Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454500%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454503", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "13e2561c-f04f-4575-abf4-edac22bc0fae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:18.9735275Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAB125F6B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:18.9735275Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ce0-601a-0000-4144-64923b000000", + "x-ms-client-request-id" : "13e2561c-f04f-4575-abf4-edac22bc0fae", + "x-ms-file-last-write-time" : "2019-09-05T23:49:18.9735275Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454500%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454504", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8f1c5d44-ea7e-4eb7-8b18-6a66f9dce4de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:19.0745267Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAB21C8B3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:19.0745267Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ce5-601a-0000-4644-64923b000000", + "x-ms-client-request-id" : "8f1c5d44-ea7e-4eb7-8b18-6a66f9dce4de", + "x-ms-file-last-write-time" : "2019-09-05T23:49:19.0745267Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454501?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f5de037b-4f1f-4133-a17c-ab46b538d3d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:19.1725316Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAB30BD04\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:19.1725316Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ce8-601a-0000-4944-64923b000000", + "x-ms-client-request-id" : "f5de037b-4f1f-4133-a17c-ab46b538d3d5", + "x-ms-file-last-write-time" : "2019-09-05T23:49:19.1725316Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454501%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454505", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "75620d39-b85d-40db-a0ca-222b5fc18119" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:19.2735322Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAB40265A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:19.2735322Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "36c45ceb-601a-0000-4c44-64923b000000", + "x-ms-client-request-id" : "75620d39-b85d-40db-a0ca-222b5fc18119", + "x-ms-file-last-write-time" : "2019-09-05T23:49:19.2735322Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454501%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454506", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6371121b-260d-42c9-a7b2-195452c10edc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:19.3725364Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAB4F41B4\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:19.3725364Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cf0-601a-0000-5144-64923b000000", + "x-ms-client-request-id" : "6371121b-260d-42c9-a7b2-195452c10edc", + "x-ms-file-last-write-time" : "2019-09-05T23:49:19.3725364Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7%2fdirectoryasyncapitestslistfilesanddirectoriesargs165454502", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e5ae6f11-973b-448e-9eef-790d7d562168" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:19.4695393Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "ETag" : "\"0x8D7325BAB5E0EE1\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:19.4695393Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45cf2-601a-0000-5344-64923b000000", + "x-ms-client-request-id" : "e5ae6f11-973b-448e-9eef-790d7d562168", + "x-ms-file-last-write-time" : "2019-09-05T23:49:19.4695393Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7?prefix=directoryasyncapitestslistfilesanddirectoriesargs&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d1729887-0f68-4d5f-a128-28ee1f89c1bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45cf5-601a-0000-5644-64923b000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargs1directoryasyncapitestslistfilesanddirectoriesargs1654545001!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczE2NTQ1NDUwMQ--", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "x-ms-client-request-id" : "d1729887-0f68-4d5f-a128-28ee1f89c1bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7?prefix=directoryasyncapitestslistfilesanddirectoriesargs&marker=1%2180%21ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczE2NTQ1NDUwMQ--&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bb79a58b-7fd0-47fa-9c12-d739f2adfe05" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45cfa-601a-0000-5b44-64923b000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargs1!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczE2NTQ1NDUwMQ--1directoryasyncapitestslistfilesanddirectoriesargs1654545011!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczE2NTQ1NDUwMg--", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "x-ms-client-request-id" : "bb79a58b-7fd0-47fa-9c12-d739f2adfe05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs195502ac/directoryasyncapitestslistfilesanddirectoriesargs102591d7?prefix=directoryasyncapitestslistfilesanddirectoriesargs&marker=1%2180%21ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczE2NTQ1NDUwMg--&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "72387562-caf4-4bdc-82ac-e35ed89b3426" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45cfe-601a-0000-5f44-64923b000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargs1!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczE2NTQ1NDUwMg--1directoryasyncapitestslistfilesanddirectoriesargs1654545021024", + "Date" : "Thu, 05 Sep 2019 23:49:18 GMT", + "x-ms-client-request-id" : "72387562-caf4-4bdc-82ac-e35ed89b3426", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectoriesargs195502ac", "directoryasyncapitestslistfilesanddirectoriesargs102591d7", "directoryasyncapitestslistfilesanddirectoriesargs16545450" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs2.json new file mode 100644 index 000000000000..429842c8cbbc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs2.json @@ -0,0 +1,278 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b52d6a4b-1cd1-4666-a8c4-8f7ddf1d68c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BABAFA527\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45d0c-601a-0000-6c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "x-ms-client-request-id" : "b52d6a4b-1cd1-4666-a8c4-8f7ddf1d68c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cf984abf-ec5f-4cb2-9572-1c6e63aac5a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.1035568Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "ETag" : "\"0x8D7325BABBECD30\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:20.1035568Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d0f-601a-0000-6e44-64923b000000", + "x-ms-client-request-id" : "cf984abf-ec5f-4cb2-9572-1c6e63aac5a0", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.1035568Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c0?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "235b461a-d756-4de1-856c-656d06196b28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.2005737Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "ETag" : "\"0x8D7325BABCD9AE9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:20.2005737Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d16-601a-0000-7544-64923b000000", + "x-ms-client-request-id" : "235b461a-d756-4de1-856c-656d06196b28", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.2005737Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c0%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "61a13982-b5c0-47fb-b723-9ff4e2b45690" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.3075615Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "ETag" : "\"0x8D7325BABDDEE1F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:20.3075615Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d17-601a-0000-7644-64923b000000", + "x-ms-client-request-id" : "61a13982-b5c0-47fb-b723-9ff4e2b45690", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.3075615Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c0%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3f1c59f5-4da1-470f-9218-17dfef800b68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.4075623Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "ETag" : "\"0x8D7325BABED3067\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:20.4075623Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d1d-601a-0000-7b44-64923b000000", + "x-ms-client-request-id" : "3f1c59f5-4da1-470f-9218-17dfef800b68", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.4075623Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c1?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "287ea10e-6053-4617-b7cc-8d66156851c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.5075703Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "ETag" : "\"0x8D7325BABFC72F7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:20.5075703Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d23-601a-0000-0144-64923b000000", + "x-ms-client-request-id" : "287ea10e-6053-4617-b7cc-8d66156851c5", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.5075703Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c1%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "02a3a3d8-23b2-460f-bc7e-ea049b611cb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.7685750Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:19 GMT", + "ETag" : "\"0x8D7325BAC244676\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:20.7685750Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d26-601a-0000-0444-64923b000000", + "x-ms-client-request-id" : "02a3a3d8-23b2-460f-bc7e-ea049b611cb9", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.7685750Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c1%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7737299e-af60-4b6a-af0e-e205419f5c66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.8685763Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "ETag" : "\"0x8D7325BAC3388C3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:20.8685763Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d2f-601a-0000-0b44-64923b000000", + "x-ms-client-request-id" : "7737299e-af60-4b6a-af0e-e205419f5c66", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.8685763Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9%2fdirectoryasyncapitestslistfilesanddirectoriesargs2751044c2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "91de4200-804e-4de1-9675-3e32ac5194c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:20.9735776Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "ETag" : "\"0x8D7325BAC438E60\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:49:20.9735776Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d3a-601a-0000-1444-64923b000000", + "x-ms-client-request-id" : "91de4200-804e-4de1-9675-3e32ac5194c2", + "x-ms-file-last-write-time" : "2019-09-05T23:49:20.9735776Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs225922c7/directoryasyncapitestslistfilesanddirectoriesargs268926f9?prefix=directoryasyncapitestslistfilesanddirectoriesargsnoops&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "642cc617-423c-4f36-9cf3-a91ef86bae6f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45d3f-601a-0000-1944-64923b000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargsnoops1", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "x-ms-client-request-id" : "642cc617-423c-4f36-9cf3-a91ef86bae6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectoriesargs225922c7", "directoryasyncapitestslistfilesanddirectoriesargs268926f9", "directoryasyncapitestslistfilesanddirectoriesargs2751044c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles0.json new file mode 100644 index 000000000000..7672a0931c16 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles0.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandles08263963aea41bd0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0257801d-aa6a-437e-964c-217d5a12e495" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAC7D55E3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45d4b-601a-0000-2544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "x-ms-client-request-id" : "0257801d-aa6a-437e-964c-217d5a12e495" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandles08263963aea41bd0/directoryasyncapitestslisthandles025406ea5afe2b65?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "981b7689-b3ba-4aec-aff9-5641651fcbfe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:21.4525915Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "ETag" : "\"0x8D7325BAC8CA5DB\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:21.4525915Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d50-601a-0000-2944-64923b000000", + "x-ms-client-request-id" : "981b7689-b3ba-4aec-aff9-5641651fcbfe", + "x-ms-file-last-write-time" : "2019-09-05T23:49:21.4525915Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandles08263963aea41bd0/directoryasyncapitestslisthandles025406ea5afe2b65?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c75b8741-61a6-45ba-86a1-7ef8c924f005" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45d55-601a-0000-2e44-64923b000000", + "Body" : "2", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "x-ms-client-request-id" : "c75b8741-61a6-45ba-86a1-7ef8c924f005", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslisthandles08263963aea41bd0", "directoryasyncapitestslisthandles025406ea5afe2b65" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles1.json new file mode 100644 index 000000000000..6af7bde6d026 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles1.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandles1235884852f3bf20?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "632c464d-8694-45a8-88c8-1bd718fa6669" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BACC44A11\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45d64-601a-0000-3d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:20 GMT", + "x-ms-client-request-id" : "632c464d-8694-45a8-88c8-1bd718fa6669" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandles1235884852f3bf20/directoryasyncapitestslisthandles119240b9c30efd99?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c69c198b-e292-4c2d-b96d-a9a942e7d2af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:21.9186038Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:21 GMT", + "ETag" : "\"0x8D7325BACD3C176\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:21.9186038Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45d68-601a-0000-4044-64923b000000", + "x-ms-client-request-id" : "c69c198b-e292-4c2d-b96d-a9a942e7d2af", + "x-ms-file-last-write-time" : "2019-09-05T23:49:21.9186038Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandles1235884852f3bf20/directoryasyncapitestslisthandles119240b9c30efd99?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cbe89f72-a94d-4a7b-a4de-e1318e58295b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45d6f-601a-0000-4744-64923b000000", + "Body" : "", + "Date" : "Thu, 05 Sep 2019 23:49:21 GMT", + "x-ms-client-request-id" : "cbe89f72-a94d-4a7b-a4de-e1318e58295b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslisthandles1235884852f3bf20", "directoryasyncapitestslisthandles119240b9c30efd99" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandlesError.json new file mode 100644 index 000000000000..397d719a409f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandlesError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandleserror489145769c1e1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f82e8f8e-1b2c-4d49-827e-c640a5bb1732" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BAD0C0198\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45d7c-601a-0000-5444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:21 GMT", + "x-ms-client-request-id" : "f82e8f8e-1b2c-4d49-827e-c640a5bb1732" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestslisthandleserror489145769c1e1/directoryasyncapitestslisthandleserror97283e55bf746?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ba4cd3c0-3df9-4edd-9cc8-717fd3a75e70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c45d81-601a-0000-5844-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c45d81-601a-0000-5844-64923b000000\nTime:2019-09-05T23:49:22.4032424Z", + "Date" : "Thu, 05 Sep 2019 23:49:21 GMT", + "x-ms-client-request-id" : "ba4cd3c0-3df9-4edd-9cc8-717fd3a75e70", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslisthandleserror489145769c1e1", "directoryasyncapitestslisthandleserror97283e55bf746" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadata.json new file mode 100644 index 000000000000..287a204e447f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadata.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadata4895434ac26124ac?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c70d4e51-f262-44e0-8aa6-8301e5600595" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA859C1F2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45c14-601a-0000-0644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "x-ms-client-request-id" : "c70d4e51-f262-44e0-8aa6-8301e5600595" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadata4895434ac26124ac/directoryasyncapitestssetmetadata253135d3312316ed?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3e26a246-f6fd-47c3-9ed5-b1642dcb9a20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:14.5104119Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "ETag" : "\"0x8D7325BA8695AF7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:14.5104119Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c19-601a-0000-0a44-64923b000000", + "x-ms-client-request-id" : "3e26a246-f6fd-47c3-9ed5-b1642dcb9a20", + "x-ms-file-last-write-time" : "2019-09-05T23:49:14.5104119Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadata4895434ac26124ac/directoryasyncapitestssetmetadata253135d3312316ed?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4d316ba9-879e-4271-982d-33ad617728d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:14.5104119Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7325BA8695AF7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-09-05T23:49:14.5104119Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c1f-601a-0000-1044-64923b000000", + "x-ms-client-request-id" : "4d316ba9-879e-4271-982d-33ad617728d1", + "x-ms-file-last-write-time" : "2019-09-05T23:49:14.5104119Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadata4895434ac26124ac/directoryasyncapitestssetmetadata253135d3312316ed?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f78e8dc2-7274-48d0-853d-0b75e4b6f9ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA8876A6C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45c24-601a-0000-1544-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "x-ms-client-request-id" : "f78e8dc2-7274-48d0-853d-0b75e4b6f9ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadata4895434ac26124ac/directoryasyncapitestssetmetadata253135d3312316ed?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a754f2a6-ab43-4027-b372-8e7c55bc1a5d" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:14.5104119Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7325BA8876A6C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:14.7074156Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c28-601a-0000-1944-64923b000000", + "x-ms-client-request-id" : "a754f2a6-ab43-4027-b372-8e7c55bc1a5d", + "x-ms-file-last-write-time" : "2019-09-05T23:49:14.5104119Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetmetadata4895434ac26124ac", "directoryasyncapitestssetmetadata253135d3312316ed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadataError.json new file mode 100644 index 000000000000..7458a13fe007 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadataError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadataerror31076b8bba27b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c7cea8ab-8a1b-4743-a7e1-e6536104ac83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA8C0251D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45c32-601a-0000-2244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:14 GMT", + "x-ms-client-request-id" : "c7cea8ab-8a1b-4743-a7e1-e6536104ac83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadataerror31076b8bba27b/directoryasyncapitestssetmetadataerror921931abe5700?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a7d36613-0ac6-42c9-b095-b039eb44aefa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:15.1784280Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:14 GMT", + "ETag" : "\"0x8D7325BA8CF4958\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:15.1784280Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c35-601a-0000-2444-64923b000000", + "x-ms-client-request-id" : "a7d36613-0ac6-42c9-b095-b039eb44aefa", + "x-ms-file-last-write-time" : "2019-09-05T23:49:15.1784280Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetmetadataerror31076b8bba27b/directoryasyncapitestssetmetadataerror921931abe5700?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d60e0b46-e497-4caa-ac68-4bcc5ff39473" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c45c37-601a-0000-2644-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c45c37-601a-0000-2644-64923b000000\nTime:2019-09-05T23:49:15.2781950Zvalue", + "Date" : "Thu, 05 Sep 2019 23:49:14 GMT", + "x-ms-client-request-id" : "d60e0b46-e497-4caa-ac68-4bcc5ff39473", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetmetadataerror31076b8bba27b", "directoryasyncapitestssetmetadataerror921931abe5700" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesError.json new file mode 100644 index 000000000000..f38146bf083c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesError.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertieserror910905c46422?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dd2024a4-ba70-487e-adf6-42d6df6a7431" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA81F77C7\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45c00-601a-0000-7344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "x-ms-client-request-id" : "dd2024a4-ba70-487e-adf6-42d6df6a7431" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertieserror910905c46422/directoryasyncapitestssetpropertieserror673311bea328?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0886f364-c88f-4e6f-ae3a-cb051b1c13e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:14.1244001Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:13 GMT", + "ETag" : "\"0x8D7325BA82E7461\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:14.1244001Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45c05-601a-0000-7744-64923b000000", + "x-ms-client-request-id" : "0886f364-c88f-4e6f-ae3a-cb051b1c13e2", + "x-ms-file-last-write-time" : "2019-09-05T23:49:14.1244001Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetpropertieserror910905c46422", "directoryasyncapitestssetpropertieserror673311bea328" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesFilePermission.json new file mode 100644 index 000000000000..2512612de7f8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesFilePermission.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermission23037062?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0d8cc393-6385-46cf-b4b5-4ecaadab9feb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA77CA7BA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45bc8-601a-0000-3e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "x-ms-client-request-id" : "0d8cc393-6385-46cf-b4b5-4ecaadab9feb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermission23037062/directoryasyncapitestssetpropertiesfilepermission16260937?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "84644147-0ea7-470c-a85e-3731e33baa76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:13.0573706Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "ETag" : "\"0x8D7325BA78BA38A\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:13.0573706Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45bce-601a-0000-4344-64923b000000", + "x-ms-client-request-id" : "84644147-0ea7-470c-a85e-3731e33baa76", + "x-ms-file-last-write-time" : "2019-09-05T23:49:13.0573706Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermission23037062/directoryasyncapitestssetpropertiesfilepermission16260937?restype=directory&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4242d293-7dae-432b-84da-11e2952a2161" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:13.0573706Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "ETag" : "\"0x8D7325BA79DF347\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:13.1773767Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45bd4-601a-0000-4844-64923b000000", + "x-ms-client-request-id" : "4242d293-7dae-432b-84da-11e2952a2161", + "x-ms-file-last-write-time" : "2019-09-05T23:49:13.0573706Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetpropertiesfilepermission23037062", "directoryasyncapitestssetpropertiesfilepermission16260937" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesFilePermissionKey.json new file mode 100644 index 000000000000..c536002c6b78 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetPropertiesFilePermissionKey.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermissionkey806204?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c1f240ac-8c9f-48b9-a75a-1db345a85e9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA7C8CC46\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45be2-601a-0000-5644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "x-ms-client-request-id" : "c1f240ac-8c9f-48b9-a75a-1db345a85e9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermissionkey806204?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "20b50ccb-8094-4276-9fc9-bfcf55399e7a", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45be9-601a-0000-5c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "x-ms-client-request-id" : "20b50ccb-8094-4276-9fc9-bfcf55399e7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermissionkey806204/directoryasyncapitestssetpropertiesfilepermissionkey870254?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e9d16b5d-dfc6-4ac3-8525-2358bea418b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:13.6523867Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "ETag" : "\"0x8D7325BA7E66E5B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:13.6523867Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45bed-601a-0000-6044-64923b000000", + "x-ms-client-request-id" : "e9d16b5d-dfc6-4ac3-8525-2358bea418b4", + "x-ms-file-last-write-time" : "2019-09-05T23:49:13.6523867Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/directoryasyncapitestssetpropertiesfilepermissionkey806204/directoryasyncapitestssetpropertiesfilepermissionkey870254?restype=directory&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5d0b6831-ec24-4191-9bed-38ec4492cc2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:49:13.6080000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:49:12 GMT", + "ETag" : "\"0x8D7325BA7F5B0F9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:49:13.7523961Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45bf3-601a-0000-6644-64923b000000", + "x-ms-client-request-id" : "5d0b6831-ec24-4191-9bed-38ec4492cc2a", + "x-ms-file-last-write-time" : "2019-09-05T23:49:13.6080000Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetpropertiesfilepermissionkey806204", "directoryasyncapitestssetpropertiesfilepermissionkey870254", "2019-09-05T23:49:13.608Z", "2019-09-05T23:49:13.608Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeError.json new file mode 100644 index 000000000000..24b596442821 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeError.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerror068296f8594c8314747?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2533566a-3ef5-4ede-ab23-21415bde487e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B66FED131\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a473c-c01a-0009-1444-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "x-ms-client-request-id" : "2533566a-3ef5-4ede-ab23-21415bde487e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerror068296f8594c8314747/fileapitestsclearrangeerror861868f8d06c5237f43", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b31b9711-6436-42cf-bfda-8714ddfcfa78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:24.8695561Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "ETag" : "\"0x8D7325B670F7D09\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:24.8695561Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a4741-c01a-0009-1844-64d7e8000000", + "x-ms-client-request-id" : "b31b9711-6436-42cf-bfda-8714ddfcfa78", + "x-ms-file-last-write-time" : "2019-09-05T23:47:24.8695561Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerror068296f8594c8314747/fileapitestsclearrangeerror861868f8d06c5237f43?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f539e111-a8b5-49f2-accc-eca51379fd73", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B671EBF5F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4746-c01a-0009-1d44-64d7e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "x-ms-client-request-id" : "f539e111-a8b5-49f2-accc-eca51379fd73", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerror068296f8594c8314747/fileapitestsclearrangeerror861868f8d06c5237f43?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a4515694-deb3-4e7e-8597-e15be828d346" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "7d4a474c-c01a-0009-2244-64d7e8000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:7d4a474c-c01a-0009-2244-64d7e8000000\nTime:2019-09-05T23:47:25.0932988Z", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "x-ms-client-request-id" : "a4515694-deb3-4e7e-8597-e15be828d346", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsclearrangeerror068296f8594c8314747", "fileapitestsclearrangeerror861868f8d06c5237f43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeErrorArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeErrorArgs.json new file mode 100644 index 000000000000..9dd559af63ea --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeErrorArgs.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerrorargs493886e8dbc165c3b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c82d9702-21a6-4dc8-ab2a-4d33e14b9bf6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B675DE17C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4757-c01a-0009-2d44-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:25 GMT", + "x-ms-client-request-id" : "c82d9702-21a6-4dc8-ab2a-4d33e14b9bf6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerrorargs493886e8dbc165c3b/fileapitestsclearrangeerrorargs0048890fb34e825f7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f7e7fee8-abbf-4c25-8261-43d971f97fd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:25.4945714Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:25 GMT", + "ETag" : "\"0x8D7325B676EDBB2\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:25.4945714Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a475e-c01a-0009-3344-64d7e8000000", + "x-ms-client-request-id" : "f7e7fee8-abbf-4c25-8261-43d971f97fd0", + "x-ms-file-last-write-time" : "2019-09-05T23:47:25.4945714Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerrorargs493886e8dbc165c3b/fileapitestsclearrangeerrorargs0048890fb34e825f7?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6babe4af-59be-4a88-b306-d3d4a661c40b", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B677D5B5E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4761-c01a-0009-3644-64d7e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:25 GMT", + "x-ms-client-request-id" : "6babe4af-59be-4a88-b306-d3d4a661c40b", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsclearrangeerrorargs493886e8dbc165c3b/fileapitestsclearrangeerrorargs0048890fb34e825f7?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "936b0733-4351-4b9c-8fb3-fec3cf686f52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "7d4a4765-c01a-0009-3a44-64d7e8000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:7d4a4765-c01a-0009-3a44-64d7e8000000\nTime:2019-09-05T23:47:25.6833108Z", + "Date" : "Thu, 05 Sep 2019 23:47:25 GMT", + "x-ms-client-request-id" : "936b0733-4351-4b9c-8fb3-fec3cf686f52", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsclearrangeerrorargs493886e8dbc165c3b", "fileapitestsclearrangeerrorargs0048890fb34e825f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFile.json new file mode 100644 index 000000000000..8ba7f739a009 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFile.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilefileapitestscreatefile6ec7089566be?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f775ac73-14f8-473a-9ef9-3ecd4f4a5c78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6365C8AA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a464c-c01a-0009-3744-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:18 GMT", + "x-ms-client-request-id" : "f775ac73-14f8-473a-9ef9-3ecd4f4a5c78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilefileapitestscreatefile6ec7089566be/fileapitestscreatefilefileapitestscreatefile6ec55178d7b5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7fcbe9a5-dff5-4bd4-b4e9-da0a5bdc96b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:18.8594037Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:18 GMT", + "ETag" : "\"0x8D7325B637A6975\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:18.8594037Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a464e-c01a-0009-3844-64d7e8000000", + "x-ms-client-request-id" : "7fcbe9a5-dff5-4bd4-b4e9-da0a5bdc96b3", + "x-ms-file-last-write-time" : "2019-09-05T23:47:18.8594037Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilefileapitestscreatefile6ec7089566be", "fileapitestscreatefilefileapitestscreatefile6ec55178d7b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileError.json new file mode 100644 index 000000000000..96e1bf0ac5c6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefileerror41081e8e77d857d3b4b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "27ee4ed5-def9-4085-b707-80a30015101b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B63A9133B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4659-c01a-0009-4344-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:19 GMT", + "x-ms-client-request-id" : "27ee4ed5-def9-4085-b707-80a30015101b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefileerror41081e8e77d857d3b4b/fileapitestscreatefileerror6187051365d949ae347", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d9a9ff1a-cd7f-47b3-a6c1-bbda19485088" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "7d4a465c-c01a-0009-4544-64d7e8000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:7d4a465c-c01a-0009-4544-64d7e8000000\nTime:2019-09-05T23:47:19.2622222Z", + "Date" : "Thu, 05 Sep 2019 23:47:19 GMT", + "x-ms-client-request-id" : "d9a9ff1a-cd7f-47b3-a6c1-bbda19485088", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefileerror41081e8e77d857d3b4b", "fileapitestscreatefileerror6187051365d949ae347" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFilePermissionAndKeyError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFilePermissionAndKeyError0.json new file mode 100644 index 000000000000..c54cd4a00e7a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFilePermissionAndKeyError0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilepermissionandkeyerror07279691620?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "62f40817-5618-4d8d-b3a5-e46f04bc7243" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B64E257A7\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46a5-c01a-0009-0844-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:21 GMT", + "x-ms-client-request-id" : "62f40817-5618-4d8d-b3a5-e46f04bc7243" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilepermissionandkeyerror07279691620", "fileapitestscreatefilepermissionandkeyerror012140a5976" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFilePermissionAndKeyError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFilePermissionAndKeyError1.json new file mode 100644 index 000000000000..43b7f039c6eb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFilePermissionAndKeyError1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilepermissionandkeyerror196067f35a8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "340fea16-beab-49b6-8d58-a08f6ef56213" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B650FF7A3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46b3-c01a-0009-1544-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:21 GMT", + "x-ms-client-request-id" : "340fea16-beab-49b6-8d58-a08f6ef56213" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilepermissionandkeyerror196067f35a8", "fileapitestscreatefilepermissionandkeyerror1119268e5d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgs.json new file mode 100644 index 000000000000..e0431b26cea3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgs.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargs73380e797a662006e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "397adf01-6760-4155-912b-67174659878b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D730D953B9D1D9\"", + "Last-Modified" : "Wed, 04 Sep 2019 01:43:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e7c1890d-101a-0044-49c2-62ec1a000000", + "Date" : "Wed, 04 Sep 2019 01:43:46 GMT", + "x-ms-client-request-id" : "397adf01-6760-4155-912b-67174659878b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargs73380e797a662006e/fileapitestscreatefilewithargs928212ac4504e17da", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "df67108a-45b0-48e6-908d-60e6fdd09865" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:43:46.7398275Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:43:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:43:46 GMT", + "ETag" : "\"0x8D730D953C0D883\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:43:46.7398275Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "e7c1890f-101a-0044-4ac2-62ec1a000000", + "x-ms-client-request-id" : "df67108a-45b0-48e6-908d-60e6fdd09865", + "x-ms-file-last-write-time" : "2019-09-04T01:43:46.7398275Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargs73380e797a662006e", "fileapitestscreatefilewithargs928212ac4504e17da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError0.json new file mode 100644 index 000000000000..ba74b7c33e9a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError0.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargserror098651b181b4bd7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8c06f9df-28dc-4798-83e2-6e55729b6b21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6470D0ED\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4687-c01a-0009-6d44-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:20 GMT", + "x-ms-client-request-id" : "8c06f9df-28dc-4798-83e2-6e55729b6b21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargserror098651b181b4bd7/fileapitestscreatefilewithargserror068945f30b9c0de", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d21556ac-fee7-4c14-be93-22c8a3eec81a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "7d4a468c-c01a-0009-7044-64d7e8000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:7d4a468c-c01a-0009-7044-64d7e8000000\nTime:2019-09-05T23:47:20.5642394Z", + "Date" : "Thu, 05 Sep 2019 23:47:20 GMT", + "x-ms-client-request-id" : "d21556ac-fee7-4c14-be93-22c8a3eec81a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargserror098651b181b4bd7", "fileapitestscreatefilewithargserror068945f30b9c0de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError1.json new file mode 100644 index 000000000000..d66b9e4113c8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError1.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargserror1711786239de6a8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1c65c24e-0692-462b-9d9f-cd911742c053" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B64A72333\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4699-c01a-0009-7d44-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:20 GMT", + "x-ms-client-request-id" : "1c65c24e-0692-462b-9d9f-cd911742c053" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargserror1711786239de6a8/fileapitestscreatefilewithargserror1699185751ddb6a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b88d75f9-a54d-409e-b22d-eb3e9117ac13" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "967", + "StatusCode" : "403", + "x-ms-request-id" : "7d4a469c-c01a-0009-7f44-64d7e8000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:7d4a469c-c01a-0009-7f44-64d7e8000000\nTime:2019-09-05T23:47:20.9232487ZThe MAC signature found in the HTTP request 'ZyTen4ZD/A0HXYc62pEZwXZTT3xJB7WiEGeFFCf85Is=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 05 Sep 2019 23:47:20 GMT\n\n\n\n\n\nx-ms-client-request-id:b88d75f9-a54d-409e-b22d-eb3e9117ac13\nx-ms-content-length:1024\nx-ms-file-attributes:None\nx-ms-file-creation-time:Now\nx-ms-file-last-write-time:Now\nx-ms-file-permission:Inherit\nx-ms-meta-testmeta:value\nx-ms-type:file\nx-ms-version:2019-02-02\n/gapradev/fileapitestscreatefilewithargserror1711786239de6a8/fileapitestscreatefilewithargserror1699185751ddb6a'.", + "Date" : "Thu, 05 Sep 2019 23:47:20 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargserror1711786239de6a8", "fileapitestscreatefilewithargserror1699185751ddb6a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError2.json new file mode 100644 index 000000000000..f19efe9637dc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError2.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror24159255f00d5b2?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721C4D36074BB\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec0e84be-b01a-00a7-44ad-530995000000", + "Date" : "Thu, 15 Aug 2019 21:09:13 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror24159255f00d5b2/fileapitestscreatefilewithargserror24044490d9bcaa1", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "865", + "StatusCode" : "403", + "x-ms-request-id" : "ec0e84c0-b01a-00a7-45ad-530995000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:ec0e84c0-b01a-00a7-45ad-530995000000\nTime:2019-08-15T21:09:14.0445650ZThe MAC signature found in the HTTP request 'JP4ooBRaMLGCKgd7WfBQe+F8eRVIvSqyvgiHYQRjr6k=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 15 Aug 2019 21:09:14 GMT\n\n\n\n\n\nx-ms-client-request-id:c726219e-d5d0-4af9-b4c3-d52e318c69dc\nx-ms-content-length:1024\nx-ms-meta-testmeta:value\nx-ms-type:file\nx-ms-version:2018-11-09\n/azstoragesdkaccount/fileapitestscreatefilewithargserror24159255f00d5b2/fileapitestscreatefilewithargserror24044490d9bcaa1'.", + "Date" : "Thu, 15 Aug 2019 21:09:13 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestscreatefilewithargserror24159255f00d5b2", "fileapitestscreatefilewithargserror24044490d9bcaa1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsFp.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsFp.json new file mode 100644 index 000000000000..19e9cf219956 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsFp.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargsfp52681816fa3414e2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "874b0a30-60bb-4a52-b7d0-4bd16eb4d62d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B64354E3A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4679-c01a-0009-6044-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:19 GMT", + "x-ms-client-request-id" : "874b0a30-60bb-4a52-b7d0-4bd16eb4d62d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargsfp52681816fa3414e2/fileapitestscreatefilewithargsfp748602fed85d1e75", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5338d381-69c2-4419-bb17-c258555fe69c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:20.1430000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:20 GMT", + "ETag" : "\"0x8D7325B643E45F0\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:20.1430000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a467e-c01a-0009-6444-64d7e8000000", + "x-ms-client-request-id" : "5338d381-69c2-4419-bb17-c258555fe69c", + "x-ms-file-last-write-time" : "2019-09-05T23:47:20.1430000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargsfp52681816fa3414e2", "fileapitestscreatefilewithargsfp748602fed85d1e75", "2019-09-05T23:47:20.143Z", "2019-09-05T23:47:20.143Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsFpk.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsFpk.json new file mode 100644 index 000000000000..79360197b963 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsFpk.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargsfpk31360a7ccc29e402?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4d3bc4f8-331c-4c3a-8013-5810a8ae9d15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B63E81896\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4667-c01a-0009-5044-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:19 GMT", + "x-ms-client-request-id" : "4d3bc4f8-331c-4c3a-8013-5810a8ae9d15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargsfpk31360a7ccc29e402?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f25ad923-00fe-47cd-9ef3-718a46c5b726", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a466c-c01a-0009-5444-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:19 GMT", + "x-ms-client-request-id" : "f25ad923-00fe-47cd-9ef3-718a46c5b726" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestscreatefilewithargsfpk31360a7ccc29e402/fileapitestscreatefilewithargsfpk05078f08cdd7501c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e418a5fb-a172-47e0-a1e7-342464028178" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:19.7460000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:19 GMT", + "ETag" : "\"0x8D7325B6401B220\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:19.7460000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a466f-c01a-0009-5744-64d7e8000000", + "x-ms-client-request-id" : "e418a5fb-a172-47e0-a1e7-342464028178", + "x-ms-file-last-write-time" : "2019-09-05T23:47:19.7460000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargsfpk31360a7ccc29e402", "fileapitestscreatefilewithargsfpk05078f08cdd7501c", "2019-09-05T23:47:19.746Z", "2019-09-05T23:47:19.746Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..35f6e24916e9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteDirectory.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletedirectory007969ac26d4558da4b?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB1CB9064E\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:54:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fdc09854-d01a-003f-07b3-5387aa000000", + "Date" : "Thu, 15 Aug 2019 21:54:14 GMT" + } + } ], + "variables" : [ "fileapitestsdeletedirectory007969ac26d4558da4b", "fileapitestsdeletedirectory26233252b9ad4c1774e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFile.json new file mode 100644 index 000000000000..a1a097b83825 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFile.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdeletefilefileapitestsdeletefile9be939524e20?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "13993f39-cd5a-489d-a13a-02f67ea3f5ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6AC2AFEE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733997d-301a-000d-1844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:30 GMT", + "x-ms-client-request-id" : "13993f39-cd5a-489d-a13a-02f67ea3f5ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdeletefilefileapitestsdeletefile9be939524e20/fileapitestsdeletefilefileapitestsdeletefile9be689412a22", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "989601e8-6aba-4f3e-bf8a-67187da4efd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:31.1857244Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:30 GMT", + "ETag" : "\"0x8D7325B6AD3425C\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:31.1857244Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "0733997f-301a-000d-1944-645aef000000", + "x-ms-client-request-id" : "989601e8-6aba-4f3e-bf8a-67187da4efd7", + "x-ms-file-last-write-time" : "2019-09-05T23:47:31.1857244Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdeletefilefileapitestsdeletefile9be939524e20/fileapitestsdeletefilefileapitestsdeletefile9be689412a22", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "55ed7d39-eee1-471f-b173-bdc68fcfecb4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339980-301a-000d-1a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:30 GMT", + "x-ms-client-request-id" : "55ed7d39-eee1-471f-b173-bdc68fcfecb4" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsdeletefilefileapitestsdeletefile9be939524e20", "fileapitestsdeletefilefileapitestsdeletefile9be689412a22" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFileError.json new file mode 100644 index 000000000000..2cdf8bda2969 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFileError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdeletefileerror69698bb8d32a446d640?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9051e396-a22e-49e9-a310-7b20073b053e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6B0ED41C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339984-301a-000d-1e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:31 GMT", + "x-ms-client-request-id" : "9051e396-a22e-49e9-a310-7b20073b053e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdeletefileerror69698bb8d32a446d640/fileapitestsdeletefileerror33237825cf119442b44", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "73de4ddf-1e83-49e2-80b0-d701232ca83e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339986-301a-000d-1f44-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339986-301a-000d-1f44-645aef000000\nTime:2019-09-05T23:47:31.6741329Z", + "Date" : "Thu, 05 Sep 2019 23:47:31 GMT", + "x-ms-client-request-id" : "73de4ddf-1e83-49e2-80b0-d701232ca83e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsdeletefileerror69698bb8d32a446d640", "fileapitestsdeletefileerror33237825cf119442b44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataError.json new file mode 100644 index 000000000000..d13862d6520a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdownloaddataerror62953b7a34560d5104?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1423ba53-a189-4b25-b84b-a0d757225c1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6881BF78\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733994a-301a-000d-6f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:26 GMT", + "x-ms-client-request-id" : "1423ba53-a189-4b25-b84b-a0d757225c1c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsdownloaddataerror62953b7a34560d5104/fileapitestsdownloaddataerror93308916f8f61097f4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "df951654-2826-4a3b-8bd9-b7350d7e6f5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "0733994c-301a-000d-7044-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:0733994c-301a-000d-7044-645aef000000\nTime:2019-09-05T23:47:27.3970933Z", + "Date" : "Thu, 05 Sep 2019 23:47:26 GMT", + "x-ms-client-request-id" : "df951654-2826-4a3b-8bd9-b7350d7e6f5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsdownloaddataerror62953b7a34560d5104", "fileapitestsdownloaddataerror93308916f8f61097f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataWithInvalidArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataWithInvalidArgs.json new file mode 100644 index 000000000000..e723976e9d0d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataWithInvalidArgs.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdownloaddatawithinvalidargs883404b1ba4a9?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72207542CAB85\"", + "Last-Modified" : "Fri, 16 Aug 2019 05:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "29f7aaf2-c01a-00a3-14f0-53fc17000000", + "Date" : "Fri, 16 Aug 2019 05:05:16 GMT" + } + } ], + "variables" : [ "fileapitestsdownloaddatawithinvalidargs883404b1ba4a9", "fileapitestsdownloaddatawithinvalidargs6633091a82a90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsForceCloseHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsForceCloseHandlesError.json new file mode 100644 index 000000000000..c23491f64068 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsForceCloseHandlesError.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsforceclosehandleserror47700a59f2d02fa?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D14B1E5A30\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:38:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "89f9853f-501a-00a6-57ba-530868000000", + "Date" : "Thu, 15 Aug 2019 22:38:28 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsforceclosehandleserror47700a59f2d02fa/fileapitestsforceclosehandleserror92395dc696c9efa", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D14B718BEA\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:38:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "89f98542-501a-00a6-58ba-530868000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 22:38:29 GMT" + } + } ], + "variables" : [ "fileapitestsforceclosehandleserror47700a59f2d02fa", "fileapitestsforceclosehandleserror92395dc696c9efa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetFileURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetFileURL.json new file mode 100644 index 000000000000..d87b32454edf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetFileURL.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetfileurlfileapitestsgetfileurl65975860a1fb?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d6797cba-2bdd-4ff1-8e8a-1c73ee0b7faa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B62FE7AFA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4638-c01a-0009-2644-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:18 GMT", + "x-ms-client-request-id" : "d6797cba-2bdd-4ff1-8e8a-1c73ee0b7faa" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetfileurlfileapitestsgetfileurl65975860a1fb", "fileapitestsgetfileurlfileapitestsgetfileurl659803142c57" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetProperties.json new file mode 100644 index 000000000000..2299a92a7c4f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetProperties.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetpropertiesfileapitestsgetpropertiesb3357060f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2174f4ea-ab81-4dd6-943a-5d9352e3ca92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6B4833C2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733998a-301a-000d-2344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:31 GMT", + "x-ms-client-request-id" : "2174f4ea-ab81-4dd6-943a-5d9352e3ca92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetpropertiesfileapitestsgetpropertiesb3357060f/fileapitestsgetpropertiesfileapitestsgetpropertiesb33002892", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "81b33362-7675-43e3-874e-0038a0b8d6c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:32.0627443Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:31 GMT", + "ETag" : "\"0x8D7325B6B5914F3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:32.0627443Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "0733998d-301a-000d-2544-645aef000000", + "x-ms-client-request-id" : "81b33362-7675-43e3-874e-0038a0b8d6c3", + "x-ms-file-last-write-time" : "2019-09-05T23:47:32.0627443Z" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetpropertiesfileapitestsgetpropertiesb3357060f/fileapitestsgetpropertiesfileapitestsgetpropertiesb33002892", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8adcc394-caf9-400b-8c60-45e9de05deb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:32.0627443Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:31 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B6B5914F3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:32.0627443Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "0733998e-301a-000d-2644-645aef000000", + "x-ms-client-request-id" : "8adcc394-caf9-400b-8c60-45e9de05deb3", + "x-ms-file-last-write-time" : "2019-09-05T23:47:32.0627443Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetpropertiesfileapitestsgetpropertiesb3357060f", "fileapitestsgetpropertiesfileapitestsgetpropertiesb33002892", "2019-09-05T23:47:32.121Z", "2019-09-05T23:47:32.121Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..ee2c1d1a7459 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetPropertiesError.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetpropertieserror96068f91ad0f26993?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "caa426d7-6b7b-45b3-bd51-893930491790" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6B9346A4\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339995-301a-000d-2c44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:31 GMT", + "x-ms-client-request-id" : "caa426d7-6b7b-45b3-bd51-893930491790" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetpropertieserror96068f91ad0f26993/fileapitestsgetpropertieserror34128e5d2a31637b7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eb2c676e-5426-419a-b8b5-48411be3045b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "07339997-301a-000d-2d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:32 GMT", + "x-ms-client-request-id" : "eb2c676e-5426-419a-b8b5-48411be3045b" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetpropertieserror96068f91ad0f26993", "fileapitestsgetpropertieserror34128e5d2a31637b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..f7af18b6a002 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetSnapshotId.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsgetsnapshotidfileapitestsgetsnapshotidd9c95316d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6639ee45-0904-4f63-8700-bc2a94238cd2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6EB102D3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399f4-301a-000d-7444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:37 GMT", + "x-ms-client-request-id" : "6639ee45-0904-4f63-8700-bc2a94238cd2" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetsnapshotidfileapitestsgetsnapshotidd9c95316d", "fileapitestsgetsnapshotidfileapitestsgetsnapshotidd9c334469" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles.json new file mode 100644 index 000000000000..09ed5f2d8b79 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslisthandlesfileapitestslisthandles68465530c87?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2d87af73-fb88-4a15-9020-f22b44369e23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6E1CB1D9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399e4-301a-000d-6744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:36 GMT", + "x-ms-client-request-id" : "2d87af73-fb88-4a15-9020-f22b44369e23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslisthandlesfileapitestslisthandles68465530c87/fileapitestslisthandlesfileapitestslisthandles6845538787a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "87a8b7f2-ceaf-4011-8a5c-aa4c542f1973" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:36.8088671Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:36 GMT", + "ETag" : "\"0x8D7325B6E2D485F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:36.8088671Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399e6-301a-000d-6844-645aef000000", + "x-ms-client-request-id" : "87a8b7f2-ceaf-4011-8a5c-aa4c542f1973", + "x-ms-file-last-write-time" : "2019-09-05T23:47:36.8088671Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslisthandlesfileapitestslisthandles68465530c87/fileapitestslisthandlesfileapitestslisthandles6845538787a?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d6891b7d-13f1-40fe-9206-94923141630c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "073399e7-301a-000d-6944-645aef000000", + "Body" : "", + "Date" : "Thu, 05 Sep 2019 23:47:36 GMT", + "x-ms-client-request-id" : "d6891b7d-13f1-40fe-9206-94923141630c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslisthandlesfileapitestslisthandles68465530c87", "fileapitestslisthandlesfileapitestslisthandles6845538787a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles0.json new file mode 100644 index 000000000000..18a25b48d256 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles0.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles0fileapitestslisthandles0b7080097e3?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB98A1CF9F\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b625-701a-0114-53b4-53b547000000", + "Date" : "Thu, 15 Aug 2019 21:57:41 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles0fileapitestslisthandles0b7080097e3/fileapitestslisthandles0fileapitestslisthandles0b7088309df", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB98CA2C92\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b628-701a-0114-54b4-53b547000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 21:57:41 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles0fileapitestslisthandles0b7080097e3/fileapitestslisthandles0fileapitestslisthandles0b7088309df?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f878b62a-701a-0114-55b4-53b547000000", + "Body" : "2", + "Date" : "Thu, 15 Aug 2019 21:57:41 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestslisthandles0fileapitestslisthandles0b7080097e3", "fileapitestslisthandles0fileapitestslisthandles0b7088309df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles1.json new file mode 100644 index 000000000000..ae9a0c8e1ca0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles1.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles1fileapitestslisthandles10bf9896712?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB993DC0B4\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b62e-701a-0114-58b4-53b547000000", + "Date" : "Thu, 15 Aug 2019 21:57:42 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles1fileapitestslisthandles10bf9896712/fileapitestslisthandles1fileapitestslisthandles10bf600114b", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB9947DF7B\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b630-701a-0114-59b4-53b547000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 21:57:42 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles1fileapitestslisthandles10bf9896712/fileapitestslisthandles1fileapitestslisthandles10bf600114b?comp=listhandles", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f878b631-701a-0114-5ab4-53b547000000", + "Body" : "", + "Date" : "Thu, 15 Aug 2019 21:57:42 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestslisthandles1fileapitestslisthandles10bf9896712", "fileapitestslisthandles1fileapitestslisthandles10bf600114b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesError.json new file mode 100644 index 000000000000..82fee8a48b5b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandleserror07801581e6d95bb9c4?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CD6E85EC4F\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5b04ef3f-001a-0036-4eb6-539d24000000", + "Date" : "Thu, 15 Aug 2019 22:10:49 GMT" + } + } ], + "variables" : [ "fileapitestslisthandleserror07801581e6d95bb9c4", "fileapitestslisthandleserror60820f5f3c418ade74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResult.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResult.json new file mode 100644 index 000000000000..6ce6b3ce62df --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResult.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresult61895e93654bff74?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CD6EA19168\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5b04ef43-001a-0036-51b6-539d24000000", + "Date" : "Thu, 15 Aug 2019 22:10:50 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresult61895e93654bff74/fileapitestslisthandlesmaxresult487476599037fe47", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CD6EACB954\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5b04ef45-001a-0036-52b6-539d24000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 22:10:50 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresult61895e93654bff74/fileapitestslisthandlesmaxresult487476599037fe47?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5b04ef46-001a-0036-53b6-539d24000000", + "Body" : "2", + "Date" : "Thu, 15 Aug 2019 22:10:50 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestslisthandlesmaxresult61895e93654bff74", "fileapitestslisthandlesmaxresult487476599037fe47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResultError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResultError.json new file mode 100644 index 000000000000..408092c212dd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResultError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresulterror42018bc31c3b7f?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CDD1554FFC\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:13:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c2a54d87-d01a-0095-03b6-535145000000", + "Date" : "Thu, 15 Aug 2019 22:13:45 GMT" + } + } ], + "variables" : [ "fileapitestslisthandlesmaxresulterror42018bc31c3b7f", "fileapitestslisthandlesmaxresulterror06965ee292517a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesWithMaxResult.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesWithMaxResult.json new file mode 100644 index 000000000000..41eb9c89cbe1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesWithMaxResult.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslisthandleswithmaxresult63770adbdd123d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c995ec90-788f-4d98-9c9b-f9fb7be908ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6E65058C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399ea-301a-000d-6c44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:36 GMT", + "x-ms-client-request-id" : "c995ec90-788f-4d98-9c9b-f9fb7be908ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslisthandleswithmaxresult63770adbdd123d/fileapitestslisthandleswithmaxresult91368c81f428e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9f5c8de2-9be0-4577-b365-4c5ab196b2cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:37.3098817Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:36 GMT", + "ETag" : "\"0x8D7325B6E79BB41\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:37.3098817Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399ee-301a-000d-6e44-645aef000000", + "x-ms-client-request-id" : "9f5c8de2-9be0-4577-b365-4c5ab196b2cd", + "x-ms-file-last-write-time" : "2019-09-05T23:47:37.3098817Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslisthandleswithmaxresult63770adbdd123d/fileapitestslisthandleswithmaxresult91368c81f428e4?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "52abba31-47fb-499f-841a-8c26eec09b30" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "073399f1-301a-000d-7144-645aef000000", + "Body" : "2", + "Date" : "Thu, 05 Sep 2019 23:47:36 GMT", + "x-ms-client-request-id" : "52abba31-47fb-499f-841a-8c26eec09b30", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslisthandleswithmaxresult63770adbdd123d", "fileapitestslisthandleswithmaxresult91368c81f428e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRanges.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRanges.json new file mode 100644 index 000000000000..9e9170ceee8a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRanges.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangesfileapitestslistranges95e451736f95?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d7cee7ae-809f-4571-a0bd-bfd31efda941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6D6BD80C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399d0-301a-000d-5744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "x-ms-client-request-id" : "d7cee7ae-809f-4571-a0bd-bfd31efda941" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangesfileapitestslistranges95e451736f95/fileapitestslistrangesfileapitestslistranges95e98085cf85", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "135f6fb3-ccd7-4369-9270-2d50fe0be898" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:35.6518378Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "ETag" : "\"0x8D7325B6D7CBBEA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:35.6518378Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399d5-301a-000d-5944-645aef000000", + "x-ms-client-request-id" : "135f6fb3-ccd7-4369-9270-2d50fe0be898", + "x-ms-file-last-write-time" : "2019-09-05T23:47:35.6518378Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangesfileapitestslistranges95e451736f95/fileapitestslistrangesfileapitestslistranges95e98085cf85?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8554c772-e5cb-4a77-add6-3330fc1cd0ac", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6D8E212E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399d6-301a-000d-5a44-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "x-ms-client-request-id" : "8554c772-e5cb-4a77-add6-3330fc1cd0ac", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangesfileapitestslistranges95e451736f95/fileapitestslistrangesfileapitestslistranges95e98085cf85?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f27811b8-7492-4c38-8d1d-29096b788c33" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "ETag" : "\"0x8D7325B6D8E212E\"", + "x-ms-request-id" : "073399d7-301a-000d-5b44-645aef000000", + "Body" : "01023", + "x-ms-client-request-id" : "f27811b8-7492-4c38-8d1d-29096b788c33", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslistrangesfileapitestslistranges95e451736f95", "fileapitestslistrangesfileapitestslistranges95e98085cf85", "filefileapitestslistranges95e426090d14d0cd154d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesError.json new file mode 100644 index 000000000000..8845bfcc86b1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeserror8797419eac825c17f4e?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D271C5FE2F\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:46:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "35821212-701a-00f5-02bb-531467000000", + "Date" : "Thu, 15 Aug 2019 22:46:43 GMT" + } + } ], + "variables" : [ "fileapitestslistrangeserror8797419eac825c17f4e", "fileapitestslistrangeserror83842d86070379eba46" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRange.json new file mode 100644 index 000000000000..ce53d6d5b6f3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRange.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangeswithrange64850ab59f100a67c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c550a1cc-ca7a-40d7-8b28-4b34c2be33e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6DC62D32\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399db-301a-000d-5f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "x-ms-client-request-id" : "c550a1cc-ca7a-40d7-8b28-4b34c2be33e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangeswithrange64850ab59f100a67c/fileapitestslistrangeswithrange03111a98a740d707d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cb4f5ac2-3337-4600-9336-ac9086e2ee0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:36.2378539Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "ETag" : "\"0x8D7325B6DD6272B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:36.2378539Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399dd-301a-000d-6044-645aef000000", + "x-ms-client-request-id" : "cb4f5ac2-3337-4600-9336-ac9086e2ee0c", + "x-ms-file-last-write-time" : "2019-09-05T23:47:36.2378539Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangeswithrange64850ab59f100a67c/fileapitestslistrangeswithrange03111a98a740d707d?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2698a3b8-4daa-400a-a543-6f86045e412e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6DE4A62C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399de-301a-000d-6144-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "x-ms-client-request-id" : "2698a3b8-4daa-400a-a543-6f86045e412e", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestslistrangeswithrange64850ab59f100a67c/fileapitestslistrangeswithrange03111a98a740d707d?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ddb80ce3-b705-4618-af03-198b38eb15a3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:36 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:35 GMT", + "ETag" : "\"0x8D7325B6DE4A62C\"", + "x-ms-request-id" : "073399df-301a-000d-6244-645aef000000", + "Body" : "0511", + "x-ms-client-request-id" : "ddb80ce3-b705-4618-af03-198b38eb15a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslistrangeswithrange64850ab59f100a67c", "fileapitestslistrangeswithrange03111a98a740d707d", "filefileapitestslistrangeswithrange6f298126b1aecb9f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRangeError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRangeError.json new file mode 100644 index 000000000000..466b17f4e1e4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRangeError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeswithrangeerror77992342914f74?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D2256AC5F0\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:44:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe956e2-001a-0014-75ba-53f312000000", + "Date" : "Thu, 15 Aug 2019 22:44:35 GMT" + } + } ], + "variables" : [ "fileapitestslistrangeswithrangeerror77992342914f74", "fileapitestslistrangeswithrangeerror3346158f194879" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeaders.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeaders.json new file mode 100644 index 000000000000..83a3dc91467a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeaders.json @@ -0,0 +1,60 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaders31520aa9aa28ab99240?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EA746B2CF\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:51:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1152b5da-c01a-0064-1877-5780d6000000", + "Date" : "Tue, 20 Aug 2019 16:51:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaders31520aa9aa28ab99240/fileapitestssethttpheaders99135bba7398455394e", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EA74C5433\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:51:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1152b5dc-c01a-0064-1977-5780d6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:51:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaders31520aa9aa28ab99240/fileapitestssethttpheaders99135bba7398455394e?comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EA7586525\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:51:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1152b5dd-c01a-0064-1a77-5780d6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:51:31 GMT" + } + } ], + "variables" : [ "fileapitestssethttpheaders31520aa9aa28ab99240", "fileapitestssethttpheaders99135bba7398455394e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersError.json new file mode 100644 index 000000000000..867bd172c652 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheaderserror138571130e03e6029?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bec6723e-dd87-4eb2-a103-5f5c9b29198d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6C6FEB6C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399ac-301a-000d-4044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:33 GMT", + "x-ms-client-request-id" : "bec6723e-dd87-4eb2-a103-5f5c9b29198d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheaderserror138571130e03e6029/fileapitestssethttpheaderserror80189d02f37ab59a0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e1700de2-a678-4af2-a16f-c1267358eb5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:33.9967976Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:33 GMT", + "ETag" : "\"0x8D7325B6C8031E8\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:33.9967976Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399af-301a-000d-4244-645aef000000", + "x-ms-client-request-id" : "e1700de2-a678-4af2-a16f-c1267358eb5a", + "x-ms-file-last-write-time" : "2019-09-05T23:47:33.9967976Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheaderserror138571130e03e6029/fileapitestssethttpheaderserror80189d02f37ab59a0?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9d0a869f-3d1b-4529-bff4-15e446d1c605" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "073399b1-301a-000d-4444-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:073399b1-301a-000d-4444-645aef000000\nTime:2019-09-05T23:47:34.0951369Z", + "Date" : "Thu, 05 Sep 2019 23:47:33 GMT", + "x-ms-client-request-id" : "9d0a869f-3d1b-4529-bff4-15e446d1c605", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssethttpheaderserror138571130e03e6029", "fileapitestssethttpheaderserror80189d02f37ab59a0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersFp.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersFp.json new file mode 100644 index 000000000000..72dd36b54388 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersFp.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfp54644dc00a69f5ddc4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "df29633a-2fa3-4067-a2c6-f269243e0af8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6C24B19A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399a4-301a-000d-3944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:32 GMT", + "x-ms-client-request-id" : "df29633a-2fa3-4067-a2c6-f269243e0af8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfp54644dc00a69f5ddc4/fileapitestssethttpheadersfp26647566b80e688be4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "db04e836-1978-40e5-b15f-b373225a831b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:33.5067807Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:33 GMT", + "ETag" : "\"0x8D7325B6C356C9F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:33.5067807Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399a6-301a-000d-3a44-645aef000000", + "x-ms-client-request-id" : "db04e836-1978-40e5-b15f-b373225a831b", + "x-ms-file-last-write-time" : "2019-09-05T23:47:33.5067807Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfp54644dc00a69f5ddc4/fileapitestssethttpheadersfp26647566b80e688be4?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8382c6d1-380b-4fec-b917-998e39159ea6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:33.5650000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:33 GMT", + "ETag" : "\"0x8D7325B6C44FD3C\"", + "x-ms-file-attributes" : "None", + "x-ms-file-change-time" : "2019-09-05T23:47:33.6087868Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399a8-301a-000d-3c44-645aef000000", + "x-ms-client-request-id" : "8382c6d1-380b-4fec-b917-998e39159ea6", + "x-ms-file-last-write-time" : "2019-09-05T23:47:33.5650000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssethttpheadersfp54644dc00a69f5ddc4", "fileapitestssethttpheadersfp26647566b80e688be4", "2019-09-05T23:47:33.565Z", "2019-09-05T23:47:33.565Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersFpk.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersFpk.json new file mode 100644 index 000000000000..96474fd64ef8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersFpk.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfpk3885462a6f34780604?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fa5c46b0-5bf5-48e7-af0a-11cc71c4cf78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6BCD1B5E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733999b-301a-000d-3144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:32 GMT", + "x-ms-client-request-id" : "fa5c46b0-5bf5-48e7-af0a-11cc71c4cf78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfpk3885462a6f34780604/fileapitestssethttpheadersfpk99596a9607167b8f14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dc812b24-7f2b-4268-bfc5-3fddb9601849" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:32.9297677Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:32 GMT", + "ETag" : "\"0x8D7325B6BDD610D\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:32.9297677Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "0733999d-301a-000d-3244-645aef000000", + "x-ms-client-request-id" : "dc812b24-7f2b-4268-bfc5-3fddb9601849", + "x-ms-file-last-write-time" : "2019-09-05T23:47:32.9297677Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfpk3885462a6f34780604?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c1785f3a-b098-4e0e-b2a1-be15f89505f4", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733999f-301a-000d-3444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:32 GMT", + "x-ms-client-request-id" : "c1785f3a-b098-4e0e-b2a1-be15f89505f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssethttpheadersfpk3885462a6f34780604/fileapitestssethttpheadersfpk99596a9607167b8f14?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bca6bc71-e892-442a-b53c-3766396ca855" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:33.0750000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:32 GMT", + "ETag" : "\"0x8D7325B6BF94DA6\"", + "x-ms-file-attributes" : "None", + "x-ms-file-change-time" : "2019-09-05T23:47:33.1127718Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399a0-301a-000d-3544-645aef000000", + "x-ms-client-request-id" : "bca6bc71-e892-442a-b53c-3766396ca855", + "x-ms-file-last-write-time" : "2019-09-05T23:47:33.0750000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssethttpheadersfpk3885462a6f34780604", "fileapitestssethttpheadersfpk99596a9607167b8f14", "2019-09-05T23:47:33.075Z", "2019-09-05T23:47:33.075Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadata.json new file mode 100644 index 000000000000..161db50ec842 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadata.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadata2c19861458d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d47731c5-7baf-41df-9658-cae0a0c4b89a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6CB8DBA3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399b4-301a-000d-4744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:33 GMT", + "x-ms-client-request-id" : "d47731c5-7baf-41df-9658-cae0a0c4b89a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadata2c19861458d/fileapitestssetmetadatafileapitestssetmetadata2c199532f9b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9874ef0b-916e-49da-8a21-42272d9d9f44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:34.4908069Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "ETag" : "\"0x8D7325B6CCB9325\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:34.4908069Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399be-301a-000d-4844-645aef000000", + "x-ms-client-request-id" : "9874ef0b-916e-49da-8a21-42272d9d9f44", + "x-ms-file-last-write-time" : "2019-09-05T23:47:34.4908069Z" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadata2c19861458d/fileapitestssetmetadatafileapitestssetmetadata2c199532f9b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c8aadf02-a7df-4469-b11a-48b157625c54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:34.4908069Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B6CCB9325\"", + "x-ms-file-attributes" : "Archive", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-09-05T23:47:34.4908069Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "073399bf-301a-000d-4944-645aef000000", + "x-ms-client-request-id" : "c8aadf02-a7df-4469-b11a-48b157625c54", + "x-ms-file-last-write-time" : "2019-09-05T23:47:34.4908069Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadata2c19861458d/fileapitestssetmetadatafileapitestssetmetadata2c199532f9b?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5f28c580-df21-4e8a-bf55-53b1608ceffa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6CE86A21\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "073399c2-301a-000d-4b44-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "x-ms-client-request-id" : "5f28c580-df21-4e8a-bf55-53b1608ceffa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadata2c19861458d/fileapitestssetmetadatafileapitestssetmetadata2c199532f9b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "438593d3-09fd-4632-8838-5440d8a56cdd" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:34.4908069Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B6CE86A21\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:34.6798113Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "073399c4-301a-000d-4c44-645aef000000", + "x-ms-client-request-id" : "438593d3-09fd-4632-8838-5440d8a56cdd", + "x-ms-file-last-write-time" : "2019-09-05T23:47:34.4908069Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssetmetadatafileapitestssetmetadata2c19861458d", "fileapitestssetmetadatafileapitestssetmetadata2c199532f9b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadataError.json new file mode 100644 index 000000000000..e58d755a382f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadataError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadataerror24472e7bb8befef5c4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "86cd104b-0f71-4062-b3de-a75dbd2ef632" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6D20C546\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "073399c8-301a-000d-5044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "x-ms-client-request-id" : "86cd104b-0f71-4062-b3de-a75dbd2ef632" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadataerror24472e7bb8befef5c4/fileapitestssetmetadataerror94987516c9f381b324", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3eb66ebc-21d7-43c7-a2d2-0379d05c9141" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:35.1698332Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "ETag" : "\"0x8D7325B6D332F9C\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:35.1698332Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "073399ca-301a-000d-5144-645aef000000", + "x-ms-client-request-id" : "3eb66ebc-21d7-43c7-a2d2-0379d05c9141", + "x-ms-file-last-write-time" : "2019-09-05T23:47:35.1698332Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestssetmetadataerror24472e7bb8befef5c4/fileapitestssetmetadataerror94987516c9f381b324?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ae0f3940-52d1-4eb1-bc5d-099a99bce6bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "073399cb-301a-000d-5244-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:073399cb-301a-000d-5244-645aef000000\nTime:2019-09-05T23:47:35.2781449Zvalue", + "Date" : "Thu, 05 Sep 2019 23:47:34 GMT", + "x-ms-client-request-id" : "ae0f3940-52d1-4eb1-bc5d-099a99bce6bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssetmetadataerror24472e7bb8befef5c4", "fileapitestssetmetadataerror94987516c9f381b324" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopy.json new file mode 100644 index 000000000000..357b966c0970 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopy.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsstartcopyfileapitestsstartcopy0857329927a52?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "816702a4-c27e-4267-bd02-65c6e6a33c1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B69A8B450\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339969-301a-000d-0844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "x-ms-client-request-id" : "816702a4-c27e-4267-bd02-65c6e6a33c1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsstartcopyfileapitestsstartcopy0857329927a52/fileapitestsstartcopyfileapitestsstartcopy08504293b9e75", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "63acb1e9-a418-4ccc-a077-eabd803016d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:29.3416744Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "ETag" : "\"0x8D7325B69B9E128\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:29.3416744Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "0733996b-301a-000d-0944-645aef000000", + "x-ms-client-request-id" : "63acb1e9-a418-4ccc-a077-eabd803016d6", + "x-ms-file-last-write-time" : "2019-09-05T23:47:29.3416744Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsstartcopyfileapitestsstartcopy0857329927a52/fileapitestsstartcopyfileapitestsstartcopy08504293b9e75", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2ffe080d-98db-49c9-877f-7690fdc52809" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "3f1e7246-723d-4b16-bca2-e3eeed88ca8c", + "ETag" : "\"0x8D7325B6A0A99B9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "0733996d-301a-000d-0b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:29 GMT", + "x-ms-client-request-id" : "2ffe080d-98db-49c9-877f-7690fdc52809" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsstartcopyfileapitestsstartcopy0857329927a52", "fileapitestsstartcopyfileapitestsstartcopy08504293b9e75" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopyError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopyError.json new file mode 100644 index 000000000000..686b62e32760 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopyError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsstartcopyerror11872e181b2f0cf9947?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0ffa0f98-a426-4912-92ee-652f968ac7a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6A39D088\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339974-301a-000d-1044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:29 GMT", + "x-ms-client-request-id" : "0ffa0f98-a426-4912-92ee-652f968ac7a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsstartcopyerror11872e181b2f0cf9947/fileapitestsstartcopyerror001799143c11ac35048", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4a5baec1-8eae-4990-94a0-6792ac5afc0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:30.3017030Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:29 GMT", + "ETag" : "\"0x8D7325B6A4C5E46\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:30.3017030Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339977-301a-000d-1244-645aef000000", + "x-ms-client-request-id" : "4a5baec1-8eae-4990-94a0-6792ac5afc0a", + "x-ms-file-last-write-time" : "2019-09-05T23:47:30.3017030Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsstartcopyerror11872e181b2f0cf9947/fileapitestsstartcopyerror001799143c11ac35048", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c7e5142a-defa-4268-aec5-ae8e7d2b5895" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "330", + "StatusCode" : "400", + "x-ms-request-id" : "07339978-301a-000d-1344-645aef000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:07339978-301a-000d-1344-645aef000000\nTime:2019-09-05T23:47:30.8151149Zx-ms-copy-sourcesome url", + "Date" : "Thu, 05 Sep 2019 23:47:30 GMT", + "x-ms-client-request-id" : "c7e5142a-defa-4268-aec5-ae8e7d2b5895", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsstartcopyerror11872e181b2f0cf9947", "fileapitestsstartcopyerror001799143c11ac35048" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRange.json new file mode 100644 index 000000000000..a97f231b8611 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRange.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrange62782c9c1b1418b35?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b637bf7c-ff92-4653-b698-3779b578ea9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B662B05C3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4704-c01a-0009-5f44-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:23 GMT", + "x-ms-client-request-id" : "b637bf7c-ff92-4653-b698-3779b578ea9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrange62782c9c1b1418b35/fileapitestsuploadandclearrange77612418108134fdb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2ccdcc6f-b4ba-49e8-947b-bd9296ad3279" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:23.4855240Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:23 GMT", + "ETag" : "\"0x8D7325B663C4D48\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:23.4855240Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a4709-c01a-0009-6344-64d7e8000000", + "x-ms-client-request-id" : "2ccdcc6f-b4ba-49e8-947b-bd9296ad3279", + "x-ms-file-last-write-time" : "2019-09-05T23:47:23.4855240Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrange62782c9c1b1418b35/fileapitestsuploadandclearrange77612418108134fdb?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d744cedc-940c-4307-aad6-f99bb512820e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B664AA52D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a470d-c01a-0009-6744-64d7e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:23 GMT", + "x-ms-client-request-id" : "d744cedc-940c-4307-aad6-f99bb512820e", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrange62782c9c1b1418b35/fileapitestsuploadandclearrange77612418108134fdb?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c5d415d3-c384-4eb4-a88b-29c236b043e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B665B1FFC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a470f-c01a-0009-6944-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:23 GMT", + "x-ms-client-request-id" : "c5d415d3-c384-4eb4-a88b-29c236b043e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrange62782c9c1b1418b35/fileapitestsuploadandclearrange77612418108134fdb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4748a855-fd12-47d8-a148-3ce708c60c49" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:23.4855240Z", + "Content-Range" : "bytes 0-6/22", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:23 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "7", + "x-ms-request-id" : "7d4a4712-c01a-0009-6c44-64d7e8000000", + "Body" : "[0, 0, 0, 0, 0, 0, 0]", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:47:23 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B665B1FFC\"", + "x-ms-file-change-time" : "2019-09-05T23:47:23.4855240Z", + "x-ms-file-parent-id" : "0", + "x-ms-client-request-id" : "4748a855-fd12-47d8-a148-3ce708c60c49", + "x-ms-file-last-write-time" : "2019-09-05T23:47:23.4855240Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadandclearrange62782c9c1b1418b35", "fileapitestsuploadandclearrange77612418108134fdb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRangeWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRangeWithArgs.json new file mode 100644 index 000000000000..4c52efa5e95e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRangeWithArgs.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrangewithargs62371138ab4de?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "70f858bf-8d15-417a-a3ec-2a35e810eb43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6695607A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a471f-c01a-0009-7944-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:23 GMT", + "x-ms-client-request-id" : "70f858bf-8d15-417a-a3ec-2a35e810eb43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrangewithargs62371138ab4de/fileapitestsuploadandclearrangewithargs849025464efdf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "26103a88-d768-4c6d-a573-389a3e256c40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:24.1985399Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "ETag" : "\"0x8D7325B66A91977\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:24.1985399Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a4725-c01a-0009-7e44-64d7e8000000", + "x-ms-client-request-id" : "26103a88-d768-4c6d-a573-389a3e256c40", + "x-ms-file-last-write-time" : "2019-09-05T23:47:24.1985399Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrangewithargs62371138ab4de/fileapitestsuploadandclearrangewithargs849025464efdf?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b6bc32b3-acdf-480c-9673-98b3924c43c4", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B66B80DBB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4729-c01a-0009-0244-64d7e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "x-ms-client-request-id" : "b6bc32b3-acdf-480c-9673-98b3924c43c4", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrangewithargs62371138ab4de/fileapitestsuploadandclearrangewithargs849025464efdf?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ad5434ca-39d3-4439-863e-7de682433652" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B66C665C0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a472d-c01a-0009-0644-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "x-ms-client-request-id" : "ad5434ca-39d3-4439-863e-7de682433652" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadandclearrangewithargs62371138ab4de/fileapitestsuploadandclearrangewithargs849025464efdf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f9d0887c-8843-49d9-84a6-5a3f3c57f232" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:24.1985399Z", + "Content-Range" : "bytes 1-7/22", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:24 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "7", + "x-ms-request-id" : "7d4a4732-c01a-0009-0a44-64d7e8000000", + "Body" : "[0, 0, 0, 0, 0, 0, 0]", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:47:24 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B66C665C0\"", + "x-ms-file-change-time" : "2019-09-05T23:47:24.1985399Z", + "x-ms-file-parent-id" : "0", + "x-ms-client-request-id" : "f9d0887c-8843-49d9-84a6-5a3f3c57f232", + "x-ms-file-last-write-time" : "2019-09-05T23:47:24.1985399Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadandclearrangewithargs62371138ab4de", "fileapitestsuploadandclearrangewithargs849025464efdf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadData.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadData.json new file mode 100644 index 000000000000..b2dc628beba5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadData.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddata32075d17389b70b3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "934df7b8-d3de-4d5d-b2a5-30ab1463228b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B653A3BE5\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46be-c01a-0009-1f44-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:21 GMT", + "x-ms-client-request-id" : "934df7b8-d3de-4d5d-b2a5-30ab1463228b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddata32075d17389b70b3/fileapitestsuploadanddownloaddata3731879ec572caec", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "173835e8-152c-4cd6-bd92-47ed9ef0533a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:21.9044799Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:21 GMT", + "ETag" : "\"0x8D7325B654B0DBF\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:21.9044799Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a46c3-c01a-0009-2344-64d7e8000000", + "x-ms-client-request-id" : "173835e8-152c-4cd6-bd92-47ed9ef0533a", + "x-ms-file-last-write-time" : "2019-09-05T23:47:21.9044799Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddata32075d17389b70b3/fileapitestsuploadanddownloaddata3731879ec572caec?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4ead7c0f-f7b8-4f44-aa80-df9626c84a0b", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6559DAFF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46c8-c01a-0009-2844-64d7e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:21 GMT", + "x-ms-client-request-id" : "4ead7c0f-f7b8-4f44-aa80-df9626c84a0b", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddata32075d17389b70b3/fileapitestsuploadanddownloaddata3731879ec572caec", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9e3dddb2-a510-49ca-ba01-b1de10a31407" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:21.9044799Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:21 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B6559DAFF\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:21.9044799Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "7d4a46cb-c01a-0009-2b44-64d7e8000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "9e3dddb2-a510-49ca-ba01-b1de10a31407", + "x-ms-file-last-write-time" : "2019-09-05T23:47:21.9044799Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloaddata32075d17389b70b3", "fileapitestsuploadanddownloaddata3731879ec572caec" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs.json new file mode 100644 index 000000000000..921c1bc2a070 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs.json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs0689875c38ed?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "40875e7d-a87e-474c-957e-cb0308b4face" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6595A2B4\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46da-c01a-0009-3944-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:22 GMT", + "x-ms-client-request-id" : "40875e7d-a87e-474c-957e-cb0308b4face" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs0689875c38ed/fileapitestsuploadanddownloaddatawithargs42137264417c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "038d022b-d61e-4111-94ab-dd59f410aebc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:22.5034986Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:22 GMT", + "ETag" : "\"0x8D7325B65A674EA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:22.5034986Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a46e0-c01a-0009-3d44-64d7e8000000", + "x-ms-client-request-id" : "038d022b-d61e-4111-94ab-dd59f410aebc", + "x-ms-file-last-write-time" : "2019-09-05T23:47:22.5034986Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs0689875c38ed/fileapitestsuploadanddownloaddatawithargs42137264417c?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a99c5920-1040-4fb6-832b-56685091caa8", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B65B4CD0A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46e2-c01a-0009-3f44-64d7e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:22 GMT", + "x-ms-client-request-id" : "a99c5920-1040-4fb6-832b-56685091caa8", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs0689875c38ed/fileapitestsuploadanddownloaddatawithargs42137264417c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9a57f98f-4511-4b48-94e2-f2f69e867919" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:22.5034986Z", + "Content-Range" : "bytes 1-7/1024", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "7", + "x-ms-request-id" : "7d4a46e6-c01a-0009-4344-64d7e8000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:47:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B65B4CD0A\"", + "x-ms-file-change-time" : "2019-09-05T23:47:22.5034986Z", + "x-ms-file-parent-id" : "0", + "x-ms-client-request-id" : "9a57f98f-4511-4b48-94e2-f2f69e867919", + "x-ms-file-last-write-time" : "2019-09-05T23:47:22.5034986Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithargs0689875c38ed", "fileapitestsuploadanddownloaddatawithargs42137264417c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs0.json new file mode 100644 index 000000000000..0c8a0ffa5b64 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs0.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs085390bdc2eb?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C76D217E5A\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cbbdf281-401a-00b9-0cb0-56d378000000", + "Date" : "Mon, 19 Aug 2019 17:05:23 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs085390bdc2eb/fileapitestsuploadanddownloaddatawithargs081781b03658", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C76D614771\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cbbdf28d-401a-00b9-16b0-56d378000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 17:05:24 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithargs085390bdc2eb", "fileapitestsuploadanddownloaddatawithargs081781b03658" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs1.json new file mode 100644 index 000000000000..fff654f66186 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs1.json @@ -0,0 +1,61 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs1211249b3ba2?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C5E0BF0EED\"", + "Last-Modified" : "Mon, 19 Aug 2019 16:54:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e741bfcc-701a-00b1-0dae-56c80b000000", + "Date" : "Mon, 19 Aug 2019 16:54:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs1211249b3ba2/fileapitestsuploadanddownloaddatawithargs123241e54d85", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C5E0C64520\"", + "Last-Modified" : "Mon, 19 Aug 2019 16:54:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e741bfce-701a-00b1-0eae-56c80b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 16:54:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs1211249b3ba2/fileapitestsuploadanddownloaddatawithargs123241e54d85?comp=range", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "e741bfcf-701a-00b1-0fae-56c80b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:e741bfcf-701a-00b1-0fae-56c80b000000\nTime:2019-08-19T16:54:19.5050337ZContent-Length7", + "Date" : "Mon, 19 Aug 2019 16:54:18 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithargs1211249b3ba2", "fileapitestsuploadanddownloaddatawithargs123241e54d85" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs0.json new file mode 100644 index 000000000000..7b1bd4bc02ae --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs0.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs0438694be?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253D0A70A7D3\"", + "Last-Modified" : "Tue, 20 Aug 2019 07:07:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "02b97ed6-901a-005e-6f25-57c375000000", + "Date" : "Tue, 20 Aug 2019 07:07:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs0438694be/fileapitestsuploadanddownloaddatawithinvalidargs082102db9", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253D0B265DCB\"", + "Last-Modified" : "Tue, 20 Aug 2019 07:07:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "02b97eda-901a-005e-7025-57c375000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 07:07:19 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithinvalidargs0438694be", "fileapitestsuploadanddownloaddatawithinvalidargs082102db9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs1.json new file mode 100644 index 000000000000..814923b2b799 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs1.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs1750279bc?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E0110C1\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec858-801a-0086-4824-5764a4000000", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs1750279bc/fileapitestsuploadanddownloaddatawithinvalidargs157651bf8", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E0A0789\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec85a-801a-0086-4924-5764a4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithinvalidargs1750279bc", "fileapitestsuploadanddownloaddatawithinvalidargs157651bf8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs2.json new file mode 100644 index 000000000000..a43aa25fa942 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs2.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs2910068b3?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E27B50D\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec85d-801a-0086-4c24-5764a4000000", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs2910068b3/fileapitestsuploadanddownloaddatawithinvalidargs240570680", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E300F81\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec860-801a-0086-4e24-5764a4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithinvalidargs2910068b3", "fileapitestsuploadanddownloaddatawithinvalidargs240570680" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFile.json new file mode 100644 index 000000000000..7d5590524dc1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFile.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7282980F6AD96\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845a7-201a-006e-7512-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:00 GMT", + "x-ms-client-request-id" : "38dcd202-3e67-4b7c-a2d1-082d8aac736a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:01.9349635Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "ETag" : "\"0x8D7282981019683\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:01.9349635Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b845a9-201a-006e-7612-5a995f000000", + "x-ms-client-request-id" : "735190d0-13ea-4b8b-9889-65db5601f6a4", + "x-ms-file-last-write-time" : "2019-08-24T00:25:01.9349635Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/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-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829810F7CA3\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845aa-201a-006e-7712-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "x-ms-client-request-id" : "7632a45a-c234-4457-b53e-ed037957c438", + "Content-MD5" : "/CTzx8jXJ1MqqUsC1dJBUQ==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:01.9349635Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829810F7CA3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:01.9349635Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "90b845ab-201a-006e-7812-5a995f000000", + "x-ms-client-request-id" : "e99aedb5-800b-4f79-a571-514bc0f094ff", + "x-ms-file-last-write-time" : "2019-08-24T00:25:01.9349635Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:01.9349635Z", + "Content-Range" : "bytes 0-13/14", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829810F7CA3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:01.9349635Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "90b845ac-201a-006e-7912-5a995f000000", + "Body" : "[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33, 13, 10]", + "x-ms-client-request-id" : "45a2f234-95ba-4e7c-beef-b35fdaf96e12", + "x-ms-file-last-write-time" : "2019-08-24T00:25:01.9349635Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloadfile85590e29f75d2bec", "fileapitestsuploadanddownloadfile921481030646d3c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFileExists.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFileExists.json new file mode 100644 index 000000000000..e2bd974f0635 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFileExists.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadfileexists0329111f6c389?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f6376fe7-a685-4cd0-a4d0-19dfcda6a3f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B68E822C2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339957-301a-000d-7944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:27 GMT", + "x-ms-client-request-id" : "f6376fe7-a685-4cd0-a4d0-19dfcda6a3f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadfileexists0329111f6c389/fileapitestsuploadanddownloadfileexists886809c2e8a51", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7696742d-44ea-4701-94ad-6a6a0a8c26aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:28.0886415Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:27 GMT", + "ETag" : "\"0x8D7325B68FAAE8F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:28.0886415Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339959-301a-000d-7a44-645aef000000", + "x-ms-client-request-id" : "7696742d-44ea-4701-94ad-6a6a0a8c26aa", + "x-ms-file-last-write-time" : "2019-09-05T23:47:28.0886415Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadfileexists0329111f6c389/fileapitestsuploadanddownloadfileexists886809c2e8a51?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "487903c0-8fab-4d51-a8c5-af603bf305a8", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B69097B9C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733995a-301a-000d-7b44-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:27 GMT", + "x-ms-client-request-id" : "487903c0-8fab-4d51-a8c5-af603bf305a8", + "Content-MD5" : "SBhvnLsTIqH+vn9SjVscdA==" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloadfileexists0329111f6c389", "fileapitestsuploadanddownloadfileexists886809c2e8a51" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadToFileDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadToFileDoesNotExist.json new file mode 100644 index 000000000000..56ccc6f91981 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadToFileDoesNotExist.json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadtofiledoesnotexist894649465?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "08bf7b3b-e17b-436b-a305-9f9ed300aa81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B69350A4E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0733995f-301a-000d-7f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "x-ms-client-request-id" : "08bf7b3b-e17b-436b-a305-9f9ed300aa81" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadtofiledoesnotexist894649465/fileapitestsuploadanddownloadtofiledoesnotexist85123d3a0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "87b301e8-fab4-4c44-af4b-b1e8d33d806f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:28.5926531Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "ETag" : "\"0x8D7325B69479683\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:28.5926531Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339962-301a-000d-0144-645aef000000", + "x-ms-client-request-id" : "87b301e8-fab4-4c44-af4b-b1e8d33d806f", + "x-ms-file-last-write-time" : "2019-09-05T23:47:28.5926531Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadtofiledoesnotexist894649465/fileapitestsuploadanddownloadtofiledoesnotexist85123d3a0?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b5dcfc73-6dcd-45e0-9930-b18de3e77b62", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B6955A064\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339964-301a-000d-0344-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "x-ms-client-request-id" : "b5dcfc73-6dcd-45e0-9930-b18de3e77b62", + "Content-MD5" : "1tRkiflHQxQzG0ItV6HNAg==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadtofiledoesnotexist894649465/fileapitestsuploadanddownloadtofiledoesnotexist85123d3a0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "341e39b4-4e61-4d9d-8468-a562506e4075" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:28.5926531Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B6955A064\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:28.5926531Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "28", + "x-ms-request-id" : "07339965-301a-000d-0444-645aef000000", + "x-ms-client-request-id" : "341e39b4-4e61-4d9d-8468-a562506e4075", + "x-ms-file-last-write-time" : "2019-09-05T23:47:28.5926531Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadanddownloadtofiledoesnotexist894649465/fileapitestsuploadanddownloadtofiledoesnotexist85123d3a0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1ecc14e1-36ed-47ba-a925-757d1f9aecd8" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:28.5926531Z", + "Content-Range" : "bytes 0-27/28", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:28 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "28", + "x-ms-request-id" : "07339966-301a-000d-0544-645aef000000", + "Body" : "[68, 111, 119, 110, 108, 111, 97, 100, 32, 102, 105, 108, 101, 32, 100, 111, 101, 115, 32, 110, 111, 116, 32, 101, 120, 105, 115, 116]", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:47:28 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B6955A064\"", + "x-ms-file-change-time" : "2019-09-05T23:47:28.5926531Z", + "x-ms-file-parent-id" : "0", + "x-ms-client-request-id" : "1ecc14e1-36ed-47ba-a925-757d1f9aecd8", + "x-ms-file-last-write-time" : "2019-09-05T23:47:28.5926531Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloadtofiledoesnotexist894649465", "fileapitestsuploadanddownloadtofiledoesnotexist85123d3a0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataError.json new file mode 100644 index 000000000000..e152cbbe7be3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataError.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddataerror0757573fe04542d8e4d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c6db4c3d-c95d-4eac-8ec6-cddcde92c734" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B65EF5BC4\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a46f1-c01a-0009-4e44-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:22 GMT", + "x-ms-client-request-id" : "c6db4c3d-c95d-4eac-8ec6-cddcde92c734" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddataerror0757573fe04542d8e4d/fileapitestsuploaddataerror260658a5a7cf290c742?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "46df0289-0e58-4837-b59f-c13969a7262e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "7d4a46f6-c01a-0009-5244-64d7e8000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:7d4a46f6-c01a-0009-5244-64d7e8000000\nTime:2019-09-05T23:47:23.0802765Z", + "Date" : "Thu, 05 Sep 2019 23:47:22 GMT", + "x-ms-client-request-id" : "46df0289-0e58-4837-b59f-c13969a7262e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploaddataerror0757573fe04542d8e4d", "fileapitestsuploaddataerror260658a5a7cf290c742" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataLengthMismatch0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataLengthMismatch0.json new file mode 100644 index 000000000000..5128b846c14a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataLengthMismatch0.json @@ -0,0 +1,68 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddatalengthmismatch0721515615de8aa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d30c624c-8679-4d29-945d-08b1acb75695" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B67B50241\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7d4a4770-c01a-0009-4544-64d7e8000000", + "Date" : "Thu, 05 Sep 2019 23:47:25 GMT", + "x-ms-client-request-id" : "d30c624c-8679-4d29-945d-08b1acb75695" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddatalengthmismatch0721515615de8aa/fileapitestsuploaddatalengthmismatch018244e6d9de974", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8fa15ba0-fe52-4cb1-b02d-eb186bea998b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:26.0695957Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:25 GMT", + "ETag" : "\"0x8D7325B67C69995\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:26.0695957Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "7d4a4775-c01a-0009-4944-64d7e8000000", + "x-ms-client-request-id" : "8fa15ba0-fe52-4cb1-b02d-eb186bea998b", + "x-ms-file-last-write-time" : "2019-09-05T23:47:26.0695957Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddatalengthmismatch0721515615de8aa/fileapitestsuploaddatalengthmismatch018244e6d9de974?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ca72d6ee-d46b-462d-a3ff-a938347ff7e5", + "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." + } + } ], + "variables" : [ "fileapitestsuploaddatalengthmismatch0721515615de8aa", "fileapitestsuploaddatalengthmismatch018244e6d9de974" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataLengthMismatch1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataLengthMismatch1.json new file mode 100644 index 000000000000..c4c17686443d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataLengthMismatch1.json @@ -0,0 +1,68 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddatalengthmismatch18137100660eafe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d6a1d839-687f-4924-8898-f3dc5319accb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B681D63BD\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5f64567e-301a-0040-1144-649503000000", + "Date" : "Thu, 05 Sep 2019 23:47:26 GMT", + "x-ms-client-request-id" : "d6a1d839-687f-4924-8898-f3dc5319accb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddatalengthmismatch18137100660eafe/fileapitestsuploaddatalengthmismatch1562130148667e7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8b9248bb-300b-4c40-8872-e9ffd1269d08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:26.7526066Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:26 GMT", + "ETag" : "\"0x8D7325B682ED1B2\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:26.7526066Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "5f645680-301a-0040-1244-649503000000", + "x-ms-client-request-id" : "8b9248bb-300b-4c40-8872-e9ffd1269d08", + "x-ms-file-last-write-time" : "2019-09-05T23:47:26.7526066Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploaddatalengthmismatch18137100660eafe/fileapitestsuploaddatalengthmismatch1562130148667e7?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ca3e5b03-0ca6-454f-85e1-1114c436ad92", + "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." + } + } ], + "variables" : [ "fileapitestsuploaddatalengthmismatch18137100660eafe", "fileapitestsuploaddatalengthmismatch1562130148667e7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs.json new file mode 100644 index 000000000000..0e88a8d6de64 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs57146d3a6d04a7?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D4609A8C32\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:38:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97febc71-201a-00ed-2ebd-5639f2000000", + "Date" : "Mon, 19 Aug 2019 18:38:06 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs57146d3a6d04a7/fileapitestsuploaddatawithinvalidargs77204babab785a", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D460C7240A\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:38:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97febc74-201a-00ed-2fbd-5639f2000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:38:06 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs57146d3a6d04a7/fileapitestsuploaddatawithinvalidargs77204babab785a?comp=range", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D460DAB0E4\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:38:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97febc75-201a-00ed-30bd-5639f2000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:38:06 GMT", + "Content-MD5" : "elk1fjWyWLIF06S9O2lAwA==" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs57146d3a6d04a7", "fileapitestsuploaddatawithinvalidargs77204babab785a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs0.json new file mode 100644 index 000000000000..2a24223da39e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs0.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs0047190c269f4a?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F57F9DF3\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17e4-901a-011e-44bb-56acce000000", + "Date" : "Mon, 19 Aug 2019 18:27:57 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs0047190c269f4a/fileapitestsuploaddatawithinvalidargs078827dfe49f97", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5A517DF\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17e7-901a-011e-45bb-56acce000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:27:57 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs0047190c269f4a/fileapitestsuploaddatawithinvalidargs078827dfe49f97?comp=range", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5AF7AAC\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17e8-901a-011e-46bb-56acce000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:27:57 GMT", + "Content-MD5" : "elk1fjWyWLIF06S9O2lAwA==" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs0047190c269f4a", "fileapitestsuploaddatawithinvalidargs078827dfe49f97" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs1.json new file mode 100644 index 000000000000..f6254e547514 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs1.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs1649912d3c04ff?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5DA7E43\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17ed-901a-011e-49bb-56acce000000", + "Date" : "Mon, 19 Aug 2019 18:27:58 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs1649912d3c04ff/fileapitestsuploaddatawithinvalidargs18979661b27c94", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5F40EB1\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17ef-901a-011e-4abb-56acce000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:27:58 GMT" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs1649912d3c04ff", "fileapitestsuploaddatawithinvalidargs18979661b27c94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs2.json new file mode 100644 index 000000000000..b7040677138a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs2.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs2013703ba05c2b?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D391BBF830\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:32:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1fb51130-e01a-0133-61bc-562f0e000000", + "Date" : "Mon, 19 Aug 2019 18:32:22 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs2013703ba05c2b/fileapitestsuploaddatawithinvalidargs205558c16bf302", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D393589438\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:32:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1fb51136-e01a-0133-62bc-562f0e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:32:22 GMT" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs2013703ba05c2b", "fileapitestsuploaddatawithinvalidargs205558c16bf302" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs3.json new file mode 100644 index 000000000000..2a3f0251973d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs3.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs36430439b335f3?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724CB6505836C\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:33:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b2cb19d0-201a-0003-2ab4-563371000000", + "Date" : "Mon, 19 Aug 2019 17:33:48 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs36430439b335f3/fileapitestsuploaddatawithinvalidargs305635b423b9e9", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724CB6510C786\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:33:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b2cb19d5-201a-0003-2db4-563371000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 17:33:48 GMT" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs36430439b335f3", "fileapitestsuploaddatawithinvalidargs305635b423b9e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadFileDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadFileDoesNotExist.json new file mode 100644 index 000000000000..b76f2308be30 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadFileDoesNotExist.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileapitestsuploadfiledoesnotexist4264398c6fa4b46?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fba26394-c585-4a09-a48c-e5c72de5985f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B68BB9460\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339950-301a-000d-7344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:27 GMT", + "x-ms-client-request-id" : "fba26394-c585-4a09-a48c-e5c72de5985f" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadfiledoesnotexist4264398c6fa4b46", "fileapitestsuploadfiledoesnotexist498198e78cdb514" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeError.json new file mode 100644 index 000000000000..e41620d9011c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeError.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerror20285047be60d8e3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5bac2f7c-d64f-4b24-a9e1-8ca8e0122014" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8E91F9EE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45536-601a-0000-4a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:30 GMT", + "x-ms-client-request-id" : "5bac2f7c-d64f-4b24-a9e1-8ca8e0122014" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerror20285047be60d8e3/fileasyncapitestsclearrangeerror7462500714795a20", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "041ffb91-f9d7-4a9c-a6fb-b5681ed8b35d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:31.2622838Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:30 GMT", + "ETag" : "\"0x8D7325B8EA236F6\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:31.2622838Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4553c-601a-0000-4f44-64923b000000", + "x-ms-client-request-id" : "041ffb91-f9d7-4a9c-a6fb-b5681ed8b35d", + "x-ms-file-last-write-time" : "2019-09-05T23:48:31.2622838Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerror20285047be60d8e3/fileasyncapitestsclearrangeerror7462500714795a20?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3e8ae890-d466-41dc-9bfb-a88587b4d0ec", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8EB1524C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4553f-601a-0000-5244-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:30 GMT", + "x-ms-client-request-id" : "3e8ae890-d466-41dc-9bfb-a88587b4d0ec", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerror20285047be60d8e3/fileasyncapitestsclearrangeerror7462500714795a20?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "71c5a865-61ed-431d-89fb-61bf8c75797c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "36c45542-601a-0000-5544-64923b000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:36c45542-601a-0000-5544-64923b000000\nTime:2019-09-05T23:48:31.5368689Z", + "Date" : "Thu, 05 Sep 2019 23:48:30 GMT", + "x-ms-client-request-id" : "71c5a865-61ed-431d-89fb-61bf8c75797c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsclearrangeerror20285047be60d8e3", "fileasyncapitestsclearrangeerror7462500714795a20" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeErrorArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeErrorArgs.json new file mode 100644 index 000000000000..52c052f206e0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeErrorArgs.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerrorargs66165fb70f21f9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ad57a3f3-7445-470f-9189-1bb9f140cfea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8EF4DA76\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4554f-601a-0000-6244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:31 GMT", + "x-ms-client-request-id" : "ad57a3f3-7445-470f-9189-1bb9f140cfea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerrorargs66165fb70f21f9/fileasyncapitestsclearrangeerrorargs790207d554d952", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e680191c-062c-42c2-931d-eba4886fd15f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:31.9123044Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:31 GMT", + "ETag" : "\"0x8D7325B8F056664\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:31.9123044Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45552-601a-0000-6444-64923b000000", + "x-ms-client-request-id" : "e680191c-062c-42c2-931d-eba4886fd15f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:31.9123044Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerrorargs66165fb70f21f9/fileasyncapitestsclearrangeerrorargs790207d554d952?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "711a00c6-b0f1-42be-9d0c-9db967c59c7e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8F13974A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45555-601a-0000-6744-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:31 GMT", + "x-ms-client-request-id" : "711a00c6-b0f1-42be-9d0c-9db967c59c7e", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsclearrangeerrorargs66165fb70f21f9/fileasyncapitestsclearrangeerrorargs790207d554d952?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "514592ab-4ac3-4264-a910-2f03cf241551" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "36c45558-601a-0000-6a44-64923b000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:36c45558-601a-0000-6a44-64923b000000\nTime:2019-09-05T23:48:32.1078701Z", + "Date" : "Thu, 05 Sep 2019 23:48:31 GMT", + "x-ms-client-request-id" : "514592ab-4ac3-4264-a910-2f03cf241551", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsclearrangeerrorargs66165fb70f21f9", "fileasyncapitestsclearrangeerrorargs790207d554d952" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFile.json new file mode 100644 index 000000000000..9ce8a744b181 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFile.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefile75877d2c713895f0f4b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "974b37f6-d795-4482-a0c8-0c3b1c0d2d07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8AB28E02\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d0f-301a-000d-7b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:24 GMT", + "x-ms-client-request-id" : "974b37f6-d795-4482-a0c8-0c3b1c0d2d07" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefile75877d2c713895f0f4b", "fileasyncapitestscreatefile416056d1cc69921f64e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileError.json new file mode 100644 index 000000000000..d8b0a1625d18 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefileerror91760fa6c309b82e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "135a2ccb-70e3-4192-8f72-74e457888d30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8ADF91E6\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d16-301a-000d-7f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:24 GMT", + "x-ms-client-request-id" : "135a2ccb-70e3-4192-8f72-74e457888d30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefileerror91760fa6c309b82e/fileasyncapitestscreatefileerror685429d3e4381a67", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "73e8d29b-3b4c-43c3-a48a-73e206f0946f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "07339d18-301a-000d-8044-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:07339d18-301a-000d-8044-645aef000000\nTime:2019-09-05T23:48:25.0544863Z", + "Date" : "Thu, 05 Sep 2019 23:48:24 GMT", + "x-ms-client-request-id" : "73e8d29b-3b4c-43c3-a48a-73e206f0946f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefileerror91760fa6c309b82e", "fileasyncapitestscreatefileerror685429d3e4381a67" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFilePermissionAndKeyError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFilePermissionAndKeyError0.json new file mode 100644 index 000000000000..8be3b1f2c02f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFilePermissionAndKeyError0.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilepermissionandkeyerror092422d58?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D76A1E611DE\"", + "Last-Modified" : "Fri, 30 Aug 2019 18:19:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8ad2ca5b-801a-0037-725f-5f4097000000", + "Date" : "Fri, 30 Aug 2019 18:19:43 GMT", + "x-ms-client-request-id" : "f56f3ef2-69de-4e60-b2fc-45ddaf03b497" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilepermissionandkeyerror092422d58", "fileasyncapitestscreatefilepermissionandkeyerror08968557d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFilePermissionAndKeyError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFilePermissionAndKeyError1.json new file mode 100644 index 000000000000..97dcaa698afe --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFilePermissionAndKeyError1.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilepermissionandkeyerror183269f41?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D76A237791B\"", + "Last-Modified" : "Fri, 30 Aug 2019 18:19:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8ad2ca60-801a-0037-755f-5f4097000000", + "Date" : "Fri, 30 Aug 2019 18:19:44 GMT", + "x-ms-client-request-id" : "c03829e2-b889-4678-ae1c-213ebf40d5aa" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilepermissionandkeyerror183269f41", "fileasyncapitestscreatefilepermissionandkeyerror104449756" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgs.json new file mode 100644 index 000000000000..a883d7b8a38f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgs.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargs188749f3bafd521?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1a5b1b26-3402-4cf8-a105-cafc299c24e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D730D967C0121B\"", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e7c18bc4-101a-0044-76c2-62ec1a000000", + "Date" : "Wed, 04 Sep 2019 01:44:20 GMT", + "x-ms-client-request-id" : "1a5b1b26-3402-4cf8-a105-cafc299c24e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargs188749f3bafd521/fileasyncapitestscreatefilewithargs080604cb74d9fa5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bfa5dbb7-7e8c-40a6-9f0e-260f5d761370" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-04T01:44:20.3347099Z", + "Last-Modified" : "Wed, 04 Sep 2019 01:44:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 04 Sep 2019 01:44:20 GMT", + "ETag" : "\"0x8D730D967C7049B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-04T01:44:20.3347099Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "e7c18bc6-101a-0044-77c2-62ec1a000000", + "x-ms-client-request-id" : "bfa5dbb7-7e8c-40a6-9f0e-260f5d761370", + "x-ms-file-last-write-time" : "2019-09-04T01:44:20.3347099Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargs188749f3bafd521", "fileasyncapitestscreatefilewithargs080604cb74d9fa5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError0.json new file mode 100644 index 000000000000..f6b07f075540 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError0.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargserror00916482feaeb?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6937cff9-849d-469b-92c0-af56724b0fe8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8B9C7939\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d29-301a-000d-0f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:25 GMT", + "x-ms-client-request-id" : "6937cff9-849d-469b-92c0-af56724b0fe8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargserror00916482feaeb/fileasyncapitestscreatefilewithargserror000971fc4580e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6681e48f-805c-4585-b519-047a26b50cc9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "07339d2c-301a-000d-1144-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:07339d2c-301a-000d-1144-645aef000000\nTime:2019-09-05T23:48:26.2825031Z", + "Date" : "Thu, 05 Sep 2019 23:48:25 GMT", + "x-ms-client-request-id" : "6681e48f-805c-4585-b519-047a26b50cc9", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargserror00916482feaeb", "fileasyncapitestscreatefilewithargserror000971fc4580e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError1.json new file mode 100644 index 000000000000..b4a6be711aac --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError1.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargserror1711601ce812e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1fd77cdf-c993-4183-bf98-9827e2b8fc96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8BD319D9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d2f-301a-000d-1444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:25 GMT", + "x-ms-client-request-id" : "1fd77cdf-c993-4183-bf98-9827e2b8fc96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargserror1711601ce812e/fileasyncapitestscreatefilewithargserror10218680d5cd4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3fbc2f45-0e75-4a05-9a21-545eab341063" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "973", + "StatusCode" : "403", + "x-ms-request-id" : "07339d31-301a-000d-1544-645aef000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:07339d31-301a-000d-1544-645aef000000\nTime:2019-09-05T23:48:26.6395010ZThe MAC signature found in the HTTP request 'ZEAECUEBpWwJ8CsMcKmiXX+XasmxDV3dNXusdXwasqM=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 05 Sep 2019 23:48:26 GMT\n\n\n\n\n\nx-ms-client-request-id:3fbc2f45-0e75-4a05-9a21-545eab341063\nx-ms-content-length:1024\nx-ms-file-attributes:None\nx-ms-file-creation-time:Now\nx-ms-file-last-write-time:Now\nx-ms-file-permission:Inherit\nx-ms-meta-testmeta:value\nx-ms-type:file\nx-ms-version:2019-02-02\n/gapradev/fileasyncapitestscreatefilewithargserror1711601ce812e/fileasyncapitestscreatefilewithargserror10218680d5cd4'.", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargserror1711601ce812e", "fileasyncapitestscreatefilewithargserror10218680d5cd4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsFp.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsFp.json new file mode 100644 index 000000000000..4b22098bd8af --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsFp.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargsfp58928b5d83c5c1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "87a5268a-c0ff-408d-900f-67837e4c2865" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8B616C2B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d24-301a-000d-0b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:25 GMT", + "x-ms-client-request-id" : "87a5268a-c0ff-408d-900f-67837e4c2865" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargsfp58928b5d83c5c1/fileasyncapitestscreatefilewithargsfp00048adb842343", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fb116547-592c-4aab-94e4-66ea24d395c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:25.8620000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:25 GMT", + "ETag" : "\"0x8D7325B8B6A3260\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:25.8620000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339d26-301a-000d-0c44-645aef000000", + "x-ms-client-request-id" : "fb116547-592c-4aab-94e4-66ea24d395c5", + "x-ms-file-last-write-time" : "2019-09-05T23:48:25.8620000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargsfp58928b5d83c5c1", "fileasyncapitestscreatefilewithargsfp00048adb842343", "2019-09-05T23:48:25.862Z", "2019-09-05T23:48:25.862Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsFpk.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsFpk.json new file mode 100644 index 000000000000..33ac7a8afe5e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsFpk.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargsfpk4741555befbfa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "864cf171-fe24-45f6-9e1e-2bd940f44450" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8B1743CE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d1d-301a-000d-0544-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:24 GMT", + "x-ms-client-request-id" : "864cf171-fe24-45f6-9e1e-2bd940f44450" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargsfpk4741555befbfa?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0f4f96db-70ce-47d1-a619-379cda396719", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d1f-301a-000d-0644-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:24 GMT", + "x-ms-client-request-id" : "0f4f96db-70ce-47d1-a619-379cda396719" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestscreatefilewithargsfpk4741555befbfa/fileasyncapitestscreatefilewithargsfpk10597ae877775", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5eecc71b-7aac-4966-ad19-f7fd39f801a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:25.4720000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:24 GMT", + "ETag" : "\"0x8D7325B8B2EB000\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:25.4720000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339d20-301a-000d-0744-645aef000000", + "x-ms-client-request-id" : "5eecc71b-7aac-4966-ad19-f7fd39f801a5", + "x-ms-file-last-write-time" : "2019-09-05T23:48:25.4720000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargsfpk4741555befbfa", "fileasyncapitestscreatefilewithargsfpk10597ae877775", "2019-09-05T23:48:25.472Z", "2019-09-05T23:48:25.472Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFile.json new file mode 100644 index 000000000000..2e769d95c4ed --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFile.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdeletefile87278ef2df829702d4f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "de44f149-16af-4598-a142-ddcd71aecbe0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B91590A9A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c455dc-601a-0000-6444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:35 GMT", + "x-ms-client-request-id" : "de44f149-16af-4598-a142-ddcd71aecbe0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdeletefile87278ef2df829702d4f/fileasyncapitestsdeletefile5314302f115c5aac443", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0473a60d-e3b2-4835-bd11-4a346bd60ca9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:35.9154053Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:35 GMT", + "ETag" : "\"0x8D7325B91683985\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:35.9154053Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c455e4-601a-0000-6a44-64923b000000", + "x-ms-client-request-id" : "0473a60d-e3b2-4835-bd11-4a346bd60ca9", + "x-ms-file-last-write-time" : "2019-09-05T23:48:35.9154053Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdeletefile87278ef2df829702d4f/fileasyncapitestsdeletefile5314302f115c5aac443", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b6248cc2-3402-4830-b116-99d75d84b1b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c455e8-601a-0000-6d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:35 GMT", + "x-ms-client-request-id" : "b6248cc2-3402-4830-b116-99d75d84b1b8" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsdeletefile87278ef2df829702d4f", "fileasyncapitestsdeletefile5314302f115c5aac443" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFileError.json new file mode 100644 index 000000000000..3852fe25e354 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFileError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdeletefileerror90787aa20b9cf319?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d1a80e8a-bcfc-4d95-a772-9120fec6e923" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B91A24882\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c455f3-601a-0000-7844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:35 GMT", + "x-ms-client-request-id" : "d1a80e8a-bcfc-4d95-a772-9120fec6e923" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdeletefileerror90787aa20b9cf319/fileasyncapitestsdeletefileerror04398d00d227707c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e12ea9d4-5f70-4156-ae1b-17e4f9ad71c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c455fa-601a-0000-7e44-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c455fa-601a-0000-7e44-64923b000000\nTime:2019-09-05T23:48:36.3978993Z", + "Date" : "Thu, 05 Sep 2019 23:48:35 GMT", + "x-ms-client-request-id" : "e12ea9d4-5f70-4156-ae1b-17e4f9ad71c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsdeletefileerror90787aa20b9cf319", "fileasyncapitestsdeletefileerror04398d00d227707c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDownloadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDownloadDataError.json new file mode 100644 index 000000000000..e67ef6ca6d62 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDownloadDataError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdownloaddataerror39041a7fffc505e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5cc15621-7617-495d-be81-656a54ec2ab1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8DC72F9A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c454fe-601a-0000-1744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:29 GMT", + "x-ms-client-request-id" : "5cc15621-7617-495d-be81-656a54ec2ab1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsdownloaddataerror39041a7fffc505e/fileasyncapitestsdownloaddataerror59176aa0be0484e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1f66b336-0a7d-4cb0-be76-c4e25001d9eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c45500-601a-0000-1844-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c45500-601a-0000-1844-64923b000000\nTime:2019-09-05T23:48:29.9268506Z", + "Date" : "Thu, 05 Sep 2019 23:48:29 GMT", + "x-ms-client-request-id" : "1f66b336-0a7d-4cb0-be76-c4e25001d9eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsdownloaddataerror39041a7fffc505e", "fileasyncapitestsdownloaddataerror59176aa0be0484e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetFileURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetFileURL.json new file mode 100644 index 000000000000..d18e45b6fb87 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetFileURL.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsgetfileurl81506d885ba9e991941?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f2ff769f-2915-4d9f-8bd5-50361dd687cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8A878656\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d0a-301a-000d-7744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:23 GMT", + "x-ms-client-request-id" : "f2ff769f-2915-4d9f-8bd5-50361dd687cf" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetfileurl81506d885ba9e991941", "fileasyncapitestsgetfileurl7841295a20624f23a46" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetProperties.json new file mode 100644 index 000000000000..fedbf54f3e02 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetProperties.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsgetproperties36975ae3a34f502ef?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "17ba3fe8-9e5a-475f-9a7e-4138f6da79b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B91DBA816\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45606-601a-0000-0a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:35 GMT", + "x-ms-client-request-id" : "17ba3fe8-9e5a-475f-9a7e-4138f6da79b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsgetproperties36975ae3a34f502ef/fileasyncapitestsgetproperties42243a816fbac4bcf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c81964db-6f14-42f3-bb33-8d84ccbf2530" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:36.7764257Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:36 GMT", + "ETag" : "\"0x8D7325B91EB9B21\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:36.7764257Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4560b-601a-0000-0e44-64923b000000", + "x-ms-client-request-id" : "c81964db-6f14-42f3-bb33-8d84ccbf2530", + "x-ms-file-last-write-time" : "2019-09-05T23:48:36.7764257Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetproperties36975ae3a34f502ef", "fileasyncapitestsgetproperties42243a816fbac4bcf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..e0baa0907bcb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetPropertiesError.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsgetpropertieserror21271a7f7fe1067?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3d234a09-5768-4f44-a0d1-981838a375e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9218FF4C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45617-601a-0000-1a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:36 GMT", + "x-ms-client-request-id" : "3d234a09-5768-4f44-a0d1-981838a375e8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsgetpropertieserror21271a7f7fe1067/fileasyncapitestsgetpropertieserror0711530ee26365e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c6952513-6ff9-44d7-9b0e-b0dae2a6bcc3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "36c4561b-601a-0000-1d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:36 GMT", + "x-ms-client-request-id" : "c6952513-6ff9-44d7-9b0e-b0dae2a6bcc3" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetpropertieserror21271a7f7fe1067", "fileasyncapitestsgetpropertieserror0711530ee26365e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..eb00d4fad07c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetSnapshotId.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsgetsnapshotid61611d2a99783740e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f5693be7-6f46-48e0-b232-07653e69654f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B956FCD65\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4571d-601a-0000-1244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "x-ms-client-request-id" : "f5693be7-6f46-48e0-b232-07653e69654f" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetsnapshotid61611d2a99783740e", "fileasyncapitestsgetsnapshotid08393278657d78d4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandles.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandles.json new file mode 100644 index 000000000000..b95a3d5668d2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandles.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslisthandles58373bd6a662c8b454?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "aea441d0-d6fe-42ea-8b81-d2afb1904f25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B94E259FA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c456fd-601a-0000-7444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "x-ms-client-request-id" : "aea441d0-d6fe-42ea-8b81-d2afb1904f25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslisthandles58373bd6a662c8b454/fileasyncapitestslisthandles88186afdd6dd8e1084", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bed519c8-7900-4094-96b4-80e545729f7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:41.8575610Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "ETag" : "\"0x8D7325B94F2ECFA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:41.8575610Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45702-601a-0000-7844-64923b000000", + "x-ms-client-request-id" : "bed519c8-7900-4094-96b4-80e545729f7c", + "x-ms-file-last-write-time" : "2019-09-05T23:48:41.8575610Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslisthandles58373bd6a662c8b454/fileasyncapitestslisthandles88186afdd6dd8e1084?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bc3a28e0-65dc-4a6b-9328-252ba0ce0e0e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45705-601a-0000-7b44-64923b000000", + "Body" : "", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "x-ms-client-request-id" : "bc3a28e0-65dc-4a6b-9328-252ba0ce0e0e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslisthandles58373bd6a662c8b454", "fileasyncapitestslisthandles88186afdd6dd8e1084" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandlesWithMaxResult.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandlesWithMaxResult.json new file mode 100644 index 000000000000..080a2fb24356 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandlesWithMaxResult.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslisthandleswithmaxresult93830b224087?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a487a02c-5a5c-4de9-99b2-f12dfb8c7c91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B95294E2D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4570d-601a-0000-0344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "x-ms-client-request-id" : "a487a02c-5a5c-4de9-99b2-f12dfb8c7c91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslisthandleswithmaxresult93830b224087/fileasyncapitestslisthandleswithmaxresult46513646a112", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "63f2f233-daa2-4795-be15-d3cd5e9175cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:42.3165746Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "ETag" : "\"0x8D7325B9538F732\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:42.3165746Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45712-601a-0000-0744-64923b000000", + "x-ms-client-request-id" : "63f2f233-daa2-4795-be15-d3cd5e9175cb", + "x-ms-file-last-write-time" : "2019-09-05T23:48:42.3165746Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslisthandleswithmaxresult93830b224087/fileasyncapitestslisthandleswithmaxresult46513646a112?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9ae68202-7c69-405c-bf63-a8c432140f08" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45714-601a-0000-0944-64923b000000", + "Body" : "2", + "Date" : "Thu, 05 Sep 2019 23:48:41 GMT", + "x-ms-client-request-id" : "9ae68202-7c69-405c-bf63-a8c432140f08", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslisthandleswithmaxresult93830b224087", "fileasyncapitestslisthandleswithmaxresult46513646a112" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRanges.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRanges.json new file mode 100644 index 000000000000..1a78341b4c9f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRanges.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistranges20771a2ae9a0daaef42?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cf547b85-e410-475b-ae1f-24958391e287" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B94324393\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c456c8-601a-0000-4244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:39 GMT", + "x-ms-client-request-id" : "cf547b85-e410-475b-ae1f-24958391e287" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistranges20771a2ae9a0daaef42/fileasyncapitestslistranges74446986562d57c0a49", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c08d4015-04fd-4402-8bf4-cb7e73299c06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:40.7005304Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:39 GMT", + "ETag" : "\"0x8D7325B94426078\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:40.7005304Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c456cd-601a-0000-4644-64923b000000", + "x-ms-client-request-id" : "c08d4015-04fd-4402-8bf4-cb7e73299c06", + "x-ms-file-last-write-time" : "2019-09-05T23:48:40.7005304Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistranges20771a2ae9a0daaef42/fileasyncapitestslistranges74446986562d57c0a49?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ab5b9b78-f271-47f4-b8f4-dc7888afcab9", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B94535081\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c456d2-601a-0000-4b44-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:40 GMT", + "x-ms-client-request-id" : "ab5b9b78-f271-47f4-b8f4-dc7888afcab9", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistranges20771a2ae9a0daaef42/fileasyncapitestslistranges74446986562d57c0a49?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3e20ec83-b388-4373-a595-ceb535c1b220" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:40 GMT", + "ETag" : "\"0x8D7325B94535081\"", + "x-ms-request-id" : "36c456d5-601a-0000-4e44-64923b000000", + "Body" : "01023", + "x-ms-client-request-id" : "3e20ec83-b388-4373-a595-ceb535c1b220", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslistranges20771a2ae9a0daaef42", "fileasyncapitestslistranges74446986562d57c0a49", "filefileasyncapitestslistranges9549558720f47d814b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRangesWithRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRangesWithRange.json new file mode 100644 index 000000000000..9004013db77e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRangesWithRange.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistrangeswithrange144787c563a08b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2bb01626-92af-4c05-92d5-5f2986cb7962" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B948A27C2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c456e0-601a-0000-5844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:40 GMT", + "x-ms-client-request-id" : "2bb01626-92af-4c05-92d5-5f2986cb7962" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistrangeswithrange144787c563a08b/fileasyncapitestslistrangeswithrange570424f275d758", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "16f34545-592e-4f8d-b49e-b316785c225a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:41.2805444Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:40 GMT", + "ETag" : "\"0x8D7325B949AE144\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:41.2805444Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c456e5-601a-0000-5c44-64923b000000", + "x-ms-client-request-id" : "16f34545-592e-4f8d-b49e-b316785c225a", + "x-ms-file-last-write-time" : "2019-09-05T23:48:41.2805444Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistrangeswithrange144787c563a08b/fileasyncapitestslistrangeswithrange570424f275d758?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0478feca-7859-4649-bca0-4009cce47ae2", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B94A9D5B0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c456ef-601a-0000-6644-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:40 GMT", + "x-ms-client-request-id" : "0478feca-7859-4649-bca0-4009cce47ae2", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestslistrangeswithrange144787c563a08b/fileasyncapitestslistrangeswithrange570424f275d758?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6380e5be-0fe6-43b7-a490-fd385594a1f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:40 GMT", + "ETag" : "\"0x8D7325B94A9D5B0\"", + "x-ms-request-id" : "36c456f1-601a-0000-6844-64923b000000", + "Body" : "0511", + "x-ms-client-request-id" : "6380e5be-0fe6-43b7-a490-fd385594a1f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslistrangeswithrange144787c563a08b", "fileasyncapitestslistrangeswithrange570424f275d758", "filefileasyncapitestslistrangeswithrange4317397484cd97" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeaders.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeaders.json new file mode 100644 index 000000000000..7a7a9946c796 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeaders.json @@ -0,0 +1,60 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaders467121549c0a0e13c?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EC38D19D4\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:52:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "249cbc1a-e01a-005a-5677-5736f7000000", + "Date" : "Tue, 20 Aug 2019 16:52:19 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaders467121549c0a0e13c/fileasyncapitestssethttpheaders35140873ebe2bc4bd", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EC392E9A5\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:52:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "249cbc1d-e01a-005a-5777-5736f7000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:52:19 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaders467121549c0a0e13c/fileasyncapitestssethttpheaders35140873ebe2bc4bd?comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EC39A8CA8\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:52:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "249cbc1e-e01a-005a-5877-5736f7000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:52:19 GMT" + } + } ], + "variables" : [ "fileasyncapitestssethttpheaders467121549c0a0e13c", "fileasyncapitestssethttpheaders35140873ebe2bc4bd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersError.json new file mode 100644 index 000000000000..201a86df6bd1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheaderserror0817903b9b4386?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2baad85b-e500-414a-8c7e-a516e0e319aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B92F507D0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45665-601a-0000-6444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:37 GMT", + "x-ms-client-request-id" : "2baad85b-e500-414a-8c7e-a516e0e319aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheaderserror0817903b9b4386/fileasyncapitestssethttpheaderserror45208844b58504", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "940081bf-24c7-4c93-b92c-127a7791bd63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:38.6334760Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:37 GMT", + "ETag" : "\"0x8D7325B9306F828\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:38.6334760Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4566d-601a-0000-6b44-64923b000000", + "x-ms-client-request-id" : "940081bf-24c7-4c93-b92c-127a7791bd63", + "x-ms-file-last-write-time" : "2019-09-05T23:48:38.6334760Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheaderserror0817903b9b4386/fileasyncapitestssethttpheaderserror45208844b58504?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "424bd051-fa7d-4f32-b026-bae8697d1968" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "36c45672-601a-0000-7044-64923b000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:36c45672-601a-0000-7044-64923b000000\nTime:2019-09-05T23:48:38.7409147Z", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "x-ms-client-request-id" : "424bd051-fa7d-4f32-b026-bae8697d1968", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssethttpheaderserror0817903b9b4386", "fileasyncapitestssethttpheaderserror45208844b58504" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersFp.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersFp.json new file mode 100644 index 000000000000..d96fb1b5a5eb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersFp.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfp330118fee55f95ac?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6033f97c-8f21-4be2-a713-1249fae4f24a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B92AB2D5B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4564b-601a-0000-4b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:37 GMT", + "x-ms-client-request-id" : "6033f97c-8f21-4be2-a713-1249fae4f24a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfp330118fee55f95ac/fileasyncapitestssethttpheadersfp7190300d5ecc4525", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6fb02161-f303-4283-b47b-1aa7aad4ca2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:38.1364639Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:37 GMT", + "ETag" : "\"0x8D7325B92BB219F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:38.1364639Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45650-601a-0000-4f44-64923b000000", + "x-ms-client-request-id" : "6fb02161-f303-4283-b47b-1aa7aad4ca2f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:38.1364639Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfp330118fee55f95ac/fileasyncapitestssethttpheadersfp7190300d5ecc4525?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "577d54db-8cb8-4c64-8792-90622fa1801c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:38.1920000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:37 GMT", + "ETag" : "\"0x8D7325B92CB0039\"", + "x-ms-file-attributes" : "None", + "x-ms-file-change-time" : "2019-09-05T23:48:38.2404665Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45655-601a-0000-5444-64923b000000", + "x-ms-client-request-id" : "577d54db-8cb8-4c64-8792-90622fa1801c", + "x-ms-file-last-write-time" : "2019-09-05T23:48:38.1920000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssethttpheadersfp330118fee55f95ac", "fileasyncapitestssethttpheadersfp7190300d5ecc4525", "2019-09-05T23:48:38.192Z", "2019-09-05T23:48:38.192Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersFpk.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersFpk.json new file mode 100644 index 000000000000..8becb2c891a3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersFpk.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfpk1522827210e32eb?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "40ade64a-f50e-4b87-b89c-30ee5d9cf197" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B92508A2A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45626-601a-0000-2844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:36 GMT", + "x-ms-client-request-id" : "40ade64a-f50e-4b87-b89c-30ee5d9cf197" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfpk1522827210e32eb/fileasyncapitestssethttpheadersfpk7271928042b108c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "240a4f3b-e33d-4bb8-82b9-4d3b4d9f3154" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:37.5404490Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:36 GMT", + "ETag" : "\"0x8D7325B92602FCA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:37.5404490Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4562f-601a-0000-3044-64923b000000", + "x-ms-client-request-id" : "240a4f3b-e33d-4bb8-82b9-4d3b4d9f3154", + "x-ms-file-last-write-time" : "2019-09-05T23:48:37.5404490Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfpk1522827210e32eb?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f9d93fa5-0cf8-4f46-b4f9-3b2137b92e4b", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45633-601a-0000-3444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:36 GMT", + "x-ms-client-request-id" : "f9d93fa5-0cf8-4f46-b4f9-3b2137b92e4b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssethttpheadersfpk1522827210e32eb/fileasyncapitestssethttpheadersfpk7271928042b108c?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "098119d4-40b4-4eef-9df0-ecfa7554a105" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:37.6910000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:37 GMT", + "ETag" : "\"0x8D7325B927DF152\"", + "x-ms-file-attributes" : "None", + "x-ms-file-change-time" : "2019-09-05T23:48:37.7354578Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4563c-601a-0000-3c44-64923b000000", + "x-ms-client-request-id" : "098119d4-40b4-4eef-9df0-ecfa7554a105", + "x-ms-file-last-write-time" : "2019-09-05T23:48:37.6920000Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssethttpheadersfpk1522827210e32eb", "fileasyncapitestssethttpheadersfpk7271928042b108c", "2019-09-05T23:48:37.691Z", "2019-09-05T23:48:37.692Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadata.json new file mode 100644 index 000000000000..ed044b7b241d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadata.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadata84216da6199ea4e9d4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "92f65514-ba70-4133-9948-5025b5232796" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B933FCCEC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4567d-601a-0000-7b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "x-ms-client-request-id" : "92f65514-ba70-4133-9948-5025b5232796" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadata84216da6199ea4e9d4/fileasyncapitestssetmetadata64320b9216d8c34834", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5b6a6632-ab37-41ed-9dc6-60e14d4b51cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:39.1134892Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "ETag" : "\"0x8D7325B935036AC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:39.1134892Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45685-601a-0000-0244-64923b000000", + "x-ms-client-request-id" : "5b6a6632-ab37-41ed-9dc6-60e14d4b51cf", + "x-ms-file-last-write-time" : "2019-09-05T23:48:39.1134892Z" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadata84216da6199ea4e9d4/fileasyncapitestssetmetadata64320b9216d8c34834", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a92a9ee2-7424-4e14-822f-64c995963f4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:39.1134892Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B935036AC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-09-05T23:48:39.1134892Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "36c4568b-601a-0000-0844-64923b000000", + "x-ms-client-request-id" : "a92a9ee2-7424-4e14-822f-64c995963f4e", + "x-ms-file-last-write-time" : "2019-09-05T23:48:39.1134892Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadata84216da6199ea4e9d4/fileasyncapitestssetmetadata64320b9216d8c34834?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "42039d6a-1385-4bfb-bc28-cb259c8f4a9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B936CBFA8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45690-601a-0000-0d44-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "x-ms-client-request-id" : "42039d6a-1385-4bfb-bc28-cb259c8f4a9d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadata84216da6199ea4e9d4/fileasyncapitestssetmetadata64320b9216d8c34834", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4bbec249-f303-4ff4-9286-ace3fc971fe1" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:39.1134892Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B936CBFA8\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:39.3004968Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "36c45694-601a-0000-1144-64923b000000", + "x-ms-client-request-id" : "4bbec249-f303-4ff4-9286-ace3fc971fe1", + "x-ms-file-last-write-time" : "2019-09-05T23:48:39.1134892Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssetmetadata84216da6199ea4e9d4", "fileasyncapitestssetmetadata64320b9216d8c34834" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadataError.json new file mode 100644 index 000000000000..9dd428a12223 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadataError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadataerror72607b5b96dd1f8f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e724aa3f-3e48-41fe-96dd-72b382988cbc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B93A40D0A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c456a3-601a-0000-2044-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:38 GMT", + "x-ms-client-request-id" : "e724aa3f-3e48-41fe-96dd-72b382988cbc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadataerror72607b5b96dd1f8f/fileasyncapitestssetmetadataerror0343902611cdb108", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f2608029-a656-4daf-ab8a-0051d1e666ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:39.7705072Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:39 GMT", + "ETag" : "\"0x8D7325B93B47770\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:39.7705072Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c456ab-601a-0000-2644-64923b000000", + "x-ms-client-request-id" : "f2608029-a656-4daf-ab8a-0051d1e666ff", + "x-ms-file-last-write-time" : "2019-09-05T23:48:39.7705072Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestssetmetadataerror72607b5b96dd1f8f/fileasyncapitestssetmetadataerror0343902611cdb108?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8af82d36-51fe-445b-a5f7-7011dc371a4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c456b0-601a-0000-2b44-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c456b0-601a-0000-2b44-64923b000000\nTime:2019-09-05T23:48:40.3279297Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:39 GMT", + "x-ms-client-request-id" : "8af82d36-51fe-445b-a5f7-7011dc371a4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssetmetadataerror72607b5b96dd1f8f", "fileasyncapitestssetmetadataerror0343902611cdb108" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopy.json new file mode 100644 index 000000000000..3f5155dd77f4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopy.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsstartcopy57082e03ebd98ee8e45?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0f50659b-d4bd-4d19-8d63-61571a1bc8a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B90298A85\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c455a0-601a-0000-2e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:33 GMT", + "x-ms-client-request-id" : "0f50659b-d4bd-4d19-8d63-61571a1bc8a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsstartcopy57082e03ebd98ee8e45/fileasyncapitestsstartcopy099130d84e68aa88b4d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "25862d43-e2f4-4b46-b2d7-62590fb97110" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:33.9333528Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:33 GMT", + "ETag" : "\"0x8D7325B9039C998\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:33.9333528Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c455a3-601a-0000-3044-64923b000000", + "x-ms-client-request-id" : "25862d43-e2f4-4b46-b2d7-62590fb97110", + "x-ms-file-last-write-time" : "2019-09-05T23:48:33.9333528Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsstartcopy57082e03ebd98ee8e45/fileasyncapitestsstartcopy099130d84e68aa88b4d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3dff7c21-ac07-4055-a3c7-660541508f51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "576692fc-2218-43f5-a96e-c3a4d8c249d3", + "ETag" : "\"0x8D7325B90D9B447\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "36c455a6-601a-0000-3344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:34 GMT", + "x-ms-client-request-id" : "3dff7c21-ac07-4055-a3c7-660541508f51" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsstartcopy57082e03ebd98ee8e45", "fileasyncapitestsstartcopy099130d84e68aa88b4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopyError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopyError.json new file mode 100644 index 000000000000..53e0d8384c7c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopyError.json @@ -0,0 +1,76 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsstartcopyerror44968dce25d45e1aa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "213fe29e-bc91-4f8d-9094-d90ddbfc21a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9106085B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c455cb-601a-0000-5644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:34 GMT", + "x-ms-client-request-id" : "213fe29e-bc91-4f8d-9094-d90ddbfc21a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsstartcopyerror44968dce25d45e1aa/fileasyncapitestsstartcopyerror86984f61673fd77bf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5b3ef793-ddeb-4987-9674-6ddc1ee515f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:35.3813904Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:34 GMT", + "ETag" : "\"0x8D7325B9116BD90\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:35.3813904Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c455ce-601a-0000-5844-64923b000000", + "x-ms-client-request-id" : "5b3ef793-ddeb-4987-9674-6ddc1ee515f0", + "x-ms-file-last-write-time" : "2019-09-05T23:48:35.3813904Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsstartcopyerror44968dce25d45e1aa/fileasyncapitestsstartcopyerror86984f61673fd77bf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5253b1a2-6503-40af-9d18-7dd6b70efef0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "330", + "StatusCode" : "400", + "x-ms-request-id" : "36c455d1-601a-0000-5b44-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c455d1-601a-0000-5b44-64923b000000\nTime:2019-09-05T23:48:35.5428899Zx-ms-copy-sourcesome url", + "Date" : "Thu, 05 Sep 2019 23:48:34 GMT", + "x-ms-client-request-id" : "5253b1a2-6503-40af-9d18-7dd6b70efef0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsstartcopyerror44968dce25d45e1aa", "fileasyncapitestsstartcopyerror86984f61673fd77bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRange.json new file mode 100644 index 000000000000..8555a9b82570 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRange.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadandclearrange79829846608003?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "37271663-1e38-4c54-9528-48bddd9d26eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8DFDA8CA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4550d-601a-0000-2444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:29 GMT", + "x-ms-client-request-id" : "37271663-1e38-4c54-9528-48bddd9d26eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadandclearrange79829846608003/fileasyncapitestsuploadandclearrange6544005ff6308b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d8a1c94e-e08d-44b4-b186-2e9da1d0c4c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:30.2922581Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:29 GMT", + "ETag" : "\"0x8D7325B8E0E3355\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:30.2922581Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45512-601a-0000-2744-64923b000000", + "x-ms-client-request-id" : "d8a1c94e-e08d-44b4-b186-2e9da1d0c4c3", + "x-ms-file-last-write-time" : "2019-09-05T23:48:30.2922581Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadandclearrange79829846608003/fileasyncapitestsuploadandclearrange6544005ff6308b?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "44069f15-d6d8-438f-9023-1f4fd8f95550", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8E1D0087\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45516-601a-0000-2b44-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:29 GMT", + "x-ms-client-request-id" : "44069f15-d6d8-438f-9023-1f4fd8f95550", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadandclearrange79829846608003", "fileasyncapitestsuploadandclearrange6544005ff6308b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRangeWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRangeWithArgs.json new file mode 100644 index 000000000000..d95237905489 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRangeWithArgs.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadandclearrangewithargs3282284012?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "24a0e1c4-1b9a-4a7f-909e-fcbb4e3b460c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8E481F60\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45523-601a-0000-3844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:29 GMT", + "x-ms-client-request-id" : "24a0e1c4-1b9a-4a7f-909e-fcbb4e3b460c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadandclearrangewithargs3282284012/fileasyncapitestsuploadandclearrangewithargs3258365067", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ae2e5feb-b773-4e21-a5e1-d069e5c31095" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:30.7772754Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:30 GMT", + "ETag" : "\"0x8D7325B8E583552\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:30.7772754Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45526-601a-0000-3a44-64923b000000", + "x-ms-client-request-id" : "ae2e5feb-b773-4e21-a5e1-d069e5c31095", + "x-ms-file-last-write-time" : "2019-09-05T23:48:30.7772754Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadandclearrangewithargs3282284012/fileasyncapitestsuploadandclearrangewithargs3258365067?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7fe6e76c-806a-4ba1-accb-3ab926ba872e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8E668D26\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4552b-601a-0000-3f44-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:30 GMT", + "x-ms-client-request-id" : "7fe6e76c-806a-4ba1-accb-3ab926ba872e", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadandclearrangewithargs3282284012", "fileasyncapitestsuploadandclearrangewithargs3258365067" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadData.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadData.json new file mode 100644 index 000000000000..4e95849438b6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadData.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddata607163a2e4c6e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ce70f402-fbf3-4e28-b185-ceec19518ac4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8C0881FE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d36-301a-000d-1a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "x-ms-client-request-id" : "ce70f402-fbf3-4e28-b185-ceec19518ac4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddata607163a2e4c6e/fileasyncapitestsuploadanddownloaddata04990e1bd27d0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c4fca6b8-ab5f-43fd-a60a-b4c9effeb87c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:27.0171730Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "ETag" : "\"0x8D7325B8C1A7652\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:27.0171730Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339d38-301a-000d-1b44-645aef000000", + "x-ms-client-request-id" : "c4fca6b8-ab5f-43fd-a60a-b4c9effeb87c", + "x-ms-file-last-write-time" : "2019-09-05T23:48:27.0171730Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddata607163a2e4c6e/fileasyncapitestsuploadanddownloaddata04990e1bd27d0?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "93607b0b-0348-4ca5-a659-d80b7a7ca122", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8C294383\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d39-301a-000d-1c44-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "x-ms-client-request-id" : "93607b0b-0348-4ca5-a659-d80b7a7ca122", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddata607163a2e4c6e/fileasyncapitestsuploadanddownloaddata04990e1bd27d0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2d8cb0c9-abed-4e8b-8b5e-ed8ff7c7283e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:27.0171730Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B8C294383\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:27.0171730Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "07339d3a-301a-000d-1d44-645aef000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "2d8cb0c9-abed-4e8b-8b5e-ed8ff7c7283e", + "x-ms-file-last-write-time" : "2019-09-05T23:48:27.0171730Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloaddata607163a2e4c6e", "fileasyncapitestsuploadanddownloaddata04990e1bd27d0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadDataWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadDataWithArgs.json new file mode 100644 index 000000000000..d16e020eb343 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadDataWithArgs.json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs44288a4fc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a45c79df-017e-4127-9914-d90060e7e369" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8C62620A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d3f-301a-000d-2144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "x-ms-client-request-id" : "a45c79df-017e-4127-9914-d90060e7e369" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs44288a4fc/fileasyncapitestsuploadanddownloaddatawithargs138488ac2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bc3ddc3e-2594-45dd-9000-cf0d63381a57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:27.5961877Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:26 GMT", + "ETag" : "\"0x8D7325B8C72D015\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:27.5961877Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339d42-301a-000d-2344-645aef000000", + "x-ms-client-request-id" : "bc3ddc3e-2594-45dd-9000-cf0d63381a57", + "x-ms-file-last-write-time" : "2019-09-05T23:48:27.5961877Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs44288a4fc/fileasyncapitestsuploadanddownloaddatawithargs138488ac2?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ddabd16a-101d-4587-b1e9-4138f3974764", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8C810108\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d43-301a-000d-2444-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:27 GMT", + "x-ms-client-request-id" : "ddabd16a-101d-4587-b1e9-4138f3974764", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs44288a4fc/fileasyncapitestsuploadanddownloaddatawithargs138488ac2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "446613c7-cec4-417b-8412-f9dc8a9915f0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:27.5961877Z", + "Content-Range" : "bytes 1-7/1024", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:27 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "7", + "x-ms-request-id" : "07339d45-301a-000d-2644-645aef000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:48:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B8C810108\"", + "x-ms-file-change-time" : "2019-09-05T23:48:27.5961877Z", + "x-ms-file-parent-id" : "0", + "x-ms-client-request-id" : "446613c7-cec4-417b-8412-f9dc8a9915f0", + "x-ms-file-last-write-time" : "2019-09-05T23:48:27.5961877Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloaddatawithargs44288a4fc", "fileasyncapitestsuploadanddownloaddatawithargs138488ac2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFile.json new file mode 100644 index 000000000000..a0342f59bf93 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFile.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D5686A47\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce464-801a-010a-5312-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-client-request-id" : "0d9215b3-71c3-40da-b21b-0299f7fa2d61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.5860803Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "ETag" : "\"0x8D72829D56FD543\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.5860803Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce466-801a-010a-5412-5a6faa000000", + "x-ms-client-request-id" : "3753e638-b01e-417e-ba59-4f60bb88d5fd", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.5860803Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/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-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D577512F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce467-801a-010a-5512-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-client-request-id" : "e5720200-126a-406e-b08d-9dcad5329801", + "Content-MD5" : "/CTzx8jXJ1MqqUsC1dJBUQ==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.5860803Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D577512F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.5860803Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "42bce468-801a-010a-5612-5a6faa000000", + "x-ms-client-request-id" : "5fe729c5-4987-491d-a0b1-91e96903cc61", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.5860803Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.5860803Z", + "Content-Range" : "bytes 0-13/14", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D577512F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.5860803Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "42bce469-801a-010a-5712-5a6faa000000", + "Body" : "[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33, 13, 10]", + "x-ms-client-request-id" : "38868217-e85c-443a-a704-60144361e150", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.5860803Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloadfile3442535644b75", "fileasyncapitestsuploadanddownloadfile426393d2d82df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFileExists.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFileExists.json new file mode 100644 index 000000000000..c1432a459117 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFileExists.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadfileexists10532f83d3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5c3e2d8a-bcb8-4772-a4a5-6dbd4bf0a3bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8F78D7D2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4556f-601a-0000-8044-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:31 GMT", + "x-ms-client-request-id" : "5c3e2d8a-bcb8-4772-a4a5-6dbd4bf0a3bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadfileexists10532f83d3/fileasyncapitestsuploadanddownloadfileexists4919173226", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c1e42260-fca2-4fa4-ad64-c6b2c9bfefaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:32.7823239Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "ETag" : "\"0x8D7325B8F8A2787\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:32.7823239Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45575-601a-0000-0444-64923b000000", + "x-ms-client-request-id" : "c1e42260-fca2-4fa4-ad64-c6b2c9bfefaf", + "x-ms-file-last-write-time" : "2019-09-05T23:48:32.7823239Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadfileexists10532f83d3/fileasyncapitestsuploadanddownloadfileexists4919173226?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "95548781-2658-44f9-a6f5-f576e6d46d61", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8F9942EA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45579-601a-0000-0844-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "x-ms-client-request-id" : "95548781-2658-44f9-a6f5-f576e6d46d61", + "Content-MD5" : "SBhvnLsTIqH+vn9SjVscdA==" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloadfileexists10532f83d3", "fileasyncapitestsuploadanddownloadfileexists4919173226" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadToFileDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadToFileDoesNotExist.json new file mode 100644 index 000000000000..b603bdae0e63 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadToFileDoesNotExist.json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadtofiledoesnotexist807186?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f31b1dd6-c77a-40f9-b3c1-026b6fbc2fe2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8FC39CA1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45584-601a-0000-1344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "x-ms-client-request-id" : "f31b1dd6-c77a-40f9-b3c1-026b6fbc2fe2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadtofiledoesnotexist807186/fileasyncapitestsuploadanddownloadtofiledoesnotexist30322a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "16565298-e652-43ed-b6b1-546d2c6cc57d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:33.2723377Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "ETag" : "\"0x8D7325B8FD4ECB1\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:33.2723377Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45589-601a-0000-1744-64923b000000", + "x-ms-client-request-id" : "16565298-e652-43ed-b6b1-546d2c6cc57d", + "x-ms-file-last-write-time" : "2019-09-05T23:48:33.2723377Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadtofiledoesnotexist807186/fileasyncapitestsuploadanddownloadtofiledoesnotexist30322a?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "93a47566-788c-4ddc-bcc9-fb89195a90a5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8FE3B9C8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45590-601a-0000-1e44-64923b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "x-ms-client-request-id" : "93a47566-788c-4ddc-bcc9-fb89195a90a5", + "Content-MD5" : "1tRkiflHQxQzG0ItV6HNAg==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadtofiledoesnotexist807186/fileasyncapitestsuploadanddownloadtofiledoesnotexist30322a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7e9a2fae-0c62-46e8-a822-870e4b1b02b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:33.2723377Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B8FE3B9C8\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:33.2723377Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "28", + "x-ms-request-id" : "36c45593-601a-0000-2144-64923b000000", + "x-ms-client-request-id" : "7e9a2fae-0c62-46e8-a822-870e4b1b02b5", + "x-ms-file-last-write-time" : "2019-09-05T23:48:33.2723377Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadanddownloadtofiledoesnotexist807186/fileasyncapitestsuploadanddownloadtofiledoesnotexist30322a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "989aecf7-be07-406b-aabf-5cf1e7f91242" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:33.2723377Z", + "Content-Range" : "bytes 0-27/28", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:33 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "28", + "x-ms-request-id" : "36c45598-601a-0000-2644-64923b000000", + "Body" : "[68, 111, 119, 110, 108, 111, 97, 100, 32, 102, 105, 108, 101, 32, 100, 111, 101, 115, 32, 110, 111, 116, 32, 101, 120, 105, 115, 116]", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:48:32 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D7325B8FE3B9C8\"", + "x-ms-file-change-time" : "2019-09-05T23:48:33.2723377Z", + "x-ms-file-parent-id" : "0", + "x-ms-client-request-id" : "989aecf7-be07-406b-aabf-5cf1e7f91242", + "x-ms-file-last-write-time" : "2019-09-05T23:48:33.2723377Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloadtofiledoesnotexist807186", "fileasyncapitestsuploadanddownloadtofiledoesnotexist30322a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataError.json new file mode 100644 index 000000000000..5d652935c816 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataError.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddataerror745673bf5975c19a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eee2baf1-6e54-49ec-af85-733cf9e42297" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8CB95BB8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d48-301a-000d-2944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:27 GMT", + "x-ms-client-request-id" : "eee2baf1-6e54-49ec-af85-733cf9e42297" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddataerror745673bf5975c19a/fileasyncapitestsuploaddataerror084772af725f040e?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "57435378-ce11-4b4c-ba73-e98658efc5ed", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339d4a-301a-000d-2a44-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339d4a-301a-000d-2a44-645aef000000\nTime:2019-09-05T23:48:28.1565130Z", + "Date" : "Thu, 05 Sep 2019 23:48:27 GMT", + "x-ms-client-request-id" : "57435378-ce11-4b4c-ba73-e98658efc5ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploaddataerror745673bf5975c19a", "fileasyncapitestsuploaddataerror084772af725f040e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataLengthMismatch0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataLengthMismatch0.json new file mode 100644 index 000000000000..24c5f5e61546 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataLengthMismatch0.json @@ -0,0 +1,68 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddatalengthmismatch0477091d82a1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c5a8f021-71ae-4cff-b52d-66a384d1ff56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8CF0C14A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339d50-301a-000d-3044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:48:27 GMT", + "x-ms-client-request-id" : "c5a8f021-71ae-4cff-b52d-66a384d1ff56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddatalengthmismatch0477091d82a1/fileasyncapitestsuploaddatalengthmismatch0558140447e0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a981a872-21cf-433e-944f-8e7e475292a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:28.5292137Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:27 GMT", + "ETag" : "\"0x8D7325B8D012E69\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:28.5292137Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339d53-301a-000d-3144-645aef000000", + "x-ms-client-request-id" : "a981a872-21cf-433e-944f-8e7e475292a6", + "x-ms-file-last-write-time" : "2019-09-05T23:48:28.5292137Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddatalengthmismatch0477091d82a1/fileasyncapitestsuploaddatalengthmismatch0558140447e0?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9754fc72-0c5d-4404-82e0-fbe57cc26467", + "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." + } + } ], + "variables" : [ "fileasyncapitestsuploaddatalengthmismatch0477091d82a1", "fileasyncapitestsuploaddatalengthmismatch0558140447e0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataLengthMismatch1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataLengthMismatch1.json new file mode 100644 index 000000000000..b7439e64e11f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataLengthMismatch1.json @@ -0,0 +1,68 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddatalengthmismatch1212158ee78a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d52c16a1-8c29-434b-94bd-b22082e4cbda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8D645A00\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2d4ef0a3-001a-0006-5644-64a184000000", + "Date" : "Thu, 05 Sep 2019 23:48:28 GMT", + "x-ms-client-request-id" : "d52c16a1-8c29-434b-94bd-b22082e4cbda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddatalengthmismatch1212158ee78a/fileasyncapitestsuploaddatalengthmismatch180852af296f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2a5e5cec-8bbf-4c8d-a64b-d94336a4bb39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:29.2852350Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:28 GMT", + "ETag" : "\"0x8D7325B8D748A7E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:29.2852350Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "2d4ef0a6-001a-0006-5844-64a184000000", + "x-ms-client-request-id" : "2a5e5cec-8bbf-4c8d-a64b-d94336a4bb39", + "x-ms-file-last-write-time" : "2019-09-05T23:48:29.2852350Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploaddatalengthmismatch1212158ee78a/fileasyncapitestsuploaddatalengthmismatch180852af296f?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0c9cd6df-66ed-4e25-bc7d-d59f349f542f", + "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." + } + } ], + "variables" : [ "fileasyncapitestsuploaddatalengthmismatch1212158ee78a", "fileasyncapitestsuploaddatalengthmismatch180852af296f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadFileDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadFileDoesNotExist.json new file mode 100644 index 000000000000..ec07029da4b3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadFileDoesNotExist.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileasyncapitestsuploadfiledoesnotexist35412d545b006?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "36576aeb-feb1-49a4-b5c1-2f87f3bde88a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B8F4CE5C5\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45564-601a-0000-7644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:31 GMT", + "x-ms-client-request-id" : "36576aeb-feb1-49a4-b5c1-2f87f3bde88a" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadfiledoesnotexist35412d545b006", "fileasyncapitestsuploadfiledoesnotexist6134873c47ddd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsAccountSASFileServiceNetworkTestCreateDeleteShareSucceeds.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsAccountSASFileServiceNetworkTestCreateDeleteShareSucceeds.json new file mode 100644 index 000000000000..8ae525f23e8a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsAccountSASFileServiceNetworkTestCreateDeleteShareSucceeds.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/create?restype=share&sv=2019-02-02&ss=f&srt=sco&se=2019-09-06T23%3A47%3A41Z&sp=rdc&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "227bbc29-6fbf-4aea-902f-45b6ef5665ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7134C88E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a34-301a-000d-3144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:41 GMT", + "x-ms-client-request-id" : "227bbc29-6fbf-4aea-902f-45b6ef5665ec" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/create?restype=share&sv=2019-02-02&ss=f&srt=sco&se=2019-09-06T23%3A47%3A41Z&sp=rdc&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "01458065-6b8c-4cb2-b636-337099946323" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339a36-301a-000d-3244-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:41 GMT", + "x-ms-client-request-id" : "01458065-6b8c-4cb2-b636-337099946323" + }, + "Exception" : null + } ], + "variables" : [ "2019-09-05T23:47:41.836Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASNetworkTestDownloadUpload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASNetworkTestDownloadUpload.json new file mode 100644 index 000000000000..6104e54410ef --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASNetworkTestDownloadUpload.json @@ -0,0 +1,119 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a0616d34-e502-4544-b52c-e3d767339ef8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835060254305419264", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:40.3599603Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:39 GMT", + "ETag" : "\"0x8D7325B704B22F3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:40.3599603Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339a1f-301a-000d-1c44-645aef000000", + "x-ms-client-request-id" : "a0616d34-e502-4544-b52c-e3d767339ef8", + "x-ms-file-last-write-time" : "2019-09-05T23:47:40.3599603Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d622a2a7-0eea-4f73-9af3-2b5f543eea27", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B705BEBEA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a21-301a-000d-1e44-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "x-ms-client-request-id" : "d622a2a7-0eea-4f73-9af3-2b5f543eea27", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename?sv=2019-02-02&spr=https%2Chttp&st=2019-09-04T23%3A47%3A40Z&se=2019-09-06T23%3A47%3A40Z&sip=0.0.0.0-255.255.255.255&sr=f&sp=rcwd&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-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "da0d2ddb-44f7-49fa-b669-0647b2174499" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-file-id" : "13835060254305419264", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:40.3599603Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-file-attributes" : "Archive", + "Content-Length" : "1024", + "x-ms-request-id" : "07339a22-301a-000d-1f44-645aef000000", + "Body" : "test\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "Cache-Control" : "cache", + "ETag" : "\"0x8D7325B705BEBEA\"", + "Content-Disposition" : "disposition", + "x-ms-file-change-time" : "2019-09-05T23:47:40.3599603Z", + "x-ms-file-parent-id" : "0", + "Content-Language" : "language", + "x-ms-client-request-id" : "da0d2ddb-44f7-49fa-b669-0647b2174499", + "x-ms-file-last-write-time" : "2019-09-05T23:47:40.3599603Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename?comp=range&sv=2019-02-02&spr=https%2Chttp&st=2019-09-04T23%3A47%3A40Z&se=2019-09-06T23%3A47%3A40Z&sip=0.0.0.0-255.255.255.255&sr=f&sp=rcwd&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-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ea7261ea-7c9d-4a38-b469-e683aff3a127", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B70845BD9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a24-301a-000d-2144-645aef000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "x-ms-client-request-id" : "ea7261ea-7c9d-4a38-b469-e683aff3a127", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==" + }, + "Exception" : null + } ], + "variables" : [ "2019-09-05T23:47:40.525Z", "2019-09-05T23:47:40.525Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASNetworkTestUploadFails.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASNetworkTestUploadFails.json new file mode 100644 index 000000000000..dd89dd1af5d5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASNetworkTestUploadFails.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a4151583-aff4-4c56-8d7d-e0b4668b3a0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835060254305419264", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:40.9179749Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "ETag" : "\"0x8D7325B70A04865\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:40.9179749Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339a26-301a-000d-2344-645aef000000", + "x-ms-client-request-id" : "a4151583-aff4-4c56-8d7d-e0b4668b3a0c", + "x-ms-file-last-write-time" : "2019-09-05T23:47:40.9179749Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename?comp=range&sv=2019-02-02&spr=https%2Chttp&st=2019-09-04T23%3A47%3A40Z&se=2019-09-06T23%3A47%3A40Z&sip=0.0.0.0-255.255.255.255&sr=f&sp=rcd&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-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f8672cae-0cb6-4a7d-b4cb-8782ec04999d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "07339a28-301a-000d-2544-645aef000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:07339a28-301a-000d-2544-645aef000000\nTime:2019-09-05T23:47:41.0051845Z", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "x-ms-client-request-id" : "f8672cae-0cb6-4a7d-b4cb-8782ec04999d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/sharename/filename?sv=2019-02-02&spr=https%2Chttp&st=2019-09-04T23%3A47%3A40Z&se=2019-09-06T23%3A47%3A40Z&sip=0.0.0.0-255.255.255.255&sr=f&sp=rcd&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-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "32c8c95f-9387-499b-8adb-a328470d3f75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339a29-301a-000d-2644-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "x-ms-client-request-id" : "32c8c95f-9387-499b-8adb-a328470d3f75" + }, + "Exception" : null + } ], + "variables" : [ "2019-09-05T23:47:40.974Z", "2019-09-05T23:47:40.974Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse0.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse1.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse2.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse3.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse4.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse4.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse5.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse5.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParse5.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParseIA.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParseIA.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsParseIA.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString0.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString1.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString2.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString3.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString4.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsFileSASPermissionsToString4.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsServiceSASSignatureValuesCanonicalizedResource.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsServiceSASSignatureValuesCanonicalizedResource.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsServiceSASSignatureValuesCanonicalizedResource.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASNetworkTestIdentifierPermissionsCreateDelete.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASNetworkTestIdentifierPermissionsCreateDelete.json new file mode 100644 index 000000000000..2ccb72d389e5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASNetworkTestIdentifierPermissionsCreateDelete.json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename?restype=share&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5e527666-2c79-438a-ac5b-fd31831b841a", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B70D8083E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339a2d-301a-000d-2a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "x-ms-client-request-id" : "5e527666-2c79-438a-ac5b-fd31831b841a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/dir?restype=directory&sv=2019-02-02&si=0000&sr=s&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fa4f6593-8a83-4a26-91d6-ce7ef443eca0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "16140903263519113216", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:41.3879956Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:40 GMT", + "ETag" : "\"0x8D7325B70E80094\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:41.3879956Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339a2f-301a-000d-2c44-645aef000000", + "x-ms-client-request-id" : "fa4f6593-8a83-4a26-91d6-ce7ef443eca0", + "x-ms-file-last-write-time" : "2019-09-05T23:47:41.3879956Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/sharename/dir?restype=directory&sv=2019-02-02&si=0000&sr=s&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3166598e-075f-46c9-9b6a-be64952592d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339a30-301a-000d-2d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:41 GMT", + "x-ms-client-request-id" : "3166598e-075f-46c9-9b6a-be64952592d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/sharename/dir?restype=directory&sv=2019-02-02&se=2019-09-06T23%3A47%3A41Z&sr=s&sp=rcwdl&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f0415101-6593-49d2-ac5a-422a39565c27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "10376295740484878336", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:41.5789964Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:41 GMT", + "ETag" : "\"0x8D7325B7105258C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:41.5789964Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339a31-301a-000d-2e44-645aef000000", + "x-ms-client-request-id" : "f0415101-6593-49d2-ac5a-422a39565c27", + "x-ms-file-last-write-time" : "2019-09-05T23:47:41.5789964Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/sharename/dir?restype=directory&sv=2019-02-02&se=2019-09-06T23%3A47%3A41Z&sr=s&sp=rcwdl&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a1caad59-3ba0-46cc-abca-55eba98a42cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339a32-301a-000d-2f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:41 GMT", + "x-ms-client-request-id" : "a1caad59-3ba0-46cc-abca-55eba98a42cd" + }, + "Exception" : null + } ], + "variables" : [ "2019-09-05T23:47:41.235Z", "2019-09-05T23:47:41.342Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse0.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse1.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse2.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse3.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse4.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse4.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse5.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse5.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse5.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse6.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse6.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParse6.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParseIA.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParseIA.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsParseIA.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString0.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString1.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString2.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString3.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString4.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString4.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString5.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString5.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileSASTestsShareSASPermissionsToString5.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShare.json new file mode 100644 index 000000000000..74ad0325615f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShare.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestscreateshare264497bdef2adc2f9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ff4a3dff-536f-4ec3-b094-94722b392b13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9EB83929\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459a4-601a-0000-5344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:57 GMT", + "x-ms-client-request-id" : "ff4a3dff-536f-4ec3-b094-94722b392b13" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreateshare264497bdef2adc2f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareMaxOverloads.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareMaxOverloads.json new file mode 100644 index 000000000000..9ca98553e89f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareMaxOverloads.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestscreatesharemaxoverloads459361563ae?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4863e81a-0980-4000-ba64-0cb878196a03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9EE4043A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459af-601a-0000-5d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:57 GMT", + "x-ms-client-request-id" : "4863e81a-0980-4000-ba64-0cb878196a03" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreatesharemaxoverloads459361563ae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..2df5a46110b5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestscreatesharewithinvalidargs0754078e9f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eb00ee09-b747-4826-a924-95de520d5372" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "36c459b5-601a-0000-6244-64923b000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:36c459b5-601a-0000-6244-64923b000000\nTime:2019-09-05T23:48:58.8230704Z", + "Date" : "Thu, 05 Sep 2019 23:48:58 GMT", + "x-ms-client-request-id" : "eb00ee09-b747-4826-a924-95de520d5372", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreatesharewithinvalidargs0754078e9f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..838fd5339b54 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestscreatesharewithinvalidargs101973296c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fc51e648-7feb-49ae-9623-5c85a0cd27d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "x-ms-request-id" : "36c459b7-601a-0000-6444-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c459b7-601a-0000-6444-64923b000000\nTime:2019-09-05T23:48:58.9900718Zx-ms-share-quota-1", + "Date" : "Thu, 05 Sep 2019 23:48:58 GMT", + "x-ms-client-request-id" : "fc51e648-7feb-49ae-9623-5c85a0cd27d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreatesharewithinvalidargs101973296c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShare.json new file mode 100644 index 000000000000..e07b049b9cba --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShare.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestsdeleteshare41124967f2982851e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9e40c171-fb82-4303-834b-faad6a1a7317" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9F433B9F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459b9-601a-0000-6644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:58 GMT", + "x-ms-client-request-id" : "9e40c171-fb82-4303-834b-faad6a1a7317" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestsdeleteshare41124967f2982851e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f1301618-4ae3-423e-90ab-3e72df12e59c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c459bb-601a-0000-6744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:58 GMT", + "x-ms-client-request-id" : "f1301618-4ae3-423e-90ab-3e72df12e59c" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestsdeleteshare41124967f2982851e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShareDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShareDoesNotExist.json new file mode 100644 index 000000000000..52421d2ba015 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShareDoesNotExist.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestsdeletesharedoesnotexist78128006563?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "18722e04-c933-4a5d-941b-78caf7628b8e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c459c1-601a-0000-6d44-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c459c1-601a-0000-6d44-64923b000000\nTime:2019-09-05T23:48:59.4490805Z", + "Date" : "Thu, 05 Sep 2019 23:48:58 GMT", + "x-ms-client-request-id" : "18722e04-c933-4a5d-941b-78caf7628b8e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestsdeletesharedoesnotexist839275f9aa7", "fileserviceapitestsdeletesharedoesnotexist78128006563" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetFileServiceURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetFileServiceURL.json new file mode 100644 index 000000000000..efa1edd979e4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetFileServiceURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceapitestsgetfileserviceurl0803569e6087d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetShareDoesNotCreateAShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetShareDoesNotCreateAShare.json new file mode 100644 index 000000000000..678ae5dddb11 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetShareDoesNotCreateAShare.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceapitestsgetsharedoesnotcreateashare30966a1e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs0.json new file mode 100644 index 000000000000..e173b64ff7e5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs0.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs01115361b9fc4d0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fb06d1b3-3c28-4a67-ac2d-37898aafd381" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA15F6583\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a30-601a-0000-4d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:01 GMT", + "x-ms-client-request-id" : "fb06d1b3-3c28-4a67-ac2d-37898aafd381" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs01115361b9fc4d1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4cc1c874-e046-4388-9106-bc13c049ac35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA16D4853\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a33-601a-0000-4f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:02 GMT", + "x-ms-client-request-id" : "4cc1c874-e046-4388-9106-bc13c049ac35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs01115361b9fc4d2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "458a4703-b4c3-4048-897a-c198ad10ee4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA17BEE60\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a37-601a-0000-5144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:02 GMT", + "x-ms-client-request-id" : "458a4703-b4c3-4048-897a-c198ad10ee4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs01115361b9fc4d2?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bde7a54c-9e27-4474-ab18-762c5ea26858" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:49:02.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA17BEE60\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a3e-601a-0000-5744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:02 GMT", + "x-ms-client-request-id" : "bde7a54c-9e27-4474-ab18-762c5ea26858" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithargs&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3303fc1f-efc5-4407-b798-8523de129a01" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a40-601a-0000-5944-64923b000000", + "Body" : "fileserviceapitestslistshareswithargsfileserviceapitestslistshareswithargs01115361b9fc4d0Thu, 05 Sep 2019 23:49:02 GMT\"0x8D7325BA15F6583\"2fileserviceapitestslistshareswithargs01115361b9fc4d1Thu, 05 Sep 2019 23:49:02 GMT\"0x8D7325BA16D4853\"2fileserviceapitestslistshareswithargs01115361b9fc4d2Thu, 05 Sep 2019 23:49:02 GMT\"0x8D7325BA17BEE60\"2", + "Date" : "Thu, 05 Sep 2019 23:49:02 GMT", + "x-ms-client-request-id" : "3303fc1f-efc5-4407-b798-8523de129a01", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithargs01115361b9fc4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs1.json new file mode 100644 index 000000000000..538adddf1ea7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs1.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs1474682f1a239c0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0d0ffa45-424b-4599-a6b4-8d79aa9fc8eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA1E1DC36\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a4f-601a-0000-6844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:02 GMT", + "x-ms-client-request-id" : "0d0ffa45-424b-4599-a6b4-8d79aa9fc8eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs1474682f1a239c1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3c9fe07b-fcd7-4e35-adf2-c5766830bab4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA1EFE625\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a53-601a-0000-6b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:02 GMT", + "x-ms-client-request-id" : "3c9fe07b-fcd7-4e35-adf2-c5766830bab4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs1474682f1a239c2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8373e31c-ef22-48a1-8464-91d52545cd07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA1FE16E1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a57-601a-0000-6e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "8373e31c-ef22-48a1-8464-91d52545cd07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs1474682f1a239c2?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7bd7ad58-a20e-476c-8480-b9de08551915" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:49:03.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA1FE16E1\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a5d-601a-0000-7344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "7bd7ad58-a20e-476c-8480-b9de08551915" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithargs&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4835054b-96e9-4488-a8b6-3aae587da2d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a61-601a-0000-7744-64923b000000", + "Body" : "fileserviceapitestslistshareswithargsfileserviceapitestslistshareswithargs1474682f1a239c0Thu, 05 Sep 2019 23:49:03 GMT\"0x8D7325BA1E1DC36\"2valuefileserviceapitestslistshareswithargs1474682f1a239c1Thu, 05 Sep 2019 23:49:03 GMT\"0x8D7325BA1EFE625\"2valuefileserviceapitestslistshareswithargs1474682f1a239c2Thu, 05 Sep 2019 23:49:03 GMT\"0x8D7325BA1FE16E1\"2value", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "4835054b-96e9-4488-a8b6-3aae587da2d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithargs1474682f1a239c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs2.json new file mode 100644 index 000000000000..1e8892e806ed --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs2.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs2675759cf57f2f0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3af17a25-d846-4529-840f-7d4a57a6b3ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA262CC51\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a6f-601a-0000-0544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "3af17a25-d846-4529-840f-7d4a57a6b3ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs2675759cf57f2f1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c6bd6d8c-f991-4c56-a903-7e139c5873a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA270FD6E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a73-601a-0000-0844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "c6bd6d8c-f991-4c56-a903-7e139c5873a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs2675759cf57f2f2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ae2e76f5-31c1-47d2-b24c-9c9bcc23334e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA27F2E0C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a78-601a-0000-0c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "ae2e76f5-31c1-47d2-b24c-9c9bcc23334e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithargs2675759cf57f2f2?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d21971ba-b387-486e-bb45-b6883b23afbc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:49:04.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA27F2E0C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a7c-601a-0000-0f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:03 GMT", + "x-ms-client-request-id" : "d21971ba-b387-486e-bb45-b6883b23afbc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithargs&include=metadata%2csnapshots&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "456788b8-6e67-470f-937b-a6ada8938074" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a80-601a-0000-1244-64923b000000", + "Body" : "fileserviceapitestslistshareswithargsfileserviceapitestslistshareswithargs2675759cf57f2f0Thu, 05 Sep 2019 23:49:04 GMT\"0x8D7325BA262CC51\"2valuefileserviceapitestslistshareswithargs2675759cf57f2f1Thu, 05 Sep 2019 23:49:04 GMT\"0x8D7325BA270FD6E\"2valuefileserviceapitestslistshareswithargs2675759cf57f2f22019-09-05T23:49:04.0000000ZThu, 05 Sep 2019 23:49:04 GMT\"0x8D7325BA27F2E0C\"2valuefileserviceapitestslistshareswithargs2675759cf57f2f2Thu, 05 Sep 2019 23:49:04 GMT\"0x8D7325BA27F2E0C\"2value", + "Date" : "Thu, 05 Sep 2019 23:49:04 GMT", + "x-ms-client-request-id" : "456788b8-6e67-470f-937b-a6ada8938074", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithargs2675759cf57f2f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter0.json new file mode 100644 index 000000000000..3b9906dfaac6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter0.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter0896255c400680?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e61157e0-6a45-4d11-98ca-2fc1fcd7ea9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9F8C7979\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459c4-601a-0000-7044-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:58 GMT", + "x-ms-client-request-id" : "e61157e0-6a45-4d11-98ca-2fc1fcd7ea9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter0896255c400681?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "acfe3fee-a2a3-470d-8c33-ed7465f5010f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9F9A8344\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459c8-601a-0000-7344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "acfe3fee-a2a3-470d-8c33-ed7465f5010f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter0896255c400682?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "958a82c5-14c5-44a4-9e56-5a232c46a204" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9FA95055\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459cc-601a-0000-7544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "958a82c5-14c5-44a4-9e56-5a232c46a204" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f4d33ff0-01dc-4c76-85d4-393f861ccae3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c459ce-601a-0000-7644-64923b000000", + "Body" : "fileserviceapitestslistshareswithfilterfileserviceapitestslistshareswithfilter0896255c400680Thu, 05 Sep 2019 23:48:59 GMT\"0x8D7325B9F8C7979\"1fileserviceapitestslistshareswithfilter0896255c400681Thu, 05 Sep 2019 23:48:59 GMT\"0x8D7325B9F9A8344\"2fileserviceapitestslistshareswithfilter0896255c400682Thu, 05 Sep 2019 23:48:59 GMT\"0x8D7325B9FA95055\"3", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "f4d33ff0-01dc-4c76-85d4-393f861ccae3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter0896255c40068" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter1.json new file mode 100644 index 000000000000..6f70496e2448 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter1.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter174356bf831900?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5999c289-4bc8-4d03-a8b7-ed2ea3040b9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9FFDB21E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459dc-601a-0000-0344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "5999c289-4bc8-4d03-a8b7-ed2ea3040b9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter174356bf831901?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "86d1c77c-a4c2-40b3-a328-9d91b8c5668a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA00BBBE4\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459df-601a-0000-0544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "86d1c77c-a4c2-40b3-a328-9d91b8c5668a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter174356bf831902?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "aad6ea85-6ef7-474e-b6e2-d87169d53273" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA01B2521\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459e5-601a-0000-0a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "aad6ea85-6ef7-474e-b6e2-d87169d53273" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b898ee00-d9f2-427d-a490-946303d1148f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c459e8-601a-0000-0c44-64923b000000", + "Body" : "fileserviceapitestslistshareswithfilterfileserviceapitestslistshareswithfilter174356bf831900Thu, 05 Sep 2019 23:49:00 GMT\"0x8D7325B9FFDB21E\"1fileserviceapitestslistshareswithfilter174356bf831901Thu, 05 Sep 2019 23:49:00 GMT\"0x8D7325BA00BBBE4\"2fileserviceapitestslistshareswithfilter174356bf831902Thu, 05 Sep 2019 23:49:00 GMT\"0x8D7325BA01B2521\"3value", + "Date" : "Thu, 05 Sep 2019 23:48:59 GMT", + "x-ms-client-request-id" : "b898ee00-d9f2-427d-a490-946303d1148f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter174356bf83190" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter2.json new file mode 100644 index 000000000000..742a7d80c6dc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter2.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter2043187c8f9c00?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5989924a-4695-486c-8910-6149cc31d714" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA06FAE1F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459f7-601a-0000-1a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:00 GMT", + "x-ms-client-request-id" : "5989924a-4695-486c-8910-6149cc31d714" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter2043187c8f9c01?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5e700dd0-f6f0-4c19-a5ba-13c309053d1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA07D90A6\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c459fc-601a-0000-1e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:00 GMT", + "x-ms-client-request-id" : "5e700dd0-f6f0-4c19-a5ba-13c309053d1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter2043187c8f9c02?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2b6c6baa-4c19-44d2-854b-e5bf84f9db45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA08B9A75\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a00-601a-0000-2144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:00 GMT", + "x-ms-client-request-id" : "2b6c6baa-4c19-44d2-854b-e5bf84f9db45" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a3219a99-3366-4951-a9fb-0ecaa7247efd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a04-601a-0000-2444-64923b000000", + "Body" : "fileserviceapitestslistshareswithfilterfileserviceapitestslistshareswithfilter2043187c8f9c00Thu, 05 Sep 2019 23:49:01 GMT\"0x8D7325BA06FAE1F\"1fileserviceapitestslistshareswithfilter2043187c8f9c01Thu, 05 Sep 2019 23:49:01 GMT\"0x8D7325BA07D90A6\"2fileserviceapitestslistshareswithfilter2043187c8f9c02Thu, 05 Sep 2019 23:49:01 GMT\"0x8D7325BA08B9A75\"3", + "Date" : "Thu, 05 Sep 2019 23:49:00 GMT", + "x-ms-client-request-id" : "a3219a99-3366-4951-a9fb-0ecaa7247efd", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter2043187c8f9c0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter3.json new file mode 100644 index 000000000000..5af2be7cfb28 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter3.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter31299193353330?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "561a0e8d-6c37-4ad4-b0ad-7d24811657c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA0E10D9A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a15-601a-0000-3544-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:01 GMT", + "x-ms-client-request-id" : "561a0e8d-6c37-4ad4-b0ad-7d24811657c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter31299193353331?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7e5eb44b-8aec-4547-b9fe-b1a73ed9292d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA0EFB3A3\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a19-601a-0000-3844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:01 GMT", + "x-ms-client-request-id" : "7e5eb44b-8aec-4547-b9fe-b1a73ed9292d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceapitestslistshareswithfilter31299193353332?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cc9c3c02-f5a4-468f-9c7d-85f1f070b1d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BA0FECEDD\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45a1c-601a-0000-3a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:01 GMT", + "x-ms-client-request-id" : "cc9c3c02-f5a4-468f-9c7d-85f1f070b1d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "62a38349-67e0-4d3f-8c3c-30023a4f4bf2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a1f-601a-0000-3c44-64923b000000", + "Body" : "fileserviceapitestslistshareswithfilter2fileserviceapitestslistshareswithfilter31299193353330Thu, 05 Sep 2019 23:49:01 GMT\"0x8D7325BA0E10D9A\"1fileserviceapitestslistshareswithfilter31299193353331Thu, 05 Sep 2019 23:49:01 GMT\"0x8D7325BA0EFB3A3\"2/gapradev/fileserviceapitestslistshareswithfilter31299193353332", + "Date" : "Thu, 05 Sep 2019 23:49:01 GMT", + "x-ms-client-request-id" : "62a38349-67e0-4d3f-8c3c-30023a4f4bf2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&marker=/gapradev/fileserviceapitestslistshareswithfilter31299193353332&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "94f1d1f2-572a-4bbb-babb-f592f0064f08" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a22-601a-0000-3f44-64923b000000", + "Body" : "fileserviceapitestslistshareswithfilter/gapradev/fileserviceapitestslistshareswithfilter312991933533322fileserviceapitestslistshareswithfilter31299193353332Thu, 05 Sep 2019 23:49:02 GMT\"0x8D7325BA0FECEDD\"3", + "Date" : "Thu, 05 Sep 2019 23:49:01 GMT", + "x-ms-client-request-id" : "94f1d1f2-572a-4bbb-babb-f592f0064f08", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter3129919335333" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetProperties.json new file mode 100644 index 000000000000..6a2cf75c31af --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetProperties.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9da8cbba-e496-45e2-9168-e9c6a30a9295" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a8f-601a-0000-2144-64923b000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 05 Sep 2019 23:49:04 GMT", + "x-ms-client-request-id" : "9da8cbba-e496-45e2-9168-e9c6a30a9295", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e71c39cb-7416-4475-ab6b-04703f0b8c58" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45a95-601a-0000-2644-64923b000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 05 Sep 2019 23:49:04 GMT", + "x-ms-client-request-id" : "e71c39cb-7416-4475-ab6b-04703f0b8c58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9dbb0cb3-b928-43d3-9a60-0c4e1390aad6", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c45a99-601a-0000-2944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:49:05 GMT", + "x-ms-client-request-id" : "9dbb0cb3-b928-43d3-9a60-0c4e1390aad6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "74c523c7-ce98-4a64-a3b6-2c8af70425ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36c45abc-601a-0000-4544-64923b000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 05 Sep 2019 23:49:05 GMT", + "x-ms-client-request-id" : "74c523c7-ce98-4a64-a3b6-2c8af70425ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetproperties715348fbe0e68" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs0.json new file mode 100644 index 000000000000..50d5860a3db3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs0.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bb51b844-f88d-4fe5-8622-31a2a67b243c", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "36c45ac3-601a-0000-4c44-64923b000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:36c45ac3-601a-0000-4c44-64923b000000\nTime:2019-09-05T23:49:06.8331309Z00", + "Date" : "Thu, 05 Sep 2019 23:49:06 GMT", + "x-ms-client-request-id" : "bb51b844-f88d-4fe5-8622-31a2a67b243c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs033823" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs1.json new file mode 100644 index 000000000000..e2398b987148 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs1.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b91fd81e-8a1c-40eb-82c5-8dd74cfd7e36", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "36c45acb-601a-0000-5444-64923b000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:36c45acb-601a-0000-5444-64923b000000\nTime:2019-09-05T23:49:07.0161315Z00", + "Date" : "Thu, 05 Sep 2019 23:49:06 GMT", + "x-ms-client-request-id" : "b91fd81e-8a1c-40eb-82c5-8dd74cfd7e36", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs156997" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs2.json new file mode 100644 index 000000000000..ac5e3bc55a0a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs2.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1f2f6e03-c469-4485-a473-ffcfebf7bac7", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "36c45ad1-601a-0000-5a44-64923b000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:36c45ad1-601a-0000-5a44-64923b000000\nTime:2019-09-05T23:49:07.1951341Z00", + "Date" : "Thu, 05 Sep 2019 23:49:06 GMT", + "x-ms-client-request-id" : "1f2f6e03-c469-4485-a473-ffcfebf7bac7", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs267880" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs3.json new file mode 100644 index 000000000000..ba951ac8b2db --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs3.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3f837222-aa95-40e4-bf66-242a7e09655a", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "36c45ad8-601a-0000-6144-64923b000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:36c45ad8-601a-0000-6144-64923b000000\nTime:2019-09-05T23:49:07.3651333Z00", + "Date" : "Thu, 05 Sep 2019 23:49:06 GMT", + "x-ms-client-request-id" : "3f837222-aa95-40e4-bf66-242a7e09655a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs359662" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs4.json new file mode 100644 index 000000000000..ba9cebf3b6d1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs4.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5532d455-8d60-439f-9515-36ede9c65f7e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlNodeValue", + "retry-after" : "0", + "Content-Length" : "340", + "StatusCode" : "400", + "x-ms-request-id" : "36c45adc-601a-0000-6544-64923b000000", + "Body" : "InvalidXmlNodeValueThe value for one of the XML nodes is not in the correct format.\nRequestId:36c45adc-601a-0000-6544-64923b000000\nTime:2019-09-05T23:49:07.5591358ZAllowedMethodsNOTAREALHTTPMETHOD", + "Date" : "Thu, 05 Sep 2019 23:49:06 GMT", + "x-ms-client-request-id" : "5532d455-8d60-439f-9515-36ede9c65f7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs471639" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShare.json new file mode 100644 index 000000000000..89142365b3e9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShare.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestscreateshare36397e52302f193?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bdc46da1-1935-4fed-8dfd-d45dd27b76a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB344FF40\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fca-301a-001d-6044-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:31 GMT", + "x-ms-client-request-id" : "bdc46da1-1935-4fed-8dfd-d45dd27b76a8" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreateshare36397e52302f193" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..563fa75d775d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs03011338?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8f43fa8e-3b4c-4eb5-98ae-29e7647084a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "cac51fd4-301a-001d-6844-649f87000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:cac51fd4-301a-001d-6844-649f87000000\nTime:2019-09-05T23:49:33.3610827Z", + "Date" : "Thu, 05 Sep 2019 23:49:32 GMT", + "x-ms-client-request-id" : "8f43fa8e-3b4c-4eb5-98ae-29e7647084a5", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs03011338" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..ec0191b3bcee --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs100078fa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d723d08a-56e2-479b-83f3-124584f342f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "x-ms-request-id" : "cac51fd6-301a-001d-6a44-649f87000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:cac51fd6-301a-001d-6a44-649f87000000\nTime:2019-09-05T23:49:33.5240821Zx-ms-share-quota-1", + "Date" : "Thu, 05 Sep 2019 23:49:32 GMT", + "x-ms-client-request-id" : "d723d08a-56e2-479b-83f3-124584f342f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs100078fa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs2.json new file mode 100644 index 000000000000..ee2ebe8c899a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs2.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs28200599?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "026fbbf1-bd34-412f-b7bd-f9f70b5d1224" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "323", + "StatusCode" : "400", + "x-ms-request-id" : "cac51fd8-301a-001d-6c44-649f87000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:cac51fd8-301a-001d-6c44-649f87000000\nTime:2019-09-05T23:49:33.6870811Zx-ms-share-quota0", + "Date" : "Thu, 05 Sep 2019 23:49:32 GMT", + "x-ms-client-request-id" : "026fbbf1-bd34-412f-b7bd-f9f70b5d1224", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs28200599" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs3.json new file mode 100644 index 000000000000..628e60505bdd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs3.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs32394526?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3ff153b0-7e2e-4ca3-a6dc-10769d3e2af4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "cac51fda-301a-001d-6e44-649f87000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:cac51fda-301a-001d-6e44-649f87000000\nTime:2019-09-05T23:49:33.8520781Zx-ms-share-quota5200", + "Date" : "Thu, 05 Sep 2019 23:49:32 GMT", + "x-ms-client-request-id" : "3ff153b0-7e2e-4ca3-a6dc-10769d3e2af4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs32394526" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata0.json new file mode 100644 index 000000000000..fd619cc2597b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata082348008" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata1.json new file mode 100644 index 000000000000..2253e240aabc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata190289390" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata2.json new file mode 100644 index 000000000000..2004d78f5028 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata206953b05" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata3.json new file mode 100644 index 000000000000..386931bf4b26 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata303509446" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShare.json new file mode 100644 index 000000000000..265ce0676fb7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShare.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestsdeleteshare26957cc0295f5c2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShareDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShareDoesNotExist.json new file mode 100644 index 000000000000..83264a897182 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShareDoesNotExist.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestsdeletesharedoesnotexist2233074cb?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4fb4fba2-275b-4ba7-8316-030edc0cd43b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "cac51fdd-301a-001d-7144-649f87000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:cac51fdd-301a-001d-7144-649f87000000\nTime:2019-09-05T23:49:34.1200797Z", + "Date" : "Thu, 05 Sep 2019 23:49:33 GMT", + "x-ms-client-request-id" : "4fb4fba2-275b-4ba7-8316-030edc0cd43b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestsdeletesharedoesnotexist503824bc9", "fileserviceasyncapitestsdeletesharedoesnotexist2233074cb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetFileServiceURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetFileServiceURL.json new file mode 100644 index 000000000000..3aac822d8e0d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetFileServiceURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestsgetfileserviceurl24002cd106dd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetShareDoesNotCreateAShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetShareDoesNotCreateAShare.json new file mode 100644 index 000000000000..bca7a6fc8317 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetShareDoesNotCreateAShare.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestsgetsharedoesnotcreateashare1170239" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs0.json new file mode 100644 index 000000000000..1f1ad75c46f3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs0.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs054856fa30c50?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "61903df5-2306-4eac-8cfa-9398bcda596f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB5FE7AF0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52015-301a-001d-1744-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:36 GMT", + "x-ms-client-request-id" : "61903df5-2306-4eac-8cfa-9398bcda596f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs054856fa30c51?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d61e027e-4fab-4cfe-91a3-8dd2dcaeea62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB60C3681\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52017-301a-001d-1844-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:36 GMT", + "x-ms-client-request-id" : "d61e027e-4fab-4cfe-91a3-8dd2dcaeea62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs054856fa30c52?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "24e1c0a0-c1b5-4f31-bf44-bb465c6f642c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB61A4051\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52019-301a-001d-1944-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:36 GMT", + "x-ms-client-request-id" : "24e1c0a0-c1b5-4f31-bf44-bb465c6f642c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs054856fa30c52?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dbd23389-3cc5-476a-8e9c-e507c96a858a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:49:37.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB61A4051\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac5201b-301a-001d-1a44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:36 GMT", + "x-ms-client-request-id" : "dbd23389-3cc5-476a-8e9c-e507c96a858a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithargs&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8416542d-d955-4fda-b9bd-4a23946986d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac5201c-301a-001d-1b44-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithargsfileserviceasyncapitestslistshareswithargs054856fa30c50Thu, 05 Sep 2019 23:49:37 GMT\"0x8D7325BB5FE7AF0\"2fileserviceasyncapitestslistshareswithargs054856fa30c51Thu, 05 Sep 2019 23:49:37 GMT\"0x8D7325BB60C3681\"2fileserviceasyncapitestslistshareswithargs054856fa30c52Thu, 05 Sep 2019 23:49:37 GMT\"0x8D7325BB61A4051\"2", + "Date" : "Thu, 05 Sep 2019 23:49:36 GMT", + "x-ms-client-request-id" : "8416542d-d955-4fda-b9bd-4a23946986d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithargs054856fa30c5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs1.json new file mode 100644 index 000000000000..b57cac1d4286 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs1.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs154986b357490?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dccde8bb-ea1e-4420-a958-697363db31ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB67C84D8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52023-301a-001d-2044-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:37 GMT", + "x-ms-client-request-id" : "dccde8bb-ea1e-4420-a958-697363db31ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs154986b357491?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "be65fdb3-66c3-4903-9bdf-5a7855c3a7d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB68A676D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52025-301a-001d-2144-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:37 GMT", + "x-ms-client-request-id" : "be65fdb3-66c3-4903-9bdf-5a7855c3a7d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs154986b357492?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6a0f9298-a400-4bfb-9997-b565df3b5005" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB6989842\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52027-301a-001d-2244-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:37 GMT", + "x-ms-client-request-id" : "6a0f9298-a400-4bfb-9997-b565df3b5005" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs154986b357492?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b0a6d6b6-7c56-42e5-a249-704cb5e26c34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:49:38.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB6989842\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52029-301a-001d-2344-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:37 GMT", + "x-ms-client-request-id" : "b0a6d6b6-7c56-42e5-a249-704cb5e26c34" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithargs&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d85c6d79-ab61-4566-9dbb-538e8372b371" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac5202a-301a-001d-2444-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithargsfileserviceasyncapitestslistshareswithargs154986b357490Thu, 05 Sep 2019 23:49:38 GMT\"0x8D7325BB67C84D8\"2valuefileserviceasyncapitestslistshareswithargs154986b357491Thu, 05 Sep 2019 23:49:38 GMT\"0x8D7325BB68A676D\"2valuefileserviceasyncapitestslistshareswithargs154986b357492Thu, 05 Sep 2019 23:49:38 GMT\"0x8D7325BB6989842\"2value", + "Date" : "Thu, 05 Sep 2019 23:49:37 GMT", + "x-ms-client-request-id" : "d85c6d79-ab61-4566-9dbb-538e8372b371", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithargs154986b35749" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs2.json new file mode 100644 index 000000000000..f2c77020d32b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs2.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs269037d568f80?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4fb4a0f2-3e52-482d-be59-4524643998dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB6F9CB3E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52031-301a-001d-2a44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:37 GMT", + "x-ms-client-request-id" : "4fb4a0f2-3e52-482d-be59-4524643998dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs269037d568f81?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c95fa7c2-527a-4f9d-9f8a-5e2855160bcf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB70934A5\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52033-301a-001d-2b44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "c95fa7c2-527a-4f9d-9f8a-5e2855160bcf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs269037d568f82?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "07d0b8b7-2a64-4e0c-8938-6e52dcd1c08a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB7178C75\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52037-301a-001d-2e44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "07d0b8b7-2a64-4e0c-8938-6e52dcd1c08a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithargs269037d568f82?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c1055478-94c2-4b4a-9a6c-88b4c1c4c5ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:49:39.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB7178C75\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac5203a-301a-001d-3044-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "c1055478-94c2-4b4a-9a6c-88b4c1c4c5ee" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithargs&include=metadata%2csnapshots&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a3bb6de4-966e-49c6-9ad5-2c67e19e0843" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac5203c-301a-001d-3244-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithargsfileserviceasyncapitestslistshareswithargs269037d568f80Thu, 05 Sep 2019 23:49:38 GMT\"0x8D7325BB6F9CB3E\"2valuefileserviceasyncapitestslistshareswithargs269037d568f81Thu, 05 Sep 2019 23:49:39 GMT\"0x8D7325BB70934A5\"2valuefileserviceasyncapitestslistshareswithargs269037d568f822019-09-05T23:49:39.0000000ZThu, 05 Sep 2019 23:49:39 GMT\"0x8D7325BB7178C75\"2valuefileserviceasyncapitestslistshareswithargs269037d568f82Thu, 05 Sep 2019 23:49:39 GMT\"0x8D7325BB7178C75\"2value", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "a3bb6de4-966e-49c6-9ad5-2c67e19e0843", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithargs269037d568f8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter0.json new file mode 100644 index 000000000000..07a64af63e89 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter0.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter0878169d8720?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "cdc0bf3d-f857-4a17-bcb5-2d16290bdcfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB433F373\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fdf-301a-001d-7344-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:33 GMT", + "x-ms-client-request-id" : "cdc0bf3d-f857-4a17-bcb5-2d16290bdcfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter0878169d8721?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "00c968eb-7edf-4ad9-8707-85e8e2551ec0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB441D614\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fe1-301a-001d-7444-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:33 GMT", + "x-ms-client-request-id" : "00c968eb-7edf-4ad9-8707-85e8e2551ec0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter0878169d8722?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "516374da-a44a-4607-a1a4-11cff272f00d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB44FE01D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fe3-301a-001d-7544-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:33 GMT", + "x-ms-client-request-id" : "516374da-a44a-4607-a1a4-11cff272f00d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "69c4b000-1182-4e75-9899-374755b8a1eb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac51fe5-301a-001d-7644-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithfilterfileserviceasyncapitestslistshareswithfilter0878169d8720Thu, 05 Sep 2019 23:49:34 GMT\"0x8D7325BB433F373\"1fileserviceasyncapitestslistshareswithfilter0878169d8721Thu, 05 Sep 2019 23:49:34 GMT\"0x8D7325BB441D614\"2fileserviceasyncapitestslistshareswithfilter0878169d8722Thu, 05 Sep 2019 23:49:34 GMT\"0x8D7325BB44FE01D\"3", + "Date" : "Thu, 05 Sep 2019 23:49:33 GMT", + "x-ms-client-request-id" : "69c4b000-1182-4e75-9899-374755b8a1eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter0878169d872" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter1.json new file mode 100644 index 000000000000..c2066eccf1a7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter1.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter1695244c4fb0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "16328cc9-83ac-4a4c-bc94-136354a30475" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB4A1F789\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fed-301a-001d-7c44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "16328cc9-83ac-4a4c-bc94-136354a30475" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter1695244c4fb1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "de9b9e22-fc6c-4707-883e-67112782ba80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB4B0C4AB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51fef-301a-001d-7d44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "de9b9e22-fc6c-4707-883e-67112782ba80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter1695244c4fb2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a2d9dbeb-406d-451f-9fee-9155d5ce3699" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB4BEA756\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51ff1-301a-001d-7e44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "a2d9dbeb-406d-451f-9fee-9155d5ce3699" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bb5ad430-35e6-4b64-9ff1-1d76830cd99c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac51ff3-301a-001d-7f44-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithfilterfileserviceasyncapitestslistshareswithfilter1695244c4fb0Thu, 05 Sep 2019 23:49:35 GMT\"0x8D7325BB4A1F789\"1fileserviceasyncapitestslistshareswithfilter1695244c4fb1Thu, 05 Sep 2019 23:49:35 GMT\"0x8D7325BB4B0C4AB\"2fileserviceasyncapitestslistshareswithfilter1695244c4fb2Thu, 05 Sep 2019 23:49:35 GMT\"0x8D7325BB4BEA756\"3value", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "bb5ad430-35e6-4b64-9ff1-1d76830cd99c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter1695244c4fb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter2.json new file mode 100644 index 000000000000..fea4373c0262 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter2.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter2872374be200?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f9cf7c52-5622-418b-a7e5-57b025ee541f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB511D0B0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51ffc-301a-001d-0544-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "f9cf7c52-5622-418b-a7e5-57b025ee541f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter2872374be201?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fcc98891-3f0c-45d8-ac42-2cbef36085b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB51FDA5C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac51ffe-301a-001d-0644-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "fcc98891-3f0c-45d8-ac42-2cbef36085b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter2872374be202?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "301344b2-da84-4078-a0fa-0110a6a52173" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB52DE40C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52000-301a-001d-0744-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:34 GMT", + "x-ms-client-request-id" : "301344b2-da84-4078-a0fa-0110a6a52173" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "22c2b5f6-00a9-43ee-921b-d7e8fee615dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac52002-301a-001d-0844-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithfilterfileserviceasyncapitestslistshareswithfilter2872374be200Thu, 05 Sep 2019 23:49:35 GMT\"0x8D7325BB511D0B0\"1fileserviceasyncapitestslistshareswithfilter2872374be201Thu, 05 Sep 2019 23:49:35 GMT\"0x8D7325BB51FDA5C\"2fileserviceasyncapitestslistshareswithfilter2872374be202Thu, 05 Sep 2019 23:49:35 GMT\"0x8D7325BB52DE40C\"3", + "Date" : "Thu, 05 Sep 2019 23:49:35 GMT", + "x-ms-client-request-id" : "22c2b5f6-00a9-43ee-921b-d7e8fee615dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter2872374be20" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter3.json new file mode 100644 index 000000000000..2edce664e47e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter3.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter330576b2e250?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "364fb6a9-7c73-485e-a4c9-d1f564539eb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB580BF0C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52007-301a-001d-0d44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:35 GMT", + "x-ms-client-request-id" : "364fb6a9-7c73-485e-a4c9-d1f564539eb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter330576b2e251?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d6435f96-116d-4507-8b1b-5ddb8b9a7017" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB58F171F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac52009-301a-001d-0e44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:35 GMT", + "x-ms-client-request-id" : "d6435f96-116d-4507-8b1b-5ddb8b9a7017" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter330576b2e252?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7e74d99d-d400-4ec2-8ed1-156303804207" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325BB59D6F05\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cac5200b-301a-001d-0f44-649f87000000", + "Date" : "Thu, 05 Sep 2019 23:49:35 GMT", + "x-ms-client-request-id" : "7e74d99d-d400-4ec2-8ed1-156303804207" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7420981a-8071-4af2-a1b2-05786071a36e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac5200d-301a-001d-1044-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithfilter2fileserviceasyncapitestslistshareswithfilter330576b2e250Thu, 05 Sep 2019 23:49:36 GMT\"0x8D7325BB580BF0C\"1fileserviceasyncapitestslistshareswithfilter330576b2e251Thu, 05 Sep 2019 23:49:36 GMT\"0x8D7325BB58F171F\"2/gapradev/fileserviceasyncapitestslistshareswithfilter330576b2e252", + "Date" : "Thu, 05 Sep 2019 23:49:35 GMT", + "x-ms-client-request-id" : "7420981a-8071-4af2-a1b2-05786071a36e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&marker=/gapradev/fileserviceasyncapitestslistshareswithfilter330576b2e252&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5ddd5606-42b8-4d38-aa46-4844125b14c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac5200e-301a-001d-1144-649f87000000", + "Body" : "fileserviceasyncapitestslistshareswithfilter/gapradev/fileserviceasyncapitestslistshareswithfilter330576b2e2522fileserviceasyncapitestslistshareswithfilter330576b2e252Thu, 05 Sep 2019 23:49:36 GMT\"0x8D7325BB59D6F05\"3", + "Date" : "Thu, 05 Sep 2019 23:49:35 GMT", + "x-ms-client-request-id" : "5ddd5606-42b8-4d38-aa46-4844125b14c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter330576b2e25" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetProperties.json new file mode 100644 index 000000000000..59341d6ce4c2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetProperties.json @@ -0,0 +1,67 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3484ae0b-a536-48b0-a6bc-c53d4e9a2933" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac52041-301a-001d-3744-649f87000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "3484ae0b-a536-48b0-a6bc-c53d4e9a2933", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2ae27e6a-85e1-4153-a46d-3f177b326006" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac52042-301a-001d-3844-649f87000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "2ae27e6a-85e1-4153-a46d-3f177b326006", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dd882788-26fe-4369-8f9e-cc34ed620b77" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cac52043-301a-001d-3944-649f87000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 05 Sep 2019 23:49:38 GMT", + "x-ms-client-request-id" : "dd882788-26fe-4369-8f9e-cc34ed620b77", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestssetandgetproperties03725027b79" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs0.json new file mode 100644 index 000000000000..6740520f8c53 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs0.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0a1ec6c9-6678-450b-a5aa-10cb7902d547", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "cac52045-301a-001d-3b44-649f87000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:cac52045-301a-001d-3b44-649f87000000\nTime:2019-09-05T23:49:40.2621164Z00", + "Date" : "Thu, 05 Sep 2019 23:49:39 GMT", + "x-ms-client-request-id" : "0a1ec6c9-6678-450b-a5aa-10cb7902d547", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "bf326240502f482a978eb5c867073087c961dab2476c4a298fe50b6f5800dac1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs1.json new file mode 100644 index 000000000000..a150236a7545 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs1.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f82e220e-7e87-4d13-8fbe-79ef4af6a259", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "cac52047-301a-001d-3d44-649f87000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:cac52047-301a-001d-3d44-649f87000000\nTime:2019-09-05T23:49:40.4331182Z00", + "Date" : "Thu, 05 Sep 2019 23:49:39 GMT", + "x-ms-client-request-id" : "f82e220e-7e87-4d13-8fbe-79ef4af6a259", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "5a4ceac595fb4a149d876577b54642a996b2389cef5f40d494e839a3d4dd2944" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs2.json new file mode 100644 index 000000000000..823e7567c3f4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs2.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "20da3609-c5f4-48a5-9683-9201b93d0c5f", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "cac5204a-301a-001d-3f44-649f87000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:cac5204a-301a-001d-3f44-649f87000000\nTime:2019-09-05T23:49:40.5961190Z00", + "Date" : "Thu, 05 Sep 2019 23:49:39 GMT", + "x-ms-client-request-id" : "20da3609-c5f4-48a5-9683-9201b93d0c5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "3df015f6ccbf47448d697c0c1c6a246efda1a9208b774e88ae5eeb170424a59e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs3.json new file mode 100644 index 000000000000..1204c6f95443 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs3.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b09742bb-f5b9-4b32-87c9-eb058666d662", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "cac5204f-301a-001d-4344-649f87000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:cac5204f-301a-001d-4344-649f87000000\nTime:2019-09-05T23:49:40.7611215Z00", + "Date" : "Thu, 05 Sep 2019 23:49:39 GMT", + "x-ms-client-request-id" : "b09742bb-f5b9-4b32-87c9-eb058666d662", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "3d5c46d4514e468aa6e15bf70cf4d8b8839be4b75fd34db4a6c730426c7770b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs4.json new file mode 100644 index 000000000000..b2d0de9cf8c1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs4.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c0932b50-0bdd-4453-80b0-9e7939781458", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlNodeValue", + "retry-after" : "0", + "Content-Length" : "340", + "StatusCode" : "400", + "x-ms-request-id" : "cac52051-301a-001d-4544-649f87000000", + "Body" : "InvalidXmlNodeValueThe value for one of the XML nodes is not in the correct format.\nRequestId:cac52051-301a-001d-4544-649f87000000\nTime:2019-09-05T23:49:40.9861252ZAllowedMethodsNOTAREALHTTPMETHOD", + "Date" : "Thu, 05 Sep 2019 23:49:40 GMT", + "x-ms-client-request-id" : "c0932b50-0bdd-4453-80b0-9e7939781458", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "00bb0c7a7a1a45f0ab9d2f23dd6c3a84435060c054384b9e8b9914e0d48d0876" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateAndGetPermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateAndGetPermission.json new file mode 100644 index 000000000000..7e6d613dabff --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateAndGetPermission.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreateandgetpermission7969590a6a831ff?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7136c21f-205d-4d67-8d60-edc0024c12ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7A1CEB92\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b3e-301a-000d-0144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:56 GMT", + "x-ms-client-request-id" : "7136c21f-205d-4d67-8d60-edc0024c12ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreateandgetpermission7969590a6a831ff?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bf52f646-d987-4da6-82b5-2d3594361458", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b40-301a-000d-0244-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:56 GMT", + "x-ms-client-request-id" : "bf52f646-d987-4da6-82b5-2d3594361458" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreateandgetpermission7969590a6a831ff?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b387a862-9e9b-49e4-b02e-bfdde77e1581" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "200", + "x-ms-request-id" : "07339b41-301a-000d-0344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:56 GMT", + "x-ms-client-request-id" : "b387a862-9e9b-49e4-b02e-bfdde77e1581" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreateandgetpermission7969590a6a831ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectory.json new file mode 100644 index 000000000000..7e3980892c12 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectory.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectory69240b2c950346ae64?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2b4b3a1b-6271-431d-9c33-1c7f3182898f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B74E8AA8E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339aab-301a-000d-0f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:47 GMT", + "x-ms-client-request-id" : "2b4b3a1b-6271-431d-9c33-1c7f3182898f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectory69240b2c950346ae64/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d59f5f6c-9fc2-4be0-a923-b3d3eed13a5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:48.2121650Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:47 GMT", + "ETag" : "\"0x8D7325B74F949B2\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:48.2121650Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339aad-301a-000d-1044-645aef000000", + "x-ms-client-request-id" : "d59f5f6c-9fc2-4be0-a923-b3d3eed13a5d", + "x-ms-file-last-write-time" : "2019-09-05T23:47:48.2121650Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectory69240b2c950346ae64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryFilePermission.json new file mode 100644 index 000000000000..6bf9751eabc6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryFilePermission.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryfilepermission26910b8180a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2496a6b4-5d38-44ba-8a2b-f93ef7ad087e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B752676FC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ab1-301a-000d-1344-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:48 GMT", + "x-ms-client-request-id" : "2496a6b4-5d38-44ba-8a2b-f93ef7ad087e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryfilepermission26910b8180a/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6a3ed8a6-ddde-4309-85fa-e5cb96cc0eec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:48.6081761Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:48 GMT", + "ETag" : "\"0x8D7325B7535B6E1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:48.6081761Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ab4-301a-000d-1544-645aef000000", + "x-ms-client-request-id" : "6a3ed8a6-ddde-4309-85fa-e5cb96cc0eec", + "x-ms-file-last-write-time" : "2019-09-05T23:47:48.6081761Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectoryfilepermission26910b8180a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryFilePermissionKey.json new file mode 100644 index 000000000000..4d0a2848fd42 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryFilePermissionKey.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryfilepermissionkey5689207ce5?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a8eb3bd3-b9c9-46e6-a392-93cd8f39f427" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B75604BC0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ab8-301a-000d-1944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:48 GMT", + "x-ms-client-request-id" : "a8eb3bd3-b9c9-46e6-a392-93cd8f39f427" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryfilepermissionkey5689207ce5?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "237aa803-f5ea-4958-aa39-da34a095651f", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339aba-301a-000d-1a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:48 GMT", + "x-ms-client-request-id" : "237aa803-f5ea-4958-aa39-da34a095651f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryfilepermissionkey5689207ce5/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c841e016-843f-4a2d-a123-abc973a668bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:49.0460000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:48 GMT", + "ETag" : "\"0x8D7325B75788560\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:49.0460000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339abb-301a-000d-1b44-645aef000000", + "x-ms-client-request-id" : "c841e016-843f-4a2d-a123-abc973a668bf", + "x-ms-file-last-write-time" : "2019-09-05T23:47:49.0470000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectoryfilepermissionkey5689207ce5", "2019-09-05T23:47:49.046Z", "2019-09-05T23:47:49.047Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryInvalidName.json new file mode 100644 index 000000000000..3e2029813f67 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryInvalidName.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryinvalidname20502e9e86b97?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "53c41a64-fdb0-422a-a665-0342e3d131e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B75AC701B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339abe-301a-000d-1e44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:48 GMT", + "x-ms-client-request-id" : "53c41a64-fdb0-422a-a665-0342e3d131e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectoryinvalidname20502e9e86b97/test%2fdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5c301a8f-0d4a-48d3-af75-31bd6a3fcdaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "07339ac0-301a-000d-1f44-645aef000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:07339ac0-301a-000d-1f44-645aef000000\nTime:2019-09-05T23:47:49.5172418Z", + "Date" : "Thu, 05 Sep 2019 23:47:49 GMT", + "x-ms-client-request-id" : "5c301a8f-0d4a-48d3-af75-31bd6a3fcdaa", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectoryinvalidname20502e9e86b97" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadata.json new file mode 100644 index 000000000000..12bfed848ff8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadata.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectorymetadata36614110c1b5fe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "15492ddf-3f93-4994-9c57-e4e82762a0b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B75EB26EE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ac7-301a-000d-2444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:49 GMT", + "x-ms-client-request-id" : "15492ddf-3f93-4994-9c57-e4e82762a0b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectorymetadata36614110c1b5fe/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0bd1f083-353f-4524-b029-06139dfa31d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:49.9002076Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:49 GMT", + "ETag" : "\"0x8D7325B75FADCDC\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:49.9002076Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ac9-301a-000d-2544-645aef000000", + "x-ms-client-request-id" : "0bd1f083-353f-4524-b029-06139dfa31d6", + "x-ms-file-last-write-time" : "2019-09-05T23:47:49.9002076Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectorymetadata36614110c1b5fe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadataError.json new file mode 100644 index 000000000000..1f3d1c449434 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadataError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectorymetadataerror48325cbc476f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "121875c8-00b6-478d-9640-5ecdd00f3488" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B762597ED\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339acd-301a-000d-2944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:49 GMT", + "x-ms-client-request-id" : "121875c8-00b6-478d-9640-5ecdd00f3488" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatedirectorymetadataerror48325cbc476f/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8c2b5803-26bd-41ed-ba0a-6eee4223929c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339ad0-301a-000d-2b44-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339ad0-301a-000d-2b44-645aef000000\nTime:2019-09-05T23:47:50.2712517Zvalue", + "Date" : "Thu, 05 Sep 2019 23:47:49 GMT", + "x-ms-client-request-id" : "8c2b5803-26bd-41ed-ba0a-6eee4223929c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectorymetadataerror48325cbc476f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFile.json new file mode 100644 index 000000000000..85d46db1a85b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFile.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefileshareapitestscreatefile5787456639d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "04014342-f16f-4400-9fb7-3f12f4d9f687" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B765E3435\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ad5-301a-000d-2f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:50 GMT", + "x-ms-client-request-id" : "04014342-f16f-4400-9fb7-3f12f4d9f687" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefileshareapitestscreatefile5787456639d/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b83ed325-4c9a-4af9-8f58-d25f8172279b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:50.6722285Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:50 GMT", + "ETag" : "\"0x8D7325B7670A9ED\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:50.6722285Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ad8-301a-000d-3044-645aef000000", + "x-ms-client-request-id" : "b83ed325-4c9a-4af9-8f58-d25f8172279b", + "x-ms-file-last-write-time" : "2019-09-05T23:47:50.6722285Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefileshareapitestscreatefile5787456639d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileFilePermission.json new file mode 100644 index 000000000000..2eed2d9db9ab --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileFilePermission.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilefilepermission253973ea18e678?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5c22e3b9-fa31-471f-99d5-f3abd237032b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B769EE6CB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ade-301a-000d-3544-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:50 GMT", + "x-ms-client-request-id" : "5c22e3b9-fa31-471f-99d5-f3abd237032b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilefilepermission253973ea18e678/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "84a91c82-74d2-4b47-9a7a-d55ae420381b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:51.0912386Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:50 GMT", + "ETag" : "\"0x8D7325B76B09982\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:51.0912386Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ae0-301a-000d-3644-645aef000000", + "x-ms-client-request-id" : "84a91c82-74d2-4b47-9a7a-d55ae420381b", + "x-ms-file-last-write-time" : "2019-09-05T23:47:51.0912386Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilefilepermission253973ea18e678" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileFilePermissionKey.json new file mode 100644 index 000000000000..297c7d162e91 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileFilePermissionKey.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilefilepermissionkey241011fbc476?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "74aac69a-f2d0-4bb2-a85d-c5fc6957bb64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B76DCB335\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ae4-301a-000d-3a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:50 GMT", + "x-ms-client-request-id" : "74aac69a-f2d0-4bb2-a85d-c5fc6957bb64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilefilepermissionkey241011fbc476?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8de86c00-0a82-4823-8cb5-18e78eae5a6c", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339ae6-301a-000d-3b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:51 GMT", + "x-ms-client-request-id" : "8de86c00-0a82-4823-8cb5-18e78eae5a6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilefilepermissionkey241011fbc476/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "276d316d-9636-47f4-beef-19468fe5ad10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:51.5410000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:51 GMT", + "ETag" : "\"0x8D7325B76F53A50\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:51.5410000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339ae7-301a-000d-3c44-645aef000000", + "x-ms-client-request-id" : "276d316d-9636-47f4-beef-19468fe5ad10", + "x-ms-file-last-write-time" : "2019-09-05T23:47:51.5410000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilefilepermissionkey241011fbc476", "2019-09-05T23:47:51.541Z", "2019-09-05T23:47:51.541Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..51b5ab91266b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefileinvalidargs0440137290772fb8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "13f7911e-77da-4642-ac2c-c5a253183346" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B772AD36E\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339aeb-301a-000d-4044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:51 GMT", + "x-ms-client-request-id" : "13f7911e-77da-4642-ac2c-c5a253183346" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefileinvalidargs0440137290772fb8/testfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9c14330f-0ba7-41c5-913f-9ab8bde1306f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "07339aee-301a-000d-4244-645aef000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:07339aee-301a-000d-4244-645aef000000\nTime:2019-09-05T23:47:51.9972615Z", + "Date" : "Thu, 05 Sep 2019 23:47:51 GMT", + "x-ms-client-request-id" : "9c14330f-0ba7-41c5-913f-9ab8bde1306f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefileinvalidargs0440137290772fb8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..4fe2d26573a8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefileinvalidargs1625436b6b15959a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c647ff2e-82a8-4efb-8cc3-a08f321d7366" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B77671945\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339af2-301a-000d-4544-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:51 GMT", + "x-ms-client-request-id" : "c647ff2e-82a8-4efb-8cc3-a08f321d7366" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefileinvalidargs1625436b6b15959a/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4a9167f5-0fa1-475f-b63a-31b5dfb18b12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "07339af5-301a-000d-4744-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:07339af5-301a-000d-4744-645aef000000\nTime:2019-09-05T23:47:52.3802599Z", + "Date" : "Thu, 05 Sep 2019 23:47:51 GMT", + "x-ms-client-request-id" : "4a9167f5-0fa1-475f-b63a-31b5dfb18b12", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefileinvalidargs1625436b6b15959a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..b19304b6e9d8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverload.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverload36091533ad7826f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "34253138-cd1d-4251-9333-ea21c3ca34ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B779EF22F\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339af9-301a-000d-4b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:52 GMT", + "x-ms-client-request-id" : "34253138-cd1d-4251-9333-ea21c3ca34ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverload36091533ad7826f/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1d6767b9-d055-4718-a20c-9f3e160c2940" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:52.7130000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:52 GMT", + "ETag" : "\"0x8D7325B77A80F90\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:52.7130000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339afb-301a-000d-4c44-645aef000000", + "x-ms-client-request-id" : "1d6767b9-d055-4718-a20c-9f3e160c2940", + "x-ms-file-last-write-time" : "2019-09-05T23:47:52.7130000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverload36091533ad7826f", "2019-09-05T23:47:52.713Z", "2019-09-05T23:47:52.713Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..6b7ff3edafaf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs098747e07e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7d3d6580-b01e-4a28-80e2-d4eb9d1bd5e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B77DAC2BF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339aff-301a-000d-5044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:52 GMT", + "x-ms-client-request-id" : "7d3d6580-b01e-4a28-80e2-d4eb9d1bd5e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs098747e07e/testfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1a6e93f9-267f-46bb-a268-5e84989747da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "07339b01-301a-000d-5144-645aef000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:07339b01-301a-000d-5144-645aef000000\nTime:2019-09-05T23:47:53.1522725Z", + "Date" : "Thu, 05 Sep 2019 23:47:52 GMT", + "x-ms-client-request-id" : "1a6e93f9-267f-46bb-a268-5e84989747da", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs098747e07e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..495d25dee86e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs15641503f0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fc01891d-011c-4758-9057-6c5f0c58de64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7813AD30\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b08-301a-000d-5744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:52 GMT", + "x-ms-client-request-id" : "fc01891d-011c-4758-9057-6c5f0c58de64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs15641503f0/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "435a85d2-8a98-4d33-a4a8-2d1e216c851c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "07339b0a-301a-000d-5844-645aef000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:07339b0a-301a-000d-5844-645aef000000\nTime:2019-09-05T23:47:53.5112699Z", + "Date" : "Thu, 05 Sep 2019 23:47:53 GMT", + "x-ms-client-request-id" : "435a85d2-8a98-4d33-a4a8-2d1e216c851c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs15641503f0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..9275997a2934 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs220457d3c5?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "93dbffac-f73b-4c3b-9264-06ccc449a046" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B784AE9DF\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b0d-301a-000d-5b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:53 GMT", + "x-ms-client-request-id" : "93dbffac-f73b-4c3b-9264-06ccc449a046" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs220457d3c5/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8377815c-8246-49a4-af6f-4ceee48dd07c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "310", + "StatusCode" : "400", + "x-ms-request-id" : "07339b0f-301a-000d-5c44-645aef000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:07339b0f-301a-000d-5c44-645aef000000\nTime:2019-09-05T23:47:53.8722718Zx-ms-content-md5", + "Date" : "Thu, 05 Sep 2019 23:47:53 GMT", + "x-ms-client-request-id" : "8377815c-8246-49a4-af6f-4ceee48dd07c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs220457d3c5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..9279fdd6a620 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs316741ef6a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a3247246-9df1-4f65-98ea-4dbc664ac76e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7881D869\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b13-301a-000d-6044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:53 GMT", + "x-ms-client-request-id" : "a3247246-9df1-4f65-98ea-4dbc664ac76e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs316741ef6a/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "589d92ba-5361-42ae-a93b-42f39f827a86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339b15-301a-000d-6144-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339b15-301a-000d-6144-645aef000000\nTime:2019-09-05T23:47:54.2302719Zvalue", + "Date" : "Thu, 05 Sep 2019 23:47:53 GMT", + "x-ms-client-request-id" : "589d92ba-5361-42ae-a93b-42f39f827a86", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs316741ef6a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreatePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreatePermission.json new file mode 100644 index 000000000000..499699a20b24 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreatePermission.json @@ -0,0 +1,46 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatepermission687090cfed88c53b04?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a1c47155-2b5e-4e1e-9deb-48f98d8e9ec9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B79C41D15\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b38-301a-000d-7c44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:55 GMT", + "x-ms-client-request-id" : "a1c47155-2b5e-4e1e-9deb-48f98d8e9ec9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatepermission687090cfed88c53b04?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b1894513-ea94-4b13-8515-93b28f9a31f0", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b3a-301a-000d-7d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:55 GMT", + "x-ms-client-request-id" : "b1894513-ea94-4b13-8515-93b28f9a31f0" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatepermission687090cfed88c53b04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreatePermissionError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreatePermissionError.json new file mode 100644 index 000000000000..9042a1311b62 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreatePermissionError.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatepermissionerror00485765b2da701?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fbd0d515-2f67-4a95-a5b4-d0a1a61b6f1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7A636AA0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b45-301a-000d-0644-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:56 GMT", + "x-ms-client-request-id" : "fbd0d515-2f67-4a95-a5b4-d0a1a61b6f1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatepermissionerror00485765b2da701?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d6198266-c8b2-45c6-88c9-42e300b505b5", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "FileInvalidPermission", + "retry-after" : "0", + "Content-Length" : "233", + "StatusCode" : "400", + "x-ms-request-id" : "07339b48-301a-000d-0844-645aef000000", + "Body" : "FileInvalidPermissionThe specified file permission is not valid.\nRequestId:07339b48-301a-000d-0844-645aef000000\nTime:2019-09-05T23:47:57.6973001Z", + "Date" : "Thu, 05 Sep 2019 23:47:57 GMT", + "x-ms-client-request-id" : "d6198266-c8b2-45c6-88c9-42e300b505b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatepermissionerror00485765b2da701" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShare.json new file mode 100644 index 000000000000..d53fa0ba9889 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShare.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreateshareshareapitestscreatesharee0a37945ff?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b630ca32-2bcd-48a6-ab55-cff88bc56205" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B718AD812\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a3e-301a-000d-3944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:42 GMT", + "x-ms-client-request-id" : "b630ca32-2bcd-48a6-ab55-cff88bc56205" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreateshareshareapitestscreatesharee0a37945ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs0.json new file mode 100644 index 000000000000..6a78d1147cca --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithargs07477526b0aa2adc4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6767f782-90cd-4ca0-9ac5-bb2b2dfad956" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B71B62DCB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a43-301a-000d-3d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:42 GMT", + "x-ms-client-request-id" : "6767f782-90cd-4ca0-9ac5-bb2b2dfad956" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs07477526b0aa2adc4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs1.json new file mode 100644 index 000000000000..324ee623de94 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithargs1069840c11fd91cdc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f639c8fd-d423-4182-9bfa-6fcee332c2b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B71E183AE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a48-301a-000d-4144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:42 GMT", + "x-ms-client-request-id" : "f639c8fd-d423-4182-9bfa-6fcee332c2b0" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs1069840c11fd91cdc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs2.json new file mode 100644 index 000000000000..80d5f836dbff --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithargs2564335d0e74e6638?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8567a96b-d663-422e-b98e-fa2e38591593" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B720C6452\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a4c-301a-000d-4444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:42 GMT", + "x-ms-client-request-id" : "8567a96b-d663-422e-b98e-fa2e38591593" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs2564335d0e74e6638" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs3.json new file mode 100644 index 000000000000..ddafca8e4374 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs3.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithargs3632530f0d3f93044?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "24e480c0-411d-4f56-9b96-42e371868253" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B72387D92\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a52-301a-000d-4944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:43 GMT", + "x-ms-client-request-id" : "24e480c0-411d-4f56-9b96-42e371868253" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs3632530f0d3f93044" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..3da5460e6f42 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithinvalidargs0748470e76c2f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e16dcd26-7256-474a-948f-2a406f74e167" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339a57-301a-000d-4d44-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339a57-301a-000d-4d44-645aef000000\nTime:2019-09-05T23:47:43.8792039Zvalue", + "Date" : "Thu, 05 Sep 2019 23:47:43 GMT", + "x-ms-client-request-id" : "e16dcd26-7256-474a-948f-2a406f74e167", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithinvalidargs0748470e76c2f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..dee08fb8716a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithinvalidargs1300840c5640c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b6343d32-cf7c-4ed4-9d24-c8d0f1667e02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "07339a59-301a-000d-4f44-645aef000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:07339a59-301a-000d-4f44-645aef000000\nTime:2019-09-05T23:47:44.0472109Z", + "Date" : "Thu, 05 Sep 2019 23:47:43 GMT", + "x-ms-client-request-id" : "b6343d32-cf7c-4ed4-9d24-c8d0f1667e02", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithinvalidargs1300840c5640c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs2.json new file mode 100644 index 000000000000..a3f63f9e6759 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs2.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesharewithinvalidargs207526684cc61?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "da3cd09a-5032-44b9-83c9-350f680d7858" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "07339a5c-301a-000d-5244-645aef000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:07339a5c-301a-000d-5244-645aef000000\nTime:2019-09-05T23:47:44.2182062Zx-ms-share-quota6000", + "Date" : "Thu, 05 Sep 2019 23:47:43 GMT", + "x-ms-client-request-id" : "da3cd09a-5032-44b9-83c9-350f680d7858", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithinvalidargs207526684cc61" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshot.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshot.json new file mode 100644 index 000000000000..781845b5a80d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshot.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesnapshot349292a64ae0f4ed940?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3d515be0-085c-47ca-bb2f-6865691cc849" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B72B37A18\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a61-301a-000d-5744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:43 GMT", + "x-ms-client-request-id" : "3d515be0-085c-47ca-bb2f-6865691cc849" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesnapshot349292a64ae0f4ed940?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "130ba502-87e5-441a-9b06-a0e32ad62d4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:47:44.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B72B37A18\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a64-301a-000d-5944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:44 GMT", + "x-ms-client-request-id" : "130ba502-87e5-441a-9b06-a0e32ad62d4e" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshot349292a64ae0f4ed940", "shareapitestscreatesnapshot67388863c9bcfe24f48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotError.json new file mode 100644 index 000000000000..8b1d556ef5b2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesnapshoterror9199087cac47356c?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "66977376-fe3c-4eb3-867f-bf3a492f507c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "07339a6a-301a-000d-5d44-645aef000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:07339a6a-301a-000d-5d44-645aef000000\nTime:2019-09-05T23:47:44.8732116Z", + "Date" : "Thu, 05 Sep 2019 23:47:44 GMT", + "x-ms-client-request-id" : "66977376-fe3c-4eb3-867f-bf3a492f507c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshoterror9199087cac47356c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadata.json new file mode 100644 index 000000000000..8e166aa78a9b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadata.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesnapshotmetadata2098978cc3e63ba?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f80a44ec-6cae-4f88-abba-576bc82d99ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B73180875\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a73-301a-000d-6044-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:44 GMT", + "x-ms-client-request-id" : "f80a44ec-6cae-4f88-abba-576bc82d99ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesnapshotmetadata2098978cc3e63ba?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "dacd2980-c3df-4b26-af5a-38348f594128" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:47:45.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B730F2680\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a76-301a-000d-6244-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:44 GMT", + "x-ms-client-request-id" : "dacd2980-c3df-4b26-af5a-38348f594128" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshotmetadata2098978cc3e63ba", "shareapitestscreatesnapshotmetadata36767f7e5acc568" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadataError.json new file mode 100644 index 000000000000..04b0f90fb10b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadataError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestscreatesnapshotmetadataerror152119f414a6?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e3b6ef7b-6785-4adc-88bc-3d143ee93587" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "07339a79-301a-000d-6544-645aef000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:07339a79-301a-000d-6544-645aef000000\nTime:2019-09-05T23:47:45.4382130Zvalue", + "Date" : "Thu, 05 Sep 2019 23:47:44 GMT", + "x-ms-client-request-id" : "e3b6ef7b-6785-4adc-88bc-3d143ee93587", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshotmetadataerror152119f414a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..af164cc8a182 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectory.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletedirectory823972b34df3a431c4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "762096f9-0c24-42c2-95ca-979e91429286" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B78B93C75\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b18-301a-000d-6444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:54 GMT", + "x-ms-client-request-id" : "762096f9-0c24-42c2-95ca-979e91429286" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletedirectory823972b34df3a431c4/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8b0b39b0-cf12-4b58-bf50-8ad9f1559add" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:54.6183366Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:54 GMT", + "ETag" : "\"0x8D7325B78CACAC6\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:47:54.6183366Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b1b-301a-000d-6644-645aef000000", + "x-ms-client-request-id" : "8b0b39b0-cf12-4b58-bf50-8ad9f1559add", + "x-ms-file-last-write-time" : "2019-09-05T23:47:54.6183366Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletedirectory823972b34df3a431c4/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "94ce229d-a326-4165-8c03-95c7955364e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339b1d-301a-000d-6744-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:54 GMT", + "x-ms-client-request-id" : "94ce229d-a326-4165-8c03-95c7955364e2" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletedirectory823972b34df3a431c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..abc7e78e8130 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectoryError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletedirectoryerror78144f29117967fd?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e234476c-596b-41e2-984f-f5ff6151aba4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B79051275\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b22-301a-000d-6b44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:54 GMT", + "x-ms-client-request-id" : "e234476c-596b-41e2-984f-f5ff6151aba4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletedirectoryerror78144f29117967fd/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e6ea9851-9cf9-4c11-9248-ac9610c625cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339b24-301a-000d-6c44-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339b24-301a-000d-6c44-645aef000000\nTime:2019-09-05T23:47:55.0992814Z", + "Date" : "Thu, 05 Sep 2019 23:47:54 GMT", + "x-ms-client-request-id" : "e6ea9851-9cf9-4c11-9248-ac9610c625cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletedirectoryerror78144f29117967fd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFile.json new file mode 100644 index 000000000000..82f48fc0d08f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFile.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletefileshareapitestsdeletefile48d92148fb2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d2224faa-749a-494b-a503-0ac2e7760dac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B793EC03B\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b27-301a-000d-6f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:54 GMT", + "x-ms-client-request-id" : "d2224faa-749a-494b-a503-0ac2e7760dac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletefileshareapitestsdeletefile48d92148fb2/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e2101e85-0ec3-4af4-bc86-105e7ceace58" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:47:55.4853564Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:47:55 GMT", + "ETag" : "\"0x8D7325B794F16BC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:47:55.4853564Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "07339b29-301a-000d-7044-645aef000000", + "x-ms-client-request-id" : "e2101e85-0ec3-4af4-bc86-105e7ceace58", + "x-ms-file-last-write-time" : "2019-09-05T23:47:55.4853564Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletefileshareapitestsdeletefile48d92148fb2/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "08fdee8c-6c11-414e-9cfa-6d1d2cd40995" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339b2a-301a-000d-7144-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:55 GMT", + "x-ms-client-request-id" : "08fdee8c-6c11-414e-9cfa-6d1d2cd40995" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletefileshareapitestsdeletefile48d92148fb2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFileError.json new file mode 100644 index 000000000000..6e1946116dc7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFileError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletefileerror47379ee9c8ba111094?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "26948e34-7329-44c0-9f4f-e9f15d4775aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B798A4832\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b31-301a-000d-7644-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:55 GMT", + "x-ms-client-request-id" : "26948e34-7329-44c0-9f4f-e9f15d4775aa" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeletefileerror47379ee9c8ba111094/testdirectory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "287b7bdb-6b17-4bf6-bd0c-d71984de5080" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "07339b33-301a-000d-7744-645aef000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:07339b33-301a-000d-7744-645aef000000\nTime:2019-09-05T23:47:55.9812859Z", + "Date" : "Thu, 05 Sep 2019 23:47:55 GMT", + "x-ms-client-request-id" : "287b7bdb-6b17-4bf6-bd0c-d71984de5080", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletefileerror47379ee9c8ba111094" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShare.json new file mode 100644 index 000000000000..50a058b22ef3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShare.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeleteshareshareapitestsdeleteshare72a48584bc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f0a7331e-9598-46e5-a95c-4c4d11267ab4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B736CDF59\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a7c-301a-000d-6844-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:45 GMT", + "x-ms-client-request-id" : "f0a7331e-9598-46e5-a95c-4c4d11267ab4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeleteshareshareapitestsdeleteshare72a48584bc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b85b714d-50a1-4689-8289-4fd0b8596672" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07339a7f-301a-000d-6a44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:45 GMT", + "x-ms-client-request-id" : "b85b714d-50a1-4689-8289-4fd0b8596672" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeleteshareshareapitestsdeleteshare72a48584bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShareError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShareError.json new file mode 100644 index 000000000000..6aca26ef6cee --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShareError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsdeleteshareerror57547f0f5e617ca4f4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4a1bf2ab-8ae7-4e15-b76e-cd37bd78387a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "07339a82-301a-000d-6d44-645aef000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:07339a82-301a-000d-6d44-645aef000000\nTime:2019-09-05T23:47:45.8922189Z", + "Date" : "Thu, 05 Sep 2019 23:47:45 GMT", + "x-ms-client-request-id" : "4a1bf2ab-8ae7-4e15-b76e-cd37bd78387a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeleteshareerror57547f0f5e617ca4f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetFileClientDoesNotCreateAFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetFileClientDoesNotCreateAFile.json new file mode 100644 index 000000000000..a398f1579374 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetFileClientDoesNotCreateAFile.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetfileclientdoesnotcreateafile515945a738" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPermissionError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPermissionError.json new file mode 100644 index 000000000000..c8d0e15a6dc0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPermissionError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsgetpermissionerror378622411ab369d51?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "13cc7d7b-bf8e-4566-8d30-5f7ff9bacb68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7ACCB3E9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339b4d-301a-000d-0d44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:57 GMT", + "x-ms-client-request-id" : "13cc7d7b-bf8e-4566-8d30-5f7ff9bacb68" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsgetpermissionerror378622411ab369d51?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0917050a-8940-4f64-b211-25b30f9c4a69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "335", + "StatusCode" : "400", + "x-ms-request-id" : "07339b50-301a-000d-0f44-645aef000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:07339b50-301a-000d-0f44-645aef000000\nTime:2019-09-05T23:47:58.0802994Zx-ms-file-permission-keyabcde", + "Date" : "Thu, 05 Sep 2019 23:47:57 GMT", + "x-ms-client-request-id" : "0917050a-8940-4f64-b211-25b30f9c4a69", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsgetpermissionerror378622411ab369d51" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetProperties.json new file mode 100644 index 000000000000..a8fcf6b77cb6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetProperties.json @@ -0,0 +1,50 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsgetproperties207829418f51af7c547?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "09714f87-54f6-4621-ab85-c21765018436" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B73B18999\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a84-301a-000d-6f44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:45 GMT", + "x-ms-client-request-id" : "09714f87-54f6-4621-ab85-c21765018436" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsgetproperties207829418f51af7c547?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "18554677-f9fd-4418-8e17-cc39769a0f7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:45 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "1", + "ETag" : "\"0x8D7325B73B18999\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-testmetadata" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "07339a89-301a-000d-7144-645aef000000", + "x-ms-client-request-id" : "18554677-f9fd-4418-8e17-cc39769a0f7d" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsgetproperties207829418f51af7c547" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..adb41d8f44f0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPropertiesError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestsgetpropertieserror05753084a776de9bb?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ba313c5d-22e3-4fb5-a707-348f5853758f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "07339a8e-301a-000d-7644-645aef000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:07339a8e-301a-000d-7644-645aef000000\nTime:2019-09-05T23:47:46.4452212Z", + "Date" : "Thu, 05 Sep 2019 23:47:45 GMT", + "x-ms-client-request-id" : "ba313c5d-22e3-4fb5-a707-348f5853758f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsgetpropertieserror05753084a776de9bb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetRootDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetRootDirectoryClient.json new file mode 100644 index 000000000000..af9004aa7f19 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetRootDirectoryClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetrootdirectoryclient16271812203e2b0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetShareURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetShareURL.json new file mode 100644 index 000000000000..a14cb5716830 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetShareURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetshareurlshareapitestsgetshareurl6c326282d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..cc9b38011237 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetSnapshotId.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetsnapshotid899338310a538faf84c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadata.json new file mode 100644 index 000000000000..300efbba419a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadata.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadataa6c62676f0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "5fa6ae49-5c2e-4f0b-9084-35f48ef37e11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7473A1AC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a9f-301a-000d-0444-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-client-request-id" : "5fa6ae49-5c2e-4f0b-9084-35f48ef37e11" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadataa6c62676f0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "75ea9bd2-f13b-4bc6-91f7-3460816de740" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "5120", + "ETag" : "\"0x8D7325B7473A1AC\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-testmetadata" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "07339aa1-301a-000d-0544-645aef000000", + "x-ms-client-request-id" : "75ea9bd2-f13b-4bc6-91f7-3460816de740" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadataa6c62676f0?restype=share&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "16a80e91-bd08-476f-bcf2-5b75d6452926" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B748E3244\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339aa2-301a-000d-0644-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:47 GMT", + "x-ms-client-request-id" : "16a80e91-bd08-476f-bcf2-5b75d6452926" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadataa6c62676f0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6965a8d8-db99-485e-944b-3f29ab9ab280" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:47 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "5120", + "ETag" : "\"0x8D7325B748E3244\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-afterset" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "07339aa3-301a-000d-0744-645aef000000", + "x-ms-client-request-id" : "6965a8d8-db99-485e-944b-3f29ab9ab280" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetmetadatashareapitestssetmetadataa6c62676f0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadataError.json new file mode 100644 index 000000000000..a9cb7bd5e221 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadataError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetmetadataerror961822c03d42d25c54?restype=share&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f2e28875-1953-42ac-b68b-4ed28c3712bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "07339aa8-301a-000d-0c44-645aef000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:07339aa8-301a-000d-0c44-645aef000000\nTime:2019-09-05T23:47:47.9242331Z", + "Date" : "Thu, 05 Sep 2019 23:47:47 GMT", + "x-ms-client-request-id" : "f2e28875-1953-42ac-b68b-4ed28c3712bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetmetadataerror961822c03d42d25c54" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuota.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuota.json new file mode 100644 index 000000000000..eea81a8a164c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuota.json @@ -0,0 +1,94 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetquotashareapitestssetquota8ff0477956e4a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d292b5ad-a615-4332-a574-8b1b77ec42d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7405EB2D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07339a92-301a-000d-7944-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-client-request-id" : "d292b5ad-a615-4332-a574-8b1b77ec42d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetquotashareapitestssetquota8ff0477956e4a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "67e6e0cb-26df-4e08-8803-ba488dbf512b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "1", + "ETag" : "\"0x8D7325B7405EB2D\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "07339a94-301a-000d-7a44-645aef000000", + "x-ms-client-request-id" : "67e6e0cb-26df-4e08-8803-ba488dbf512b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetquotashareapitestssetquota8ff0477956e4a?restype=share&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e9f13369-6214-445f-a308-bc0c0452c5a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B7420554C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07339a96-301a-000d-7c44-645aef000000", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-client-request-id" : "e9f13369-6214-445f-a308-bc0c0452c5a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetquotashareapitestssetquota8ff0477956e4a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "deaa383d-2449-4fb1-a252-c62c66a1a301" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Thu, 05 Sep 2019 23:47:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "2", + "ETag" : "\"0x8D7325B7420554C\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "07339a97-301a-000d-7d44-645aef000000", + "x-ms-client-request-id" : "deaa383d-2449-4fb1-a252-c62c66a1a301" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetquotashareapitestssetquota8ff0477956e4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuotaError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuotaError.json new file mode 100644 index 000000000000..64622bf80f46 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuotaError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareapitestssetquotaerror685892e3839d7922d4c?restype=share&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6250ed3d-676d-4b81-bc42-0c9a59f1b6a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "07339a9b-301a-000d-0144-645aef000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:07339a9b-301a-000d-0144-645aef000000\nTime:2019-09-05T23:47:47.1652268Z", + "Date" : "Thu, 05 Sep 2019 23:47:46 GMT", + "x-ms-client-request-id" : "6250ed3d-676d-4b81-bc42-0c9a59f1b6a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetquotaerror685892e3839d7922d4c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateAndGetPermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateAndGetPermission.json new file mode 100644 index 000000000000..bbc35ebb3be3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateAndGetPermission.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreateandgetpermission0305948a3706?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "621e89ff-ec65-49f2-b87f-af16ca0dcd7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9DD7EABA\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45977-601a-0000-2a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "621e89ff-ec65-49f2-b87f-af16ca0dcd7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreateandgetpermission0305948a3706?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "aa41f4c1-1785-4e28-9e1e-fd3e46418191", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4597a-601a-0000-2c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "aa41f4c1-1785-4e28-9e1e-fd3e46418191" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreateandgetpermission0305948a3706?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3761993c-9b0a-441c-a64c-5145b611367c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "200", + "x-ms-request-id" : "36c4597c-601a-0000-2e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "3761993c-9b0a-441c-a64c-5145b611367c" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreateandgetpermission0305948a3706" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectory.json new file mode 100644 index 000000000000..add772f940e7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectory.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectory1621061aae672dec?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a8a4a57f-9bba-44d9-bbf0-40a6e91786ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B98E08BB2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45823-601a-0000-7944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:47 GMT", + "x-ms-client-request-id" : "a8a4a57f-9bba-44d9-bbf0-40a6e91786ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectory1621061aae672dec/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ffad244b-3c8a-43fb-99b1-a6e648920aea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:48.5497350Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:47 GMT", + "ETag" : "\"0x8D7325B98F01206\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:48.5497350Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45828-601a-0000-7d44-64923b000000", + "x-ms-client-request-id" : "ffad244b-3c8a-43fb-99b1-a6e648920aea", + "x-ms-file-last-write-time" : "2019-09-05T23:48:48.5497350Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectory1621061aae672dec" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryFilePermission.json new file mode 100644 index 000000000000..1eef160523af --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryFilePermission.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryfilepermission873012f42?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9b32d283-cb93-4408-9c8c-3caf91b64433" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B998F699D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4584f-601a-0000-2244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:48 GMT", + "x-ms-client-request-id" : "9b32d283-cb93-4408-9c8c-3caf91b64433" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryfilepermission873012f42/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d8e915c7-919d-4d30-8b79-99a0e39a9efd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:49.6937657Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:48 GMT", + "ETag" : "\"0x8D7325B999EA2B9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:49.6937657Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45854-601a-0000-2644-64923b000000", + "x-ms-client-request-id" : "d8e915c7-919d-4d30-8b79-99a0e39a9efd", + "x-ms-file-last-write-time" : "2019-09-05T23:48:49.6937657Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectoryfilepermission873012f42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryFilePermissionKey.json new file mode 100644 index 000000000000..df8b7f6a0b66 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryFilePermissionKey.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryfilepermissionkey9792540?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "36a050cf-8313-4adb-8b5d-245cb2f099c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B99C9B386\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45861-601a-0000-3244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:49 GMT", + "x-ms-client-request-id" : "36a050cf-8313-4adb-8b5d-245cb2f099c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryfilepermissionkey9792540?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ddd9ff6d-0144-4049-8c16-cc5d821fa1ad", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45869-601a-0000-3744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:49 GMT", + "x-ms-client-request-id" : "ddd9ff6d-0144-4049-8c16-cc5d821fa1ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryfilepermissionkey9792540/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f41ba5d8-ba75-4263-9ba1-41d8e72a816f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:50.1240000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:49 GMT", + "ETag" : "\"0x8D7325B99E048C0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:50.1240000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4586e-601a-0000-3c44-64923b000000", + "x-ms-client-request-id" : "f41ba5d8-ba75-4263-9ba1-41d8e72a816f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:50.1240000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectoryfilepermissionkey9792540", "2019-09-05T23:48:50.124Z", "2019-09-05T23:48:50.124Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryInvalidName.json new file mode 100644 index 000000000000..b25735bad18c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryInvalidName.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryinvalidname490121196d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c4f64bc4-b750-43ce-b05e-cd4eede4c065" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B991AFCBE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45831-601a-0000-0644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:48 GMT", + "x-ms-client-request-id" : "c4f64bc4-b750-43ce-b05e-cd4eede4c065" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectoryinvalidname490121196d/test%2fdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "15b292f5-7b26-4a65-84af-d38386afaa87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "36c45835-601a-0000-0944-64923b000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:36c45835-601a-0000-0944-64923b000000\nTime:2019-09-05T23:48:48.9439985Z", + "Date" : "Thu, 05 Sep 2019 23:48:48 GMT", + "x-ms-client-request-id" : "15b292f5-7b26-4a65-84af-d38386afaa87", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectoryinvalidname490121196d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadata.json new file mode 100644 index 000000000000..631ad0dec339 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadata.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorymetadata27683ef4343c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1fdade2a-1933-46dd-b2d2-844df9c833de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B99556DB0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4583f-601a-0000-1344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:48 GMT", + "x-ms-client-request-id" : "1fdade2a-1933-46dd-b2d2-844df9c833de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorymetadata27683ef4343c/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "7d6efe7b-5945-4dff-80a1-2e3c7bb047f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:49.3157537Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:48 GMT", + "ETag" : "\"0x8D7325B9964F4A1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:49.3157537Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45845-601a-0000-1844-64923b000000", + "x-ms-client-request-id" : "7d6efe7b-5945-4dff-80a1-2e3c7bb047f2", + "x-ms-file-last-write-time" : "2019-09-05T23:48:49.3157537Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectorymetadata27683ef4343c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataAndSmbPropertiesFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataAndSmbPropertiesFilePermission.json new file mode 100644 index 000000000000..cfa8b73c096b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataAndSmbPropertiesFilePermission.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/2068e9583aef4fb1a752ff6d6edb824895a75dfd15374436a9d1b3e1288bbc70?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "776469d0-101a-001a-514d-5ff3e4000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:776469d0-101a-001a-514d-5ff3e4000000\nTime:2019-08-30T16:11:04.6136450Z", + "Date" : "Fri, 30 Aug 2019 16:11:04 GMT", + "x-ms-client-request-id" : "a090c064-dc49-49ef-838e-2b09e0efd669", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "2068e9583aef4fb1a752ff6d6edb824895a75dfd15374436a9d1b3e1288bbc70" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataError.json new file mode 100644 index 000000000000..b7415ecbe835 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorymetadataerror529513ea1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e6e4463f-0bf3-4a15-944d-d3628f46b8bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9A11E054\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4587e-601a-0000-4b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:49 GMT", + "x-ms-client-request-id" : "e6e4463f-0bf3-4a15-944d-d3628f46b8bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorymetadataerror529513ea1/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4323b2a1-2594-46b4-96bb-7903a1254b81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c45884-601a-0000-5044-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c45884-601a-0000-5044-64923b000000\nTime:2019-09-05T23:48:50.5400068Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:49 GMT", + "x-ms-client-request-id" : "4323b2a1-2594-46b4-96bb-7903a1254b81", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectorymetadataerror529513ea1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataWithFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataWithFilePermission.json new file mode 100644 index 000000000000..ce1db6c808f0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataWithFilePermission.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/0bfd3e7f395943b2b8b72fc4fba1e34155f4ea972e7b4d41b65e8776f4711a1c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "329f2a3a-c01a-0044-604d-5f1804000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:329f2a3a-c01a-0044-604d-5f1804000000\nTime:2019-08-30T16:12:59.4576939Z", + "Date" : "Fri, 30 Aug 2019 16:12:59 GMT", + "x-ms-client-request-id" : "8355b19c-7c90-40e9-94a1-2a9f8cbe5b2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "0bfd3e7f395943b2b8b72fc4fba1e34155f4ea972e7b4d41b65e8776f4711a1c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataWithFp.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataWithFp.json new file mode 100644 index 000000000000..2ef389c2d9b7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataWithFp.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorymetadatawithfp451907bc0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D650A3B6F3B\"", + "Last-Modified" : "Fri, 30 Aug 2019 16:13:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2371f395-d01a-003a-374d-5f8843000000", + "Date" : "Fri, 30 Aug 2019 16:13:47 GMT", + "x-ms-client-request-id" : "1093cbb7-36df-450f-b866-3bd0bc913cca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorymetadatawithfp451907bc0/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-30T16:13:48.3420000Z", + "Last-Modified" : "Fri, 30 Aug 2019 16:13:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 30 Aug 2019 16:13:47 GMT", + "ETag" : "\"0x8D72D650A447560\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-30T16:13:48.3420000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "2371f397-d01a-003a-384d-5f8843000000", + "x-ms-client-request-id" : "5c3eefde-7947-4129-9274-4bddfa061479", + "x-ms-file-last-write-time" : "2019-08-30T16:13:48.3420000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectorymetadatawithfp451907bc0", "2019-08-30T16:13:48.342Z", "2019-08-30T16:13:48.342Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryWithFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryWithFilePermission.json new file mode 100644 index 000000000000..b73de7ed5a1a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryWithFilePermission.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorywithfilepermission736559d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D6509C7D242\"", + "Last-Modified" : "Fri, 30 Aug 2019 16:13:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2371f38b-d01a-003a-2f4d-5f8843000000", + "Date" : "Fri, 30 Aug 2019 16:13:46 GMT", + "x-ms-client-request-id" : "68fb2c6c-b657-465c-8da8-148023899fa7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatedirectorywithfilepermission736559d/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-30T16:13:47.5870000Z", + "Last-Modified" : "Fri, 30 Aug 2019 16:13:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 30 Aug 2019 16:13:46 GMT", + "ETag" : "\"0x8D72D6509D14130\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-30T16:13:47.5870000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "2371f38d-d01a-003a-304d-5f8843000000", + "x-ms-client-request-id" : "ef010f1a-fb74-43dc-b65b-3e4e72483e8d", + "x-ms-file-last-write-time" : "2019-08-30T16:13:47.5870000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectorywithfilepermission736559d", "2019-08-30T16:13:47.587Z", "2019-08-30T16:13:47.587Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFile.json new file mode 100644 index 000000000000..ebc4642574cd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFile.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefile9382679b4861835214?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e688f43c-04f8-47a3-a565-6848f6b206c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9A4859B2\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45898-601a-0000-6144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:50 GMT", + "x-ms-client-request-id" : "e688f43c-04f8-47a3-a565-6848f6b206c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefile9382679b4861835214/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d5100dd5-1828-4d6d-833b-50804bf4fc24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:50.9107964Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:50 GMT", + "ETag" : "\"0x8D7325B9A5856FC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:50.9107964Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c4589e-601a-0000-6644-64923b000000", + "x-ms-client-request-id" : "d5100dd5-1828-4d6d-833b-50804bf4fc24", + "x-ms-file-last-write-time" : "2019-09-05T23:48:50.9107964Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefile9382679b4861835214" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileFilePermission.json new file mode 100644 index 000000000000..6b24c1bfb57b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileFilePermission.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilefilepermission0744414ecf2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "2cbdb9b9-18c0-45e7-970a-aa3ed1ad9dcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9A849F70\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458ac-601a-0000-7444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:50 GMT", + "x-ms-client-request-id" : "2cbdb9b9-18c0-45e7-970a-aa3ed1ad9dcb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilefilepermission0744414ecf2/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "473b11d9-1b3a-4228-be72-1c6b8e54e5b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:51.3298084Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:50 GMT", + "ETag" : "\"0x8D7325B9A9846A4\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:51.3298084Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c458af-601a-0000-7644-64923b000000", + "x-ms-client-request-id" : "473b11d9-1b3a-4228-be72-1c6b8e54e5b2", + "x-ms-file-last-write-time" : "2019-09-05T23:48:51.3298084Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilefilepermission0744414ecf2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileFilePermissionKey.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileFilePermissionKey.json new file mode 100644 index 000000000000..4bbb38caa809 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileFilePermissionKey.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilefilepermissionkey599199810a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0a719d11-de79-4af4-919b-6c03642801c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9AC419B0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458bc-601a-0000-0144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:50 GMT", + "x-ms-client-request-id" : "0a719d11-de79-4af4-919b-6c03642801c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilefilepermissionkey599199810a?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "04edfd4a-6f84-4b47-90ac-2c49a1efe753", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458c0-601a-0000-0444-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:50 GMT", + "x-ms-client-request-id" : "04edfd4a-6f84-4b47-90ac-2c49a1efe753" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilefilepermissionkey599199810a/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "503d8641-0226-45c6-b0a0-86db7a6c739f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:51.7700000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:51 GMT", + "ETag" : "\"0x8D7325B9ADB71A0\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:51.7700000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c458c3-601a-0000-0744-64923b000000", + "x-ms-client-request-id" : "503d8641-0226-45c6-b0a0-86db7a6c739f", + "x-ms-file-last-write-time" : "2019-09-05T23:48:51.7700000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilefilepermissionkey599199810a", "2019-09-05T23:48:51.770Z", "2019-09-05T23:48:51.770Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..112c5a2839b5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefileinvalidargs00462194cd2f3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9295043d-e5b6-4a37-a3e6-afab6aea2c5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9B114F66\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458cd-601a-0000-1144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:51 GMT", + "x-ms-client-request-id" : "9295043d-e5b6-4a37-a3e6-afab6aea2c5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefileinvalidargs00462194cd2f3/testfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d64e2cba-6bf4-4b02-959d-fcac66c7c8a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "36c458d1-601a-0000-1444-64923b000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:36c458d1-601a-0000-1444-64923b000000\nTime:2019-09-05T23:48:52.2310185Z", + "Date" : "Thu, 05 Sep 2019 23:48:51 GMT", + "x-ms-client-request-id" : "d64e2cba-6bf4-4b02-959d-fcac66c7c8a5", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefileinvalidargs00462194cd2f3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..adde245bd607 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefileinvalidargs1759273212527?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "03b8e55f-8ea1-4453-ae62-d1a512ab938c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9B4AD604\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458dc-601a-0000-1f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:51 GMT", + "x-ms-client-request-id" : "03b8e55f-8ea1-4453-ae62-d1a512ab938c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefileinvalidargs1759273212527/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c0bf368f-7463-4081-ad4d-9d80b296b1f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "36c458de-601a-0000-2044-64923b000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:36c458de-601a-0000-2044-64923b000000\nTime:2019-09-05T23:48:52.5940250Z", + "Date" : "Thu, 05 Sep 2019 23:48:51 GMT", + "x-ms-client-request-id" : "c0bf368f-7463-4081-ad4d-9d80b296b1f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefileinvalidargs1759273212527" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..ce84758928c0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverload.json @@ -0,0 +1,54 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverload78916c42a03d9?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "176a8bc5-3f1b-4f09-ab6b-f2e2ba2e13fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9B8176DB\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458eb-601a-0000-2c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:52 GMT", + "x-ms-client-request-id" : "176a8bc5-3f1b-4f09-ab6b-f2e2ba2e13fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverload78916c42a03d9/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "0cbed436-bd64-4298-aa62-c889001706bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:52.9160000Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:52 GMT", + "ETag" : "\"0x8D7325B9B8A4F40\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:52.9160000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c458f0-601a-0000-3044-64923b000000", + "x-ms-client-request-id" : "0cbed436-bd64-4298-aa62-c889001706bf", + "x-ms-file-last-write-time" : "2019-09-05T23:48:52.9160000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverload78916c42a03d9", "2019-09-05T23:48:52.916Z", "2019-09-05T23:48:52.916Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..61f8874c97b3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs058259dc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "04bb5ac8-4250-4a23-896f-f05d8c8d2e9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9BBE7F97\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c458fa-601a-0000-3a44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:52 GMT", + "x-ms-client-request-id" : "04bb5ac8-4250-4a23-896f-f05d8c8d2e9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs058259dc/testfile:", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d57ccf05-d1dc-4cb7-bdb1-e7761e86c883" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "36c458ff-601a-0000-3e44-64923b000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:36c458ff-601a-0000-3e44-64923b000000\nTime:2019-09-05T23:48:53.3660255Z", + "Date" : "Thu, 05 Sep 2019 23:48:52 GMT", + "x-ms-client-request-id" : "d57ccf05-d1dc-4cb7-bdb1-e7761e86c883", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs058259dc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..cdcf2167a698 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs157070e3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "275c4f2d-c9bc-4128-aa6b-f77b8c48c063" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9BF6F4DC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45908-601a-0000-4744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:52 GMT", + "x-ms-client-request-id" : "275c4f2d-c9bc-4128-aa6b-f77b8c48c063" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs157070e3/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "c436fb33-97db-4a71-af72-a684feedd3e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "36c4590c-601a-0000-4a44-64923b000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:36c4590c-601a-0000-4a44-64923b000000\nTime:2019-09-05T23:48:53.7210296Z", + "Date" : "Thu, 05 Sep 2019 23:48:52 GMT", + "x-ms-client-request-id" : "c436fb33-97db-4a71-af72-a684feedd3e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs157070e3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..9ea2bbbb3ad0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs28153928?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "bcc255a1-5e91-4ea8-b0c4-c54d8357b7fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9C2D473A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45915-601a-0000-5344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:53 GMT", + "x-ms-client-request-id" : "bcc255a1-5e91-4ea8-b0c4-c54d8357b7fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs28153928/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "da7008ec-0e6f-4250-87d8-2692f95138bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "310", + "StatusCode" : "400", + "x-ms-request-id" : "36c45919-601a-0000-5644-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c45919-601a-0000-5644-64923b000000\nTime:2019-09-05T23:48:54.0730315Zx-ms-content-md5", + "Date" : "Thu, 05 Sep 2019 23:48:53 GMT", + "x-ms-client-request-id" : "da7008ec-0e6f-4250-87d8-2692f95138bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs28153928" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..8114e33c68aa --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs33334804?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b489b04e-5cad-4d20-a95f-a7ebf5339d24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9C639981\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45924-601a-0000-6144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:53 GMT", + "x-ms-client-request-id" : "b489b04e-5cad-4d20-a95f-a7ebf5339d24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs33334804/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "38868972-94af-4147-86fd-9f1a9cf4855f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c45928-601a-0000-6444-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c45928-601a-0000-6444-64923b000000\nTime:2019-09-05T23:48:54.4300333Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:53 GMT", + "x-ms-client-request-id" : "38868972-94af-4147-86fd-9f1a9cf4855f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs33334804" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileWithFilePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileWithFilePermission.json new file mode 100644 index 000000000000..a679d8f5aca2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileWithFilePermission.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilewithfilepermission945788583?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72D650AA93E9F\"", + "Last-Modified" : "Fri, 30 Aug 2019 16:13:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2371f3a1-d01a-003a-404d-5f8843000000", + "Date" : "Fri, 30 Aug 2019 16:13:48 GMT", + "x-ms-client-request-id" : "b5769bc7-cd94-45fb-a259-7c8141d3b316" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatefilewithfilepermission945788583/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "10570340844661901768*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-30T16:13:49.0610000Z", + "Last-Modified" : "Fri, 30 Aug 2019 16:13:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 30 Aug 2019 16:13:48 GMT", + "ETag" : "\"0x8D72D650AB22B50\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-30T16:13:49.0610000Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "2371f3a3-d01a-003a-414d-5f8843000000", + "x-ms-client-request-id" : "bbd918f0-fe96-4d72-a547-3a1462ac81a3", + "x-ms-file-last-write-time" : "2019-08-30T16:13:49.0610000Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilewithfilepermission945788583", "2019-08-30T16:13:49.061Z", "2019-08-30T16:13:49.061Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreatePermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreatePermission.json new file mode 100644 index 000000000000..d1b189ad1a3e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreatePermission.json @@ -0,0 +1,46 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatepermission9593907c37c88de?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4a6079a8-6fc0-4b62-84dc-c532ae973fea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9D9F9C98\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4596a-601a-0000-1e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:55 GMT", + "x-ms-client-request-id" : "4a6079a8-6fc0-4b62-84dc-c532ae973fea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatepermission9593907c37c88de?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "d7c4c1bf-f839-412a-bf85-422d9f99fbce", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15518056309741717644*8114634751575874941", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4596e-601a-0000-2144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:55 GMT", + "x-ms-client-request-id" : "d7c4c1bf-f839-412a-bf85-422d9f99fbce" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatepermission9593907c37c88de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreatePermissionError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreatePermissionError.json new file mode 100644 index 000000000000..ae03ffea6d15 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreatePermissionError.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatepermissionerror0294719fb7f64?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "a9a70614-d47b-4a0f-9e06-a56e890ea903" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9E1D0A42\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45984-601a-0000-3644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "a9a70614-d47b-4a0f-9e06-a56e890ea903" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatepermissionerror0294719fb7f64?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ebc3f57a-35ec-49bd-9d88-5263c742a23d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "FileInvalidPermission", + "retry-after" : "0", + "Content-Length" : "233", + "StatusCode" : "400", + "x-ms-request-id" : "36c45988-601a-0000-3944-64923b000000", + "Body" : "FileInvalidPermissionThe specified file permission is not valid.\nRequestId:36c45988-601a-0000-3944-64923b000000\nTime:2019-09-05T23:48:57.3412320Z", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "ebc3f57a-35ec-49bd-9d88-5263c742a23d", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatepermissionerror0294719fb7f64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShare.json new file mode 100644 index 000000000000..a02a148b1382 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShare.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreateshare824449d115263b8524?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8d178ef2-c5cd-4d14-9e62-da487b0f1073" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B95C651BE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45736-601a-0000-2944-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:42 GMT", + "x-ms-client-request-id" : "8d178ef2-c5cd-4d14-9e62-da487b0f1073" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreateshare824449d115263b8524" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs0.json new file mode 100644 index 000000000000..bcc4ffa166b5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithargs0295055c498ccf?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "1598f37f-10a6-4f90-93f4-7b16eeb792c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B95EFABC9\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45741-601a-0000-3344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:42 GMT", + "x-ms-client-request-id" : "1598f37f-10a6-4f90-93f4-7b16eeb792c2" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs0295055c498ccf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs1.json new file mode 100644 index 000000000000..38db0232bad4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithargs1650752f0c5a6a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "509d3155-19bc-4b75-b16e-1955d6ed1450" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B961905D0\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4574a-601a-0000-3b44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:43 GMT", + "x-ms-client-request-id" : "509d3155-19bc-4b75-b16e-1955d6ed1450" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs1650752f0c5a6a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs2.json new file mode 100644 index 000000000000..aa56f169019f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithargs25762632e0ab16?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4653f31d-39d7-4bc6-9167-b4923408abaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9643987C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45753-601a-0000-4344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:43 GMT", + "x-ms-client-request-id" : "4653f31d-39d7-4bc6-9167-b4923408abaa" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs25762632e0ab16" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs3.json new file mode 100644 index 000000000000..d5b527a8374e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs3.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithargs345478903b6f5c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f994f581-9a28-435b-9ea6-22c55207a6bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B966DB5BC\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c4575f-601a-0000-4e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:43 GMT", + "x-ms-client-request-id" : "f994f581-9a28-435b-9ea6-22c55207a6bb" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs345478903b6f5c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..16f477a1e771 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithinvalidargs093704e7c51?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "479a1437-cbbf-4576-bf32-fe81baea1f84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c4576e-601a-0000-5c44-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c4576e-601a-0000-5c44-64923b000000\nTime:2019-09-05T23:48:44.6249601Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:43 GMT", + "x-ms-client-request-id" : "479a1437-cbbf-4576-bf32-fe81baea1f84", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithinvalidargs093704e7c51" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..025533264745 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithinvalidargs1024330f6f0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f56b20a8-5e71-480d-8f35-8297ba53f0b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "36c45775-601a-0000-6244-64923b000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:36c45775-601a-0000-6244-64923b000000\nTime:2019-09-05T23:48:44.7889627Z", + "Date" : "Thu, 05 Sep 2019 23:48:44 GMT", + "x-ms-client-request-id" : "f56b20a8-5e71-480d-8f35-8297ba53f0b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithinvalidargs1024330f6f0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs2.json new file mode 100644 index 000000000000..0d690c69ae2a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs2.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesharewithinvalidargs209111c638b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "8bea5ccd-3549-4bbb-a4d3-d3d190d46815" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "36c4577b-601a-0000-6844-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c4577b-601a-0000-6844-64923b000000\nTime:2019-09-05T23:48:44.9539637Zx-ms-share-quota6000", + "Date" : "Thu, 05 Sep 2019 23:48:44 GMT", + "x-ms-client-request-id" : "8bea5ccd-3549-4bbb-a4d3-d3d190d46815", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithinvalidargs209111c638b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshot.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshot.json new file mode 100644 index 000000000000..6bb62a1cc885 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshot.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesnapshot003342bc878a0749?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "66bb031b-3f73-48b6-b29d-021ab64dc52a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B96E5A4DE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45780-601a-0000-6d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:44 GMT", + "x-ms-client-request-id" : "66bb031b-3f73-48b6-b29d-021ab64dc52a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesnapshot003342bc878a0749?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "ec286717-12a1-49dc-8c0a-833754840d1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:48:45.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B96E5A4DE\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45786-601a-0000-7244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:44 GMT", + "x-ms-client-request-id" : "ec286717-12a1-49dc-8c0a-833754840d1d" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshot003342bc878a0749", "shareasyncapitestscreatesnapshot76128c82c81af6ac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotError.json new file mode 100644 index 000000000000..e7ce6e7890ba --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesnapshoterror36239774356d68?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f5744f77-2382-4e31-935f-cc4a3d149bdc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c45795-601a-0000-8044-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c45795-601a-0000-8044-64923b000000\nTime:2019-09-05T23:48:45.5379699Z", + "Date" : "Thu, 05 Sep 2019 23:48:44 GMT", + "x-ms-client-request-id" : "f5744f77-2382-4e31-935f-cc4a3d149bdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshoterror36239774356d68" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadata.json new file mode 100644 index 000000000000..20df4cb028c9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadata.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesnapshotmetadata67332033f5b0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "23aa86a0-34e7-4225-ac38-e7fbeda1c342" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B973EE8A5\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c457a3-601a-0000-0844-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:45 GMT", + "x-ms-client-request-id" : "23aa86a0-34e7-4225-ac38-e7fbeda1c342" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesnapshotmetadata67332033f5b0?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3170f843-573c-4cfd-b589-527cc95de338" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-05T23:48:45.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B96D26C80\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c457ab-601a-0000-0f44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:45 GMT", + "x-ms-client-request-id" : "3170f843-573c-4cfd-b589-527cc95de338" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshotmetadata67332033f5b0", "shareasyncapitestscreatesnapshotmetadata70007cd87c58" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadataError.json new file mode 100644 index 000000000000..f62f6d927189 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadataError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestscreatesnapshotmetadataerror51441f4ddb?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "efa0e724-2267-4b0f-8ebf-1e1ed4659dee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "36c457b6-601a-0000-1a44-64923b000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:36c457b6-601a-0000-1a44-64923b000000\nTime:2019-09-05T23:48:46.1129731Zvalue", + "Date" : "Thu, 05 Sep 2019 23:48:45 GMT", + "x-ms-client-request-id" : "efa0e724-2267-4b0f-8ebf-1e1ed4659dee", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshotmetadataerror51441f4ddb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..95afe7aa7299 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectory.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletedirectory74701e7eaa797745?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4a73e595-ae81-47f1-8956-a63c0b47d7ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9C9CD21A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45932-601a-0000-6d44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:53 GMT", + "x-ms-client-request-id" : "4a73e595-ae81-47f1-8956-a63c0b47d7ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletedirectory74701e7eaa797745/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "b49ad500-feca-49ab-a330-6407821853c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "1749612463032355572*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:54.8138974Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:54 GMT", + "ETag" : "\"0x8D7325B9CABE7DE\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-09-05T23:48:54.8138974Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45937-601a-0000-7044-64923b000000", + "x-ms-client-request-id" : "b49ad500-feca-49ab-a330-6407821853c9", + "x-ms-file-last-write-time" : "2019-09-05T23:48:54.8138974Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletedirectory74701e7eaa797745/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6ad2e063-7f2a-4372-a2aa-f6f36c59cbf1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c4593a-601a-0000-7344-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:54 GMT", + "x-ms-client-request-id" : "6ad2e063-7f2a-4372-a2aa-f6f36c59cbf1" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletedirectory74701e7eaa797745" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..bde511adddf2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectoryError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletedirectoryerror762831b2ca314?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "6845a7c0-8260-4eee-9547-91a488e557a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9CE5E91D\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45943-601a-0000-7c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:54 GMT", + "x-ms-client-request-id" : "6845a7c0-8260-4eee-9547-91a488e557a8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletedirectoryerror762831b2ca314/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4d2dd3a3-e6d0-47f6-9b48-a2e9cd88ce39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c4594a-601a-0000-8044-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c4594a-601a-0000-8044-64923b000000\nTime:2019-09-05T23:48:55.2920394Z", + "Date" : "Thu, 05 Sep 2019 23:48:54 GMT", + "x-ms-client-request-id" : "4d2dd3a3-e6d0-47f6-9b48-a2e9cd88ce39", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletedirectoryerror762831b2ca314" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFile.json new file mode 100644 index 000000000000..04736441984e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFile.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletefile97158b151a97d78a14?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "fe0bb180-bf46-4b22-9dc7-e2c8e4989dec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9D1DE936\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45951-601a-0000-0744-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:54 GMT", + "x-ms-client-request-id" : "fe0bb180-bf46-4b22-9dc7-e2c8e4989dec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletefile97158b151a97d78a14/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "e43cb853-0ef8-478f-8a20-061c4efa00a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "15581347578553677299*8114634751575874941", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-09-05T23:48:55.6649194Z", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 05 Sep 2019 23:48:54 GMT", + "ETag" : "\"0x8D7325B9D2DC2EA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-09-05T23:48:55.6649194Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "36c45955-601a-0000-0a44-64923b000000", + "x-ms-client-request-id" : "e43cb853-0ef8-478f-8a20-061c4efa00a9", + "x-ms-file-last-write-time" : "2019-09-05T23:48:55.6649194Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletefile97158b151a97d78a14/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "19b058d1-db32-4537-ba6a-52139b6c321b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "36c45959-601a-0000-0e44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:55 GMT", + "x-ms-client-request-id" : "19b058d1-db32-4537-ba6a-52139b6c321b" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletefile97158b151a97d78a14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFileError.json new file mode 100644 index 000000000000..194e982ecfda --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFileError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletefileerror553903ad1ba02e3f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "82a27b1a-a1f6-4fab-bf74-a8a7e68ad510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9D66D935\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45961-601a-0000-1644-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:55 GMT", + "x-ms-client-request-id" : "82a27b1a-a1f6-4fab-bf74-a8a7e68ad510" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeletefileerror553903ad1ba02e3f/testdirectory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "af39955c-7751-4ac0-b3a2-8eb1ca0a634a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "36c45963-601a-0000-1744-64923b000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:36c45963-601a-0000-1744-64923b000000\nTime:2019-09-05T23:48:56.1440455Z", + "Date" : "Thu, 05 Sep 2019 23:48:55 GMT", + "x-ms-client-request-id" : "af39955c-7751-4ac0-b3a2-8eb1ca0a634a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletefileerror553903ad1ba02e3f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShare.json new file mode 100644 index 000000000000..528a292b9162 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShare.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeleteshare5503238c89eb27e9d4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "4237a6ce-9d4e-4c18-899f-043e631c4504" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B979657B5\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c457bd-601a-0000-2144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:45 GMT", + "x-ms-client-request-id" : "4237a6ce-9d4e-4c18-899f-043e631c4504" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeleteshare5503238c89eb27e9d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShareError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShareError.json new file mode 100644 index 000000000000..67dfbdf7db18 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShareError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsdeleteshareerror583257ac91a4885?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "290534e4-af67-4ec7-86e0-1ea4d354307e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c457c9-601a-0000-2c44-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c457c9-601a-0000-2c44-64923b000000\nTime:2019-09-05T23:48:46.5639777Z", + "Date" : "Thu, 05 Sep 2019 23:48:45 GMT", + "x-ms-client-request-id" : "290534e4-af67-4ec7-86e0-1ea4d354307e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeleteshareerror583257ac91a4885" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetFileClientDoesNotCreateAFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetFileClientDoesNotCreateAFile.json new file mode 100644 index 000000000000..c341ee196248 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetFileClientDoesNotCreateAFile.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetfileclientdoesnotcreateafile65956830" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPermissionError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPermissionError.json new file mode 100644 index 000000000000..58e05e0ac8de --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPermissionError.json @@ -0,0 +1,47 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsgetpermissionerror806630d616273a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "24cbeeea-a61f-44cd-a27c-0b8c34498236" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B9E56432A\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45990-601a-0000-4144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "24cbeeea-a61f-44cd-a27c-0b8c34498236" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsgetpermissionerror806630d616273a?restype=share&comp=filepermission", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "eea2f725-010e-4d5a-a80d-3097c0d86f30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "335", + "StatusCode" : "400", + "x-ms-request-id" : "36c45994-601a-0000-4444-64923b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:36c45994-601a-0000-4444-64923b000000\nTime:2019-09-05T23:48:57.7000607Zx-ms-file-permission-keyabcde", + "Date" : "Thu, 05 Sep 2019 23:48:56 GMT", + "x-ms-client-request-id" : "eea2f725-010e-4d5a-a80d-3097c0d86f30", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsgetpermissionerror806630d616273a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetProperties.json new file mode 100644 index 000000000000..b6c42990e77d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetProperties.json @@ -0,0 +1,50 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsgetproperties77709aab698601650?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "85cfde62-b691-4307-aa9b-805dfd02b0ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B97DB28F8\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c457cf-601a-0000-3244-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:46 GMT", + "x-ms-client-request-id" : "85cfde62-b691-4307-aa9b-805dfd02b0ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsgetproperties77709aab698601650?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "3f707570-e8c6-4e47-a22f-ba0a10ad4c18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 05 Sep 2019 23:48:46 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "1", + "ETag" : "\"0x8D7325B97DB28F8\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-testmetadata" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "36c457d6-601a-0000-3844-64923b000000", + "x-ms-client-request-id" : "3f707570-e8c6-4e47-a22f-ba0a10ad4c18" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsgetproperties77709aab698601650" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..e80e0b998418 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPropertiesError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestsgetpropertieserror018942cf7a7ba3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "46efaed2-2cf0-42d0-807c-24eac9efdcac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c457e3-601a-0000-4544-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c457e3-601a-0000-4544-64923b000000\nTime:2019-09-05T23:48:47.0989778Z", + "Date" : "Thu, 05 Sep 2019 23:48:46 GMT", + "x-ms-client-request-id" : "46efaed2-2cf0-42d0-807c-24eac9efdcac", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsgetpropertieserror018942cf7a7ba3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetRootDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetRootDirectoryClient.json new file mode 100644 index 000000000000..742370851b26 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetRootDirectoryClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetrootdirectoryclient97890e739289" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetShareURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetShareURL.json new file mode 100644 index 000000000000..9061dfd4bc3f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetShareURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetshareurl89742d2360dc3850e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..2d43f382c2bd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetSnapshotId.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetsnapshotid96721ada445a1c69c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadata.json new file mode 100644 index 000000000000..e2b750b90f27 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadata.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestssetmetadata27871afd4dca6a5a34?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "acea4597-d063-4daf-8cca-f8ee468fb98e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B98732392\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c45809-601a-0000-6144-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:47 GMT", + "x-ms-client-request-id" : "acea4597-d063-4daf-8cca-f8ee468fb98e" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetmetadata27871afd4dca6a5a34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadataError.json new file mode 100644 index 000000000000..cc8328e09972 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadataError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestssetmetadataerror82080642cf37ab8?restype=share&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "9c8aba97-1337-4b8e-bb53-42114eae1cfb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c45816-601a-0000-6c44-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c45816-601a-0000-6c44-64923b000000\nTime:2019-09-05T23:48:48.2779949Z", + "Date" : "Thu, 05 Sep 2019 23:48:47 GMT", + "x-ms-client-request-id" : "9c8aba97-1337-4b8e-bb53-42114eae1cfb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetmetadataerror82080642cf37ab8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuota.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuota.json new file mode 100644 index 000000000000..67cc0b853411 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuota.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestssetquota49579edd846976cf24a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "f59c6846-227c-4f34-b74b-7790c3aa4788" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7325B982CA47C\"", + "Last-Modified" : "Thu, 05 Sep 2019 23:48:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36c457eb-601a-0000-4c44-64923b000000", + "Date" : "Thu, 05 Sep 2019 23:48:46 GMT", + "x-ms-client-request-id" : "f59c6846-227c-4f34-b74b-7790c3aa4788" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetquota49579edd846976cf24a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuotaError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuotaError.json new file mode 100644 index 000000000000..82982a5d7a45 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuotaError.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.file.core.windows.net/shareasyncapitestssetquotaerror45189e4fc5856b4ae?restype=share&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "x-ms-client-request-id" : "91209930-235c-4c3f-a2bb-5fd45e704819" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "36c45804-601a-0000-5c44-64923b000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:36c45804-601a-0000-5c44-64923b000000\nTime:2019-09-05T23:48:47.5549815Z", + "Date" : "Thu, 05 Sep 2019 23:48:46 GMT", + "x-ms-client-request-id" : "91209930-235c-4c3f-a2bb-5fd45e704819", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetquotaerror45189e4fc5856b4ae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/abortCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/abortCopy.json deleted file mode 100644 index b5ea8ea29e31..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/abortCopy.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "file59336dc2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/clearMetadataFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/clearMetadataFromDirClient.json deleted file mode 100644 index 7d422400647c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/clearMetadataFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory909922?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAC84923\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c3b-901a-0077-060a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory909922?restype=directory&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CACDEFC8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c3c-901a-0077-070a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - } ], - "variables" : [ "directory909922" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json deleted file mode 100644 index a99f682b4b55..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A138CAF\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e089-301a-00db-150a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A1A6700\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e08b-301a-00db-160a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceAlreadyExists", - "retry-after" : "0", - "Content-Length" : "228", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e08c-301a-00db-170a-4794a0000000", - "Body" : "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:7f75e08c-301a-00db-170a-4794a0000000\nTime:2019-07-30T19:10:09.1716444Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e08d-301a-00db-180a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share592387fe" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryFromShareClient.json deleted file mode 100644 index e121e223a546..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share83224048?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7CAE60B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:58 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b16-901a-0077-470a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share83224048/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7D2774E\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:58 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b18-901a-0077-480a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share83224048?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b19-901a-0077-490a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - } ], - "variables" : [ "share83224048" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json deleted file mode 100644 index b6b3eee03ea7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46557ae3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218861EE83\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e03f-301a-00db-5e0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46557ae3/test%2fshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ParentNotFound", - "retry-after" : "0", - "Content-Length" : "224", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e041-301a-00db-5f0a-4794a0000000", - "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:7f75e041-301a-00db-5f0a-4794a0000000\nTime:2019-07-30T19:10:06.3499048Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46557ae3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e042-301a-00db-600a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - } ], - "variables" : [ "share46557ae3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json deleted file mode 100644 index 6e3aa0334742..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9991231b", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150BA6C94\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df90-301a-00db-120a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT" - } - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9991231b", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D7152150BA6C94\"", - "Content-Length" : "0", - "x-ms-request-id" : "7f75df91-301a-00db-130a-4794a0000000", - "Body" : "", - "Content-Type" : "application/octet-stream" - } - } ], - "variables" : [ "file9991231b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileAlreadyExistsFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileAlreadyExistsFromShareClient.json deleted file mode 100644 index abb8c1ed3489..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileAlreadyExistsFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FEC55F2363\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:33:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "fe3f8c52-901a-00ff-29e7-470dee000000", - "Date" : "Wed, 31 Jul 2019 21:33:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FEC582A3F0\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:33:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "fe3f8c56-901a-00ff-2ae7-470dee000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 21:33:47 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FEC58D7BFB\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:33:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "fe3f8c57-901a-00ff-2be7-470dee000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 21:33:47 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "fe3f8c58-901a-00ff-2ce7-470dee000000", - "Date" : "Wed, 31 Jul 2019 21:33:48 GMT" - } - } ], - "variables" : [ "share169076f6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromDirClient.json deleted file mode 100644 index b04154bc9821..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory792505?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9DF1003\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1a-901a-0077-680a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory792505%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9E70138\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1b-901a-0077-690a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory792505" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromShareClient.json deleted file mode 100644 index 7c76401154cf..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share03861d68?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FC88DCA072\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:17:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db5f9-301a-0118-74e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:17:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share03861d68/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FC88E2D9BC\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:17:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db5fb-301a-0118-75e5-475bb6000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 21:17:46 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share03861d68?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "126db5fc-301a-0118-76e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:17:46 GMT" - } - } ], - "variables" : [ "share03861d68" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileInvalidNameFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileInvalidNameFromShareClient.json deleted file mode 100644 index 6eb31f9d2af7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileInvalidNameFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90366cf0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FCA71C0432\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:18:37 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db6d0-301a-0118-7ae5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90366cf0/my%2fFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ParentNotFound", - "retry-after" : "0", - "Content-Length" : "224", - "StatusCode" : "404", - "x-ms-request-id" : "126db6d2-301a-0118-7be5-475bb6000000", - "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:126db6d2-301a-0118-7be5-475bb6000000\nTime:2019-07-31T21:18:37.6207977Z", - "Date" : "Wed, 31 Jul 2019 21:18:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90366cf0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "126db6d3-301a-0118-7ce5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:37 GMT" - } - } ], - "variables" : [ "share90366cf0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json deleted file mode 100644 index 2ec9e509b42a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory356143%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ParentNotFound", - "retry-after" : "0", - "Content-Length" : "224", - "StatusCode" : "404", - "x-ms-request-id" : "260a2c3a-901a-0077-050a-47b537000000", - "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:260a2c3a-901a-0077-050a-47b537000000\nTime:2019-07-30T19:11:57.6002640Z", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory356143" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json index a18a5e25bc67..290acd437ef4 100644 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json @@ -1,45 +1,46 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile295428e2", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile46052765", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150C80472\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73E05B70\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:14 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "7f75df92-301a-00db-140a-4794a0000000", + "x-ms-request-id" : "07d2b78c-e01a-0111-17c7-564138000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT" - } + "Date" : "Mon, 19 Aug 2019 19:50:13 GMT" + }, + "Exception" : null }, { "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile295428e2", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile46052765", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73E05B70\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:14 GMT", "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D7152150C80472\"", "Content-Length" : "1024", - "x-ms-request-id" : "7f75df93-301a-00db-150a-4794a0000000", - "Body" : "", + "StatusCode" : "200", + "x-ms-request-id" : "07d2b78d-e01a-0111-18c7-564138000000", + "Date" : "Mon, 19 Aug 2019 19:50:13 GMT", "Content-Type" : "application/octet-stream" - } + }, + "Exception" : null } ], - "variables" : [ "file295428e2" ] + "variables" : [ "file46052765" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromShareClient.json deleted file mode 100644 index 72644e036310..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromShareClient.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00216e0e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A817B8FD\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b22-901a-0077-500a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00216e0e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b24-901a-0077-510a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - } ], - "variables" : [ "share00216e0e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json deleted file mode 100644 index 6c5fc9f4e725..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share43293a8e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "324", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e0db-301a-00db-370a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e0db-301a-00db-370a-4794a0000000\nTime:2019-07-30T19:10:55.3593903Zx-ms-share-quota-1", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share43293a8e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "323", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e0dc-301a-00db-380a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e0dc-301a-00db-380a-4794a0000000\nTime:2019-07-30T19:10:55.3894192Zx-ms-share-quota0", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share43293a8e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e0dd-301a-00db-390a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e0dd-301a-00db-390a-4794a0000000\nTime:2019-07-30T19:10:55.4264552Z", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share43293a8e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createMinFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createMinFromDirClient.json deleted file mode 100644 index 23ca0bd5d774..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createMinFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory691924?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9C603AF\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c16-901a-0077-650a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory691924" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShare.json deleted file mode 100644 index 320eb32cca07..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShare.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share91577f17?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202777831\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1d9-b01a-000d-690a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share91577f17&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1db-b01a-000d-6a0a-47df7a000000", - "Body" : "share91577f17share91577f17Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202777831\"5120", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share91577f17?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1dc-b01a-000d-6b0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - } ], - "variables" : [ "share91577f17" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareInvalidQuota.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareInvalidQuota.json deleted file mode 100644 index dcbdfdc66401..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareInvalidQuota.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46048d7b?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "324", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed1d4-b01a-000d-640a-47df7a000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebed1d4-b01a-000d-640a-47df7a000000\nTime:2019-07-30T19:13:30.7817153Zx-ms-share-quota-1", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46048d7b?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "329", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed1d5-b01a-000d-650a-47df7a000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebed1d5-b01a-000d-650a-47df7a000000\nTime:2019-07-30T19:13:30.8077419Zx-ms-share-quota9999999", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share46048d7b&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1d6-b01a-000d-660a-47df7a000000", - "Body" : "share46048d7b", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share46048d7b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json deleted file mode 100644 index 1a39d6ada921..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share2239261e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152200C98FA6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:28 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2cb6-901a-0077-280a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share2239261e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "260a2cb8-901a-0077-290a-47b537000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:260a2cb8-901a-0077-290a-47b537000000\nTime:2019-07-30T19:13:28.2855742Z", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share2239261e&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2cb9-901a-0077-2a0a-47b537000000", - "Body" : "share2239261eshare2239261eTue, 30 Jul 2019 19:13:28 GMT\"0x8D7152200C98FA6\"5120", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share2239261e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Connection" : "close", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2cba-901a-0077-2b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - } ], - "variables" : [ "share2239261e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceSameMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceSameMetadata.json deleted file mode 100644 index 9c6ccdc075eb..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceSameMetadata.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80585a06?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521E5C4F58C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:12:42 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c6c-901a-0077-150a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80585a06?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "260a2c6f-901a-0077-160a-47b537000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:260a2c6f-901a-0077-160a-47b537000000\nTime:2019-07-30T19:12:42.9539281Z", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share80585a06&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c70-901a-0077-170a-47b537000000", - "Body" : "share80585a06share80585a06Tue, 30 Jul 2019 19:12:42 GMT\"0x8D71521E5C4F58C\"5120", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80585a06?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c71-901a-0077-180a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - } ], - "variables" : [ "share80585a06" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectory.json deleted file mode 100644 index a9f6935503ee..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectory.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory68944e?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9963569\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c10-901a-0077-5f0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory68944e%2fdir429318274?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C99B8DEE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c11-901a-0077-600a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory68944e", "dir429318274" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json deleted file mode 100644 index 402ab876c4f6..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory07490f?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAA3A12D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c37-901a-0077-020a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory07490f%2fdir8393011e2?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAAB442C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c38-901a-0077-030a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory07490f%2fdir8393011e2?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceAlreadyExists", - "retry-after" : "0", - "Content-Length" : "228", - "StatusCode" : "409", - "x-ms-request-id" : "260a2c39-901a-0077-040a-47b537000000", - "Body" : "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:260a2c39-901a-0077-040a-47b537000000\nTime:2019-07-30T19:11:57.4971668Z", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory07490f", "dir8393011e2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryWithMetadata.json deleted file mode 100644 index 1474ed7f798a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryWithMetadata.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory090720?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA96A5BA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c35-901a-0077-800a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory090720%2fdir9733962ce?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA9C7382\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c36-901a-0077-010a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - } ], - "variables" : [ "directory090720", "dir9733962ce" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json deleted file mode 100644 index e3995b2568b1..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share92856abd?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521AA260921\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b41-901a-0077-660a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share92856abd?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b43-901a-0077-670a-47b537000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:260a2b43-901a-0077-670a-47b537000000\nTime:2019-07-30T19:11:02.9268321Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share92856abd?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b44-901a-0077-680a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - } ], - "variables" : [ "share92856abd" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceFromDirClient.json deleted file mode 100644 index 2d886a08bd02..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory907393?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA27754C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c25-901a-0077-710a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory907393?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceAlreadyExists", - "retry-after" : "0", - "Content-Length" : "228", - "StatusCode" : "409", - "x-ms-request-id" : "260a2c26-901a-0077-720a-47b537000000", - "Body" : "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:260a2c26-901a-0077-720a-47b537000000\nTime:2019-07-30T19:11:56.6343556Z", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory907393" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json deleted file mode 100644 index 0d6d8afe7014..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00092d21?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A77705C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e09b-301a-00db-220a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00092d21?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e09d-301a-00db-230a-4794a0000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:7f75e09d-301a-00db-230a-4794a0000000\nTime:2019-07-30T19:10:09.7802336Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00092d21?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e09e-301a-00db-240a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share00092d21" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createWithMetadataFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createWithMetadataFromDirClient.json deleted file mode 100644 index 5b44d12dd44b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createWithMetadataFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory68447d?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C94409DA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c0e-901a-0077-5d0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:54 GMT" - } - } ], - "variables" : [ "directory68447d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json deleted file mode 100644 index 45fc238ad453..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share15381a85?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152189C903AB\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e07f-301a-00db-0e0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share15381a85/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e081-301a-00db-0f0a-4794a0000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:7f75e081-301a-00db-0f0a-4794a0000000\nTime:2019-07-30T19:10:08.6351223Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share15381a85?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e082-301a-00db-100a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - } ], - "variables" : [ "share15381a85" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryFromShareClient.json deleted file mode 100644 index 51bdcbddf639..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryFromShareClient.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188CCFFEA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e053-301a-00db-6d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188D5FFA0\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e055-301a-00db-6e0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e056-301a-00db-6f0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e057-301a-00db-700a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - } ], - "variables" : [ "share98706a53" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json deleted file mode 100644 index 7cd633a6a484..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share613453e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "126db60b-301a-0118-01e5-475bb6000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:126db60b-301a-0118-01e5-475bb6000000\nTime:2019-07-31T21:17:47.3892164Z", - "Date" : "Wed, 31 Jul 2019 21:17:47 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share613453e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "126db60c-301a-0118-02e5-475bb6000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:126db60c-301a-0118-02e5-475bb6000000\nTime:2019-07-31T21:17:47.4222491Z", - "Date" : "Wed, 31 Jul 2019 21:17:47 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share613453e7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileDoesNotExistFromShareClient.json deleted file mode 100644 index 28894ccec7ee..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileDoesNotExistFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share696227b2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FCA613C8AD\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:18:35 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db6a0-301a-0118-57e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:35 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share696227b2/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "126db6a2-301a-0118-58e5-475bb6000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:126db6a2-301a-0118-58e5-475bb6000000\nTime:2019-07-31T21:18:35.8921267Z", - "Date" : "Wed, 31 Jul 2019 21:18:35 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share696227b2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "126db6a3-301a-0118-59e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:35 GMT" - } - } ], - "variables" : [ "share696227b2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromDirClient.json deleted file mode 100644 index d8d41fbecc15..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromDirClient.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory084674?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAD3E4B3\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c3d-901a-0077-080a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory084674%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CADBD5E4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c3e-901a-0077-090a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory084674%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c3f-901a-0077-0a0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - } ], - "variables" : [ "directory084674" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromShareClient.json deleted file mode 100644 index c0eeca93d2f9..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromShareClient.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7160701B60EB4\"", - "Last-Modified" : "Wed, 31 Jul 2019 22:32:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "044b4925-801a-00af-6eef-4712e6000000", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7160701E1F516\"", - "Last-Modified" : "Wed, 31 Jul 2019 22:32:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "044b4928-801a-00af-6fef-4712e6000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "044b4929-801a-00af-70ef-4712e6000000", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "044b492a-801a-00af-71ef-4712e6000000", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - } ], - "variables" : [ "share6980996a" ] -} diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json deleted file mode 100644 index b1b2b8682809..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory807235?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA0DA578\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c22-901a-0077-6f0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory807235%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "260a2c24-901a-0077-700a-47b537000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:260a2c24-901a-0077-700a-47b537000000\nTime:2019-07-30T19:11:56.5472730Z", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory807235" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromDirClient.json deleted file mode 100644 index 6c38f8842eaa..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromDirClient.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory731760?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA019494\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c20-901a-0077-6d0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory731760?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c21-901a-0077-6e0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - } ], - "variables" : [ "directory731760" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromFileClient.json deleted file mode 100644 index bcf1220e6c9b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromFileClient.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile016195dc", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715214FFE691A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df79-301a-00db-7b0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile016195dc", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75df7a-301a-00db-7c0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - } ], - "variables" : [ "file016195dc" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromShareClient.json deleted file mode 100644 index 9ab7a0d97981..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75870091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A80208E9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b1e-901a-0077-4d0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75870091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b20-901a-0077-4e0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75870091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b21-901a-0077-4f0a-47b537000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:260a2b21-901a-0077-4f0a-47b537000000\nTime:2019-07-30T19:10:59.3814970Z", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share75870091" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteNotExistFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteNotExistFromDirClient.json deleted file mode 100644 index 3d35290624d3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteNotExistFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory856262?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "260a2c0f-901a-0077-5e0a-47b537000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:260a2c0f-901a-0077-5e0a-47b537000000\nTime:2019-07-30T19:11:55.5983809Z", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory856262" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShare.json deleted file mode 100644 index a26969eeac6e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShare.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share0412801a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522023B9912\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:30 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1d0-b01a-000d-610a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share0412801a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1d2-b01a-000d-620a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share0412801a&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1d3-b01a-000d-630a-47df7a000000", - "Body" : "share0412801a", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share0412801a" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShareDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShareDoesNotExist.json deleted file mode 100644 index fa326a49e821..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShareDoesNotExist.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share19157f4f?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "9ebed1ea-b01a-000d-760a-47df7a000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:9ebed1ea-b01a-000d-760a-47df7a000000\nTime:2019-07-30T19:13:32.1069780Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share19157f4f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1eb-b01a-000d-770a-47df7a000000", - "Body" : "share19157f4f", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share19157f4f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSnapshotFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSnapshotFromShareClient.json deleted file mode 100644 index b39728fa3863..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSnapshotFromShareClient.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521897A0CB6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e06f-301a-00db-030a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:08.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521897A0CB6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e071-301a-00db-040a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?sharesnapshot=2019-07-30T19%3a10%3a08.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "d2e4b9d9-f01a-00c6-7a0a-474d4a000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:08.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521897A0CB6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e072-301a-00db-050a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e073-301a-00db-060a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e073-301a-00db-060a-4794a0000000\nTime:2019-07-30T19:10:08.2517510Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share105415aa" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSubDirectory.json deleted file mode 100644 index 82bac73b9529..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSubDirectory.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory007945?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9EECB51\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1c-901a-0077-6a0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory007945%2fdir6451491d7?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9F50E61\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1d-901a-0077-6b0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory007945%2fdir6451491d7?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c1f-901a-0077-6c0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - } ], - "variables" : [ "directory007945", "dir6451491d7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateFromShareClient.json deleted file mode 100644 index 5c022530b510..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateFromShareClient.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218AA0AD7B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:10 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0a4-301a-00db-280a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0a6-301a-00db-290a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:10 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A58DA5A9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0d7-301a-00db-350a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0da-301a-00db-360a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - } ], - "variables" : [ "share51575bf5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json deleted file mode 100644 index ff7d9eb38386..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521E5D91EA7\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:12:43 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c72-901a-0077-190a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c74-901a-0077-1a0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152200B789E5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:28 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2cb1-901a-0077-250a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share57757e81&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2cb4-901a-0077-260a-47b537000000", - "Body" : "share57757e81share57757e81Tue, 30 Jul 2019 19:13:28 GMT\"0x8D7152200B789E5\"5120", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2cb5-901a-0077-270a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - } ], - "variables" : [ "share57757e81" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json deleted file mode 100644 index 08ac48f0b7dd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90227151?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203248439\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1ec-b01a-000d-780a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90227151?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1ee-b01a-000d-790a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90227151?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed1ef-b01a-000d-7a0a-47df7a000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:9ebed1ef-b01a-000d-7a0a-47df7a000000\nTime:2019-07-30T19:13:32.2811453Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share90227151&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1f0-b01a-000d-7b0a-47df7a000000", - "Body" : "share90227151", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share90227151" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json deleted file mode 100644 index cee9fe4bb908..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218920B2F5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e060-301a-00db-770a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e062-301a-00db-780a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e063-301a-00db-790a-4794a0000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:7f75e063-301a-00db-790a-4794a0000000\nTime:2019-07-30T19:10:07.5791005Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e064-301a-00db-7a0a-4794a0000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:7f75e064-301a-00db-7a0a-4794a0000000\nTime:2019-07-30T19:10:07.6201383Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share499478c3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json deleted file mode 100644 index 17dfc3abd6b7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile81843a37", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150ACADA4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df8e-301a-00db-100a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile81843a37", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Accept-Ranges" : "bytes", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D7152150ACADA4\"", - "Content-Length" : "1024", - "x-ms-request-id" : "7f75df8f-301a-00db-110a-4794a0000000", - "Body" : "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", - "Content-Type" : "application/octet-stream" - } - } ], - "variables" : [ "file81843a37" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json deleted file mode 100644 index 687ffd4b639d..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory640660?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA7B7608\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c32-901a-0077-7e0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory640660?comp=listhandles", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c33-901a-0077-7f0a-47b537000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory640660" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json deleted file mode 100644 index 4bcc904154c2..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile63321504", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215067A4A9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df86-301a-00db-080a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile63321504?maxresults=10&comp=listhandles", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df87-301a-00db-090a-4794a0000000", - "Body" : "10", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "file63321504" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json deleted file mode 100644 index 24d9d561ab0b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53691dc7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A71090F0\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b0c-901a-0077-400a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53691dc7/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b0e-901a-0077-410a-47b537000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:260a2b0e-901a-0077-410a-47b537000000\nTime:2019-07-30T19:10:57.7569685Z", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53691dc7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b0f-901a-0077-420a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT" - } - } ], - "variables" : [ "share53691dc7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientDoesNotCreateAFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientDoesNotCreateAFile.json deleted file mode 100644 index ca78855ea5bc..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientDoesNotCreateAFile.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share23449c28?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71605E15365B6\"", - "Last-Modified" : "Wed, 31 Jul 2019 22:24:40 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "896ce915-f01a-0001-3bee-47318b000000", - "Date" : "Wed, 31 Jul 2019 22:24:40 GMT" - } - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share23449c28/testfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "StatusCode" : "404", - "x-ms-request-id" : "896ce919-f01a-0001-3cee-47318b000000", - "Date" : "Wed, 31 Jul 2019 22:24:40 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share23449c28?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "896ce91a-f01a-0001-3dee-47318b000000", - "Date" : "Wed, 31 Jul 2019 22:24:40 GMT" - } - } ], - "variables" : [ "share23449c28" ] -} diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientFromDirClient.json deleted file mode 100644 index ed4d423a67bd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory928652", "12595a0a2d3d431b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getHandlesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getHandlesFromDirClient.json deleted file mode 100644 index 65c17db3a4a2..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getHandlesFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory941872" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json deleted file mode 100644 index 9a0c8d060967..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share044643e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e05d-301a-00db-750a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e05d-301a-00db-750a-4794a0000000\nTime:2019-07-30T19:10:07.3899144Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share044643e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e05f-301a-00db-760a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e05f-301a-00db-760a-4794a0000000\nTime:2019-07-30T19:10:07.4249477Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share044643e9" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataFromShareClient.json deleted file mode 100644 index 094f668b5ab7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataFromShareClient.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share887838fa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521899C6A52\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e074-301a-00db-070a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share887838fa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521899C6A52\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e076-301a-00db-080a-4794a0000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share887838fa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e077-301a-00db-090a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - } ], - "variables" : [ "share887838fa" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPolicies.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPolicies.json deleted file mode 100644 index c5ef0b99231f..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPolicies.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share715985cb?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521889F2DCC\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e04b-301a-00db-670a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share715985cb?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521889F2DCC\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e04d-301a-00db-680a-4794a0000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share715985cb?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e04e-301a-00db-690a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - } ], - "variables" : [ "share715985cb" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPoliciesDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPoliciesDoesNotExist.json deleted file mode 100644 index 98b5424c58ba..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPoliciesDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share29090b5d?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e03c-301a-00db-5c0a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e03c-301a-00db-5c0a-4794a0000000\nTime:2019-07-30T19:10:06.1256868Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share29090b5d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e03e-301a-00db-5d0a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e03e-301a-00db-5d0a-4794a0000000\nTime:2019-07-30T19:10:06.1707307Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share29090b5d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json deleted file mode 100644 index 4586711ec1bd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share919227b1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b12-901a-0077-450a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b12-901a-0077-450a-47b537000000\nTime:2019-07-30T19:10:58.8499972Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share919227b1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b15-901a-0077-460a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b15-901a-0077-460a-47b537000000\nTime:2019-07-30T19:10:58.8820269Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share919227b1" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromDirClient.json deleted file mode 100644 index d6f1d8dbea3c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory018517?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9D102E3\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c18-901a-0077-660a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory018517?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-server-encrypted" : "true", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9D102E3\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c19-901a-0077-670a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory018517" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json index b15329724259..be1d4554735c 100644 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json @@ -1,45 +1,46 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile92927fc9", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile6226590e", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215089B3D8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73AE1B77\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "7f75df8a-301a-00db-0c0a-4794a0000000", + "x-ms-request-id" : "07d2b784-e01a-0111-0fc7-564138000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } + "Date" : "Mon, 19 Aug 2019 19:50:12 GMT" + }, + "Exception" : null }, { "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile92927fc9", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile6226590e", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73AE1B77\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:13 GMT", "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D715215089B3D8\"", "Content-Length" : "1024", - "x-ms-request-id" : "7f75df8b-301a-00db-0d0a-4794a0000000", - "Body" : "", + "StatusCode" : "200", + "x-ms-request-id" : "07d2b785-e01a-0111-10c7-564138000000", + "Date" : "Mon, 19 Aug 2019 19:50:12 GMT", "Content-Type" : "application/octet-stream" - } + }, + "Exception" : null } ], - "variables" : [ "file92927fc9" ] + "variables" : [ "file6226590e" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromShareClient.json deleted file mode 100644 index bcaae7e72c30..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromShareClient.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share73430a8d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A8C360A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0a0-301a-00db-250a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share73430a8d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D715218A8C360A\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e0a2-301a-00db-260a-4794a0000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share73430a8d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0a3-301a-00db-270a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share73430a8d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json deleted file mode 100644 index a828607985c8..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share221471e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7E6D93D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b1a-901a-0077-4a0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share221471e7/?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-server-encrypted" : "false", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7EFF17C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b1c-901a-0077-4b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share221471e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b1d-901a-0077-4c0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - } ], - "variables" : [ "share221471e7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getShareDoesNotCreateAShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getShareDoesNotCreateAShare.json deleted file mode 100644 index 31e9cad618f7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getShareDoesNotCreateAShare.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share76626429?restype=share&comp=stats", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "9ebed1fd-b01a-000d-040a-47df7a000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:9ebed1fd-b01a-000d-040a-47df7a000000\nTime:2019-07-30T19:13:32.6575025Z", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share76626429&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1ff-b01a-000d-050a-47df7a000000", - "Body" : "share76626429", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share76626429" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotId.json deleted file mode 100644 index e0a5518d0a87..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotId.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share430933e3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188B4B6F4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e04f-301a-00db-6a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share430933e3?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:06.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188B4B6F4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e051-301a-00db-6b0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share430933e3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e052-301a-00db-6c0a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e052-301a-00db-6c0a-4794a0000000\nTime:2019-07-30T19:10:06.8834219Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share430933e3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json deleted file mode 100644 index dfc3538fffda..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share842043e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A4C0FDE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e094-301a-00db-1d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share842043e9?sharesnapshot=snapshot&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "445", - "StatusCode" : "400", - "x-ms-request-id" : "d2e4b9e9-f01a-00c6-7d0a-474d4a000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:d2e4b9e9-f01a-00c6-7d0a-474d4a000000\nTime:2019-07-30T19:10:09.4966470ZsharesnapshotsnapshotMust be in the specific snapshot date time format.", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share842043e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e096-301a-00db-1e0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share842043e9" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json deleted file mode 100644 index e5e9cc43e1d0..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521895DA407\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e06b-301a-00db-800a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:07.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521895DA407\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e06d-301a-00db-010a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?sharesnapshot=2019-07-30T19%3a10%3a07.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521895DA407\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4b9d6-f01a-00c6-790a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e06e-301a-00db-020a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e06e-301a-00db-020a-4794a0000000\nTime:2019-07-30T19:10:08.0135198Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share33704195" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json deleted file mode 100644 index e5477d08bdf5..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share44011f3c?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A82AD064\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b25-901a-0077-520a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share44011f3c?sharesnapshot=snapshot&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "445", - "StatusCode" : "400", - "x-ms-request-id" : "d2e4ba3a-f01a-00c6-170a-474d4a000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:d2e4ba3a-f01a-00c6-170a-474d4a000000\nTime:2019-07-30T19:10:59.6107609ZsharesnapshotsnapshotMust be in the specific snapshot date time format.", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share44011f3c?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b27-901a-0077-530a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - } ], - "variables" : [ "share44011f3c" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json deleted file mode 100644 index fa366b9b3d00..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521AA0E359B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b3d-901a-0077-630a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:11:02.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A99DA700\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b3f-901a-0077-640a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?sharesnapshot=2019-07-30T19%3a11%3a02.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-meta-snapshot" : "metadata", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521A99DA700\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4ba45-f01a-00c6-1b0a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b40-901a-0077-650a-47b537000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:260a2b40-901a-0077-650a-47b537000000\nTime:2019-07-30T19:11:02.8497599Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share53196c07" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStats.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getStats.json deleted file mode 100644 index 713dffd115dd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStats.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share13839f90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521AA57AC5F\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:03 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b45-901a-0077-690a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share13839f90?restype=share&comp=stats", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b47-901a-0077-6a0a-47b537000000", - "Body" : "0", - "Date" : "Tue, 30 Jul 2019 19:11:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share13839f90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b48-901a-0077-6b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:03 GMT" - } - } ], - "variables" : [ "share13839f90" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStatsDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getStatsDoesNotExist.json deleted file mode 100644 index 819bd8455219..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStatsDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share87413c75?restype=share&comp=stats", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b05-901a-0077-3e0a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b05-901a-0077-3e0a-47b537000000\nTime:2019-07-30T19:10:55.9893061Z", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share87413c75?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b08-901a-0077-3f0a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b08-901a-0077-3f0a-47b537000000\nTime:2019-07-30T19:10:57.6828989Z", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share87413c75" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSubDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSubDirectoryClient.json deleted file mode 100644 index ed36d7e22125..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSubDirectoryClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory891026" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json deleted file mode 100644 index b93a05fb499d..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA34BEF2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c27-901a-0077-730a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274510?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA3ADAF2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c28-901a-0077-740a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fsamelayer5122560", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA40F6E8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c29-901a-0077-750a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274510%2fnextlayer4592830", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA46C4B5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2a-901a-0077-760a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274511?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA4CE0B5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2b-901a-0077-770a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fsamelayer51225601", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA543577\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2c-901a-0077-780a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274511%2fnextlayer45928301", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA5A7889\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2d-901a-0077-790a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274512?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA601F36\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2e-901a-0077-7a0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fsamelayer512256012", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA65C5E6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2f-901a-0077-7b0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274512%2fnextlayer459283012", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA6C08F9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c30-901a-0077-7c0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451?restype=directory&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c31-901a-0077-7d0a-47b537000000", - "Body" : "directory7274510directory7274511directory7274512samelayer51225601024samelayer512256011024samelayer5122560121024", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory727451", "samelayer512256", "nextlayer459283" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listHandlesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listHandlesFromFileClient.json deleted file mode 100644 index 3660f01e88fe..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listHandlesFromFileClient.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9917633c", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521500DD620\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df7b-301a-00db-7d0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9917633c?comp=listhandles", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df7c-301a-00db-7e0a-4794a0000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "file9917633c" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listRangesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listRangesFromFileClient.json deleted file mode 100644 index e9dc3d0fe023..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listRangesFromFileClient.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile62564f32", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521501C3184\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df7d-301a-00db-7f0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile62564f32?comp=range", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215023D474\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df7e-301a-00db-800a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile62564f32?comp=rangelist", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-content-length" : "512", - "ETag" : "\"0x8D715215023D474\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df7f-301a-00db-010a-4794a0000000", - "Body" : "0511", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "file62564f32" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listShares.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listShares.json deleted file mode 100644 index f019f2469aae..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listShares.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851700?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522033B4614\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1f2-b01a-000d-7c0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851701?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715220340C5B4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1f4-b01a-000d-7d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851702?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203461E2B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1f6-b01a-000d-7e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share46185170&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1f8-b01a-000d-7f0a-47df7a000000", - "Body" : "share46185170share461851700Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522033B4614\"2share461851701Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220340C5B4\"2share461851702Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203461E2B\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share46185170&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1f9-b01a-000d-800a-47df7a000000", - "Body" : "share46185170share461851700Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522033B4614\"2share461851701Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220340C5B4\"2share461851702Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203461E2B\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851700?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1fa-b01a-000d-010a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851701?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1fb-b01a-000d-020a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851702?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1fc-b01a-000d-030a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - } ], - "variables" : [ "share46185170" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadata.json deleted file mode 100644 index e385c897d512..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadata.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f100?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203F0B869\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed21c-b01a-000d-1b0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f101?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203F63803\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed21e-b01a-000d-1c0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f102?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203FC05C2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed220-b01a-000d-1d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share17297f10&include=metadata&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed222-b01a-000d-1e0a-47df7a000000", - "Body" : "share17297f10share17297f100Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F0B869\"2metadatashare17297f101Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F63803\"2share17297f102Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203FC05C2\"2metadata", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share17297f10&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed223-b01a-000d-1f0a-47df7a000000", - "Body" : "share17297f10share17297f100Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F0B869\"2share17297f101Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F63803\"2share17297f102Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203FC05C2\"2", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f100?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed224-b01a-000d-200a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f101?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed225-b01a-000d-210a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f102?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed226-b01a-000d-220a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - } ], - "variables" : [ "share17297f10" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json deleted file mode 100644 index 2940b73ebac9..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e080?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522028956ED\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1dd-b01a-000d-6c0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e080?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:31.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522028956ED\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1df-b01a-000d-6d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e081?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202D9D46F\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1e0-b01a-000d-6e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e082?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202EC2863\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1e2-b01a-000d-6f0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e082?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:31.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202EC2863\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1e4-b01a-000d-700a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share16415e08&include=metadata%2csnapshots&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1e5-b01a-000d-710a-47df7a000000", - "Body" : "share16415e08share16415e0802019-07-30T19:13:31.0000000ZTue, 30 Jul 2019 19:13:31 GMT\"0x8D71522028956ED\"2metadatashare16415e080Tue, 30 Jul 2019 19:13:31 GMT\"0x8D71522028956ED\"2metadatashare16415e081Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202D9D46F\"2share16415e0822019-07-30T19:13:31.0000000ZTue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202EC2863\"2metadatashare16415e082Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202EC2863\"2metadata", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share16415e08&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1e6-b01a-000d-720a-47df7a000000", - "Body" : "share16415e08share16415e080Tue, 30 Jul 2019 19:13:31 GMT\"0x8D71522028956ED\"2share16415e081Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202D9D46F\"2share16415e082Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202EC2863\"2", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e080?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed1e7-b01a-000d-730a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed1e7-b01a-000d-730a-47df7a000000\nTime:2019-07-30T19:13:31.9728507Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e081?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1e8-b01a-000d-740a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e082?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed1e9-b01a-000d-750a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed1e9-b01a-000d-750a-47df7a000000\nTime:2019-07-30T19:13:32.0449189Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share16415e08" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeSnapshots.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeSnapshots.json deleted file mode 100644 index b903937d0588..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeSnapshots.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715220378850D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed200-b01a-000d-060a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec0?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:32.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715220378850D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed202-b01a-000d-070a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203850B40\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed203-b01a-000d-080a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522038A8AD6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed205-b01a-000d-090a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec2?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:32.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522038A8AD6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed207-b01a-000d-0a0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share598295ec&include=snapshots&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed208-b01a-000d-0b0a-47df7a000000", - "Body" : "share598295ecshare598295ec02019-07-30T19:13:32.0000000ZTue, 30 Jul 2019 19:13:32 GMT\"0x8D715220378850D\"2share598295ec0Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220378850D\"2share598295ec1Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203850B40\"2share598295ec22019-07-30T19:13:32.0000000ZTue, 30 Jul 2019 19:13:32 GMT\"0x8D71522038A8AD6\"2share598295ec2Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522038A8AD6\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share598295ec&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed209-b01a-000d-0c0a-47df7a000000", - "Body" : "share598295ecshare598295ec0Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220378850D\"2share598295ec1Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203850B40\"2share598295ec2Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522038A8AD6\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed20a-b01a-000d-0d0a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed20a-b01a-000d-0d0a-47df7a000000\nTime:2019-07-30T19:13:33.0058344Z", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed20b-b01a-000d-0e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed20c-b01a-000d-0f0a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed20c-b01a-000d-0f0a-47df7a000000\nTime:2019-07-30T19:13:33.0829066Z", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share598295ec" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesInvalidMaxResults.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesInvalidMaxResults.json deleted file mode 100644 index 2beb5fd80fa4..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesInvalidMaxResults.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share85200d7d&maxresults=-1&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "461", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed237-b01a-000d-2f0a-47df7a000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:9ebed237-b01a-000d-2f0a-47df7a000000\nTime:2019-07-30T19:13:34.7895274Zmaxresults-112147483647", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share85200d7d&maxresults=0&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "460", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed238-b01a-000d-300a-47df7a000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:9ebed238-b01a-000d-300a-47df7a000000\nTime:2019-07-30T19:13:34.8155527Zmaxresults012147483647", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share85200d7d&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed239-b01a-000d-310a-47df7a000000", - "Body" : "share85200d7d", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share85200d7d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithLimit.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithLimit.json deleted file mode 100644 index 6be5b68ae78a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithLimit.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522018BF475\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:29 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1bf-b01a-000d-570a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:29 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152201A10830\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:29 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1c2-b01a-000d-580a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:29 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152201A6AEE5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:29 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1c4-b01a-000d-590a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:29 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share259041ce&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1c6-b01a-000d-5a0a-47df7a000000", - "Body" : "share259041ce2share259041ce0Tue, 30 Jul 2019 19:13:29 GMT\"0x8D71522018BF475\"2share259041ce1Tue, 30 Jul 2019 19:13:29 GMT\"0x8D7152201A10830\"2/azstoragesdkaccount/share259041ce2", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share259041ce&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1c9-b01a-000d-5c0a-47df7a000000", - "Body" : "share259041ceshare259041ce0Tue, 30 Jul 2019 19:13:29 GMT\"0x8D71522018BF475\"2share259041ce1Tue, 30 Jul 2019 19:13:29 GMT\"0x8D7152201A10830\"2share259041ce2Tue, 30 Jul 2019 19:13:29 GMT\"0x8D7152201A6AEE5\"2", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1ca-b01a-000d-5d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1cb-b01a-000d-5e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1cc-b01a-000d-5f0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - } ], - "variables" : [ "share259041ce" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithPrefix.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithPrefix.json deleted file mode 100644 index c103a309d2c6..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithPrefix.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203B43D11\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed20d-b01a-000d-100a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6f1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203BA0ACA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed20f-b01a-000d-110a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203BF3C3A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed212-b01a-000d-130a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share71892b6fprefix&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed214-b01a-000d-140a-47df7a000000", - "Body" : "share71892b6fprefixshare71892b6fprefix0Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203B43D11\"2share71892b6fprefix2Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203BF3C3A\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share71892b6f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed216-b01a-000d-150a-47df7a000000", - "Body" : "share71892b6fshare71892b6f1Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203BA0ACA\"2share71892b6fprefix0Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203B43D11\"2share71892b6fprefix2Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203BF3C3A\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6f1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed217-b01a-000d-160a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed218-b01a-000d-170a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed219-b01a-000d-180a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - } ], - "variables" : [ "share71892b6f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setFileServiceProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setFileServiceProperties.json deleted file mode 100644 index 2e0fc5377a60..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setFileServiceProperties.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed227-b01a-000d-230a-47df7a000000", - "Body" : "1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed228-b01a-000d-240a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed22d-b01a-000d-250a-47df7a000000", - "Body" : "1.0truefalsetrue31.0truefalsetrue3", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed22e-b01a-000d-260a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed22f-b01a-000d-270a-47df7a000000", - "Body" : "1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share33310c2f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed230-b01a-000d-280a-47df7a000000", - "Body" : "share33310c2f", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share33310c2f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setHttpHeadersFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setHttpHeadersFromFileClient.json deleted file mode 100644 index 8d4483aa1aa1..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setHttpHeadersFromFileClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile12606bdf", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215077D535\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df88-301a-00db-0a0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile12606bdf?comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521508089E4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df89-301a-00db-0b0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - } ], - "variables" : [ "file12606bdf" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMeatadataFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMeatadataFromFileClient.json deleted file mode 100644 index b234518e7cf3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMeatadataFromFileClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile70778cc8", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521509A0B80\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df8c-301a-00db-0e0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile70778cc8?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150A1AE7A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df8d-301a-00db-0f0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - } ], - "variables" : [ "file70778cc8" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json deleted file mode 100644 index 87a7fd88db4e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39749379?restype=share&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b10-901a-0077-430a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b10-901a-0077-430a-47b537000000\nTime:2019-07-30T19:10:58.7609132Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39749379?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b11-901a-0077-440a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b11-901a-0077-440a-47b537000000\nTime:2019-07-30T19:10:58.7909414Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share39749379" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromDirClient.json deleted file mode 100644 index 7bc79062363c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory183331?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9B3AFB2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c14-901a-0077-630a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory183331?restype=directory&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9BBEF19\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c15-901a-0077-640a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory183331" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromShareClient.json deleted file mode 100644 index 9f443d394def..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromShareClient.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A2F8018\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e08e-301a-00db-190a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A363931\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e090-301a-00db-1a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "5120", - "ETag" : "\"0x8D715218A363931\"", - "x-ms-has-immutability-policy" : "false", - "x-ms-meta-setting" : "metadata", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e091-301a-00db-1b0a-4794a0000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e092-301a-00db-1c0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share75652b90" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json deleted file mode 100644 index 3e6a99736af3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory858094?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9A2948A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c12-901a-0077-610a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory858094?restype=directory&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidMetadata", - "retry-after" : "0", - "Content-Length" : "260", - "StatusCode" : "400", - "x-ms-request-id" : "260a2c13-901a-0077-620a-47b537000000", - "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:260a2c13-901a-0077-620a-47b537000000\nTime:2019-07-30T19:11:55.7765485Z", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory858094" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json deleted file mode 100644 index 7d7b382328f3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share52103857?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9FDB6DE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b39-901a-0077-600a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share52103857?restype=share&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "EmptyMetadataKey", - "retry-after" : "0", - "Content-Length" : "281", - "StatusCode" : "400", - "x-ms-request-id" : "260a2b3b-901a-0077-610a-47b537000000", - "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:260a2b3b-901a-0077-610a-47b537000000\nTime:2019-07-30T19:11:02.6625831Zmetadata", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share52103857?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b3c-901a-0077-620a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - } ], - "variables" : [ "share52103857" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPolicies.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPolicies.json deleted file mode 100644 index 4c58ad1d9bd6..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPolicies.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218881B367\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e045-301a-00db-630a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521888930E8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e048-301a-00db-640a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521888930E8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e049-301a-00db-650a-4794a0000000", - "Body" : "test2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zr", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e04a-301a-00db-660a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - } ], - "variables" : [ "share554792f6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesDoesNotExist.json deleted file mode 100644 index ac5c956d274e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share10194f73?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e083-301a-00db-110a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e083-301a-00db-110a-4794a0000000\nTime:2019-07-30T19:10:08.7081930Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share10194f73?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e084-301a-00db-120a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e084-301a-00db-120a-4794a0000000\nTime:2019-07-30T19:10:08.7382231Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share10194f73" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesInvalidPermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesInvalidPermission.json deleted file mode 100644 index 715ea390de82..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesInvalidPermission.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share990513c2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A5BA17CE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0de-301a-00db-3a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share990513c2?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e0e0-301a-00db-3b0a-4794a0000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:7f75e0e0-301a-00db-3b0a-4794a0000000\nTime:2019-07-30T19:10:55.5105372Z00", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share990513c2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Connection" : "close", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0e1-301a-00db-3c0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - } ], - "variables" : [ "share990513c2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesTooManyPermissions.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesTooManyPermissions.json deleted file mode 100644 index d573484b4abd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesTooManyPermissions.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16077c14?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218949057A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e067-301a-00db-7d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16077c14?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e069-301a-00db-7e0a-4794a0000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:7f75e069-301a-00db-7e0a-4794a0000000\nTime:2019-07-30T19:10:07.8003122Z00", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16077c14?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e06a-301a-00db-7f0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - } ], - "variables" : [ "share16077c14" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json deleted file mode 100644 index 1f9aa5404995..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share804506e6?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b31-901a-0077-590a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b31-901a-0077-590a-47b537000000\nTime:2019-07-30T19:11:02.3733121Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share804506e6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b32-901a-0077-5a0a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b32-901a-0077-5a0a-47b537000000\nTime:2019-07-30T19:11:02.4103463Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share804506e6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesFromShareClient.json deleted file mode 100644 index a57945bad8b7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesFromShareClient.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9E23903\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b33-901a-0077-5b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-share-quota" : "2", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9E23903\"", - "x-ms-has-immutability-policy" : "false", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b35-901a-0077-5c0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "x-ms-has-legal-hold" : "false" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9EC63FB\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b36-901a-0077-5d0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-share-quota" : "4", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9EC63FB\"", - "x-ms-has-immutability-policy" : "false", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b37-901a-0077-5e0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "x-ms-has-legal-hold" : "false" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b38-901a-0077-5f0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - } ], - "variables" : [ "share291723a2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json deleted file mode 100644 index 9b0443b1009a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed21a-b01a-000d-190a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed21a-b01a-000d-190a-47df7a000000\nTime:2019-07-30T19:13:33.4682715Z00", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share515698b3&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed21b-b01a-000d-1a0a-47df7a000000", - "Body" : "share515698b3", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share515698b3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json deleted file mode 100644 index 2774b86d722c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlNodeValue", - "retry-after" : "0", - "Content-Length" : "340", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed231-b01a-000d-290a-47df7a000000", - "Body" : "InvalidXmlNodeValueThe value for one of the XML nodes is not in the correct format.\nRequestId:9ebed231-b01a-000d-290a-47df7a000000\nTime:2019-07-30T19:13:34.5983455ZAllowedMethodsNOTAREALHTTPMETHOD", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share33180966&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed232-b01a-000d-2a0a-47df7a000000", - "Body" : "share33180966", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share33180966" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json deleted file mode 100644 index 942aba65db1b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed233-b01a-000d-2b0a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed233-b01a-000d-2b0a-47df7a000000\nTime:2019-07-30T19:13:34.6614058Z00", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share28616d87&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed234-b01a-000d-2c0a-47df7a000000", - "Body" : "share28616d87", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share28616d87" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json deleted file mode 100644 index 949ad86ece86..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed235-b01a-000d-2d0a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed235-b01a-000d-2d0a-47df7a000000\nTime:2019-07-30T19:13:34.7244657Z00", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share3940172f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed236-b01a-000d-2e0a-47df7a000000", - "Body" : "share3940172f", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share3940172f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json deleted file mode 100644 index 2e6a1ceb5ca5..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152189B15717\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e07a-301a-00db-0a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "324", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e07c-301a-00db-0b0a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e07c-301a-00db-0b0a-4794a0000000\nTime:2019-07-30T19:10:08.4799715Zx-ms-share-quota-1", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "326", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e07d-301a-00db-0c0a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e07d-301a-00db-0c0a-4794a0000000\nTime:2019-07-30T19:10:08.5079992Zx-ms-share-quota9999", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e07e-301a-00db-0d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - } ], - "variables" : [ "share1339920e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesTooManyRules.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesTooManyRules.json deleted file mode 100644 index a5b7693f19ff..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesTooManyRules.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/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-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed1d7-b01a-000d-670a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed1d7-b01a-000d-670a-47df7a000000\nTime:2019-07-30T19:13:30.9779017Z00", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share49855583&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1d8-b01a-000d-680a-47df7a000000", - "Body" : "share49855583", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share49855583" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshot.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshot.json deleted file mode 100644 index b9d45b179291..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshot.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share66242c38?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A628397\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e097-301a-00db-1f0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share66242c38?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:09.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A628397\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e099-301a-00db-200a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share66242c38?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e09a-301a-00db-210a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e09a-301a-00db-210a-4794a0000000\nTime:2019-07-30T19:10:09.6971528Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share66242c38" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDifferentMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDifferentMetadata.json deleted file mode 100644 index 6d1902728e91..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDifferentMetadata.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188EF5D81\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e058-301a-00db-710a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:07.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188D55180\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e05a-301a-00db-720a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-meta-create" : "metadata", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D7152188EF5D81\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e05b-301a-00db-730a-4794a0000000" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?sharesnapshot=2019-07-30T19%3a10%3a07.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-update" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D7152188D55180\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4b9d1-f01a-00c6-780a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e05c-301a-00db-740a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e05c-301a-00db-740a-4794a0000000\nTime:2019-07-30T19:10:07.3318585Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share80587c91" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDoesNotExist.json deleted file mode 100644 index 38bd90e2f283..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39064b26?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e085-301a-00db-130a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e085-301a-00db-130a-4794a0000000\nTime:2019-07-30T19:10:09.0014779Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39064b26?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e088-301a-00db-140a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e088-301a-00db-140a-4794a0000000\nTime:2019-07-30T19:10:09.0355109Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share39064b26" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotSameMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotSameMetadata.json deleted file mode 100644 index e580cd8f500e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotSameMetadata.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A8416B16\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b28-901a-0077-540a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:11:02.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A99DA700\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b2a-901a-0077-550a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:01 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?sharesnapshot=2019-07-30T19%3a11%3a02.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:11:01 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521A99DA700\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4ba40-f01a-00c6-190a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b30-901a-0077-580a-47b537000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:260a2b30-901a-0077-580a-47b537000000\nTime:2019-07-30T19:11:02.2862300Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share77185685" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/startCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/startCopy.json deleted file mode 100644 index ab7930ece536..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/startCopy.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile915691d2", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715214FD29388\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df77-301a-00db-790a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile915691d2", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-copy-id" : "018a4780-d459-45ef-9817-a418018f33fc", - "ETag" : "\"0x8D715214FF7628A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-copy-status" : "success", - "StatusCode" : "202", - "x-ms-request-id" : "7f75df78-301a-00db-7a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - } ], - "variables" : [ "file915691d2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/upload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/upload.json deleted file mode 100644 index 121bfdcd3639..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/upload.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile69101ec0", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150338FB7\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df80-301a-00db-020a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile69101ec0?comp=range", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521503A964B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df81-301a-00db-030a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" - } - } ], - "variables" : [ "file69101ec0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/uploadToStorageAndDownloadToFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/uploadToStorageAndDownloadToFile.json deleted file mode 100644 index 27a99dece195..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/uploadToStorageAndDownloadToFile.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150452030\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df82-301a-00db-040a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979?comp=range", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521504E713B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df83-301a-00db-050a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-MD5" : "/CTzx8jXJ1MqqUsC1dJBUQ==" - } - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D71521504E713B\"", - "Content-Length" : "14", - "x-ms-request-id" : "7f75df84-301a-00db-060a-4794a0000000", - "Body" : "", - "Content-Type" : "application/octet-stream" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Content-Range" : "bytes 0-13/14", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "206", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Accept-Ranges" : "bytes", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D71521504E713B\"", - "Content-Length" : "14", - "x-ms-request-id" : "7f75df85-301a-00db-070a-4794a0000000", - "Body" : "Hello world!\r\n", - "Content-Type" : "application/octet-stream" - } - } ], - "variables" : [ "file72051979" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/urlFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/urlFromDirClient.json deleted file mode 100644 index 28d83f0a0211..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/urlFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory16915c" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/swagger/README.md b/sdk/storage/azure-storage-file/swagger/README.md new file mode 100644 index 000000000000..4f591f62e857 --- /dev/null +++ b/sdk/storage/azure-storage-file/swagger/README.md @@ -0,0 +1,557 @@ +# Azure File 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.FileStorage/preview/2019-02-02/file.json +java: true +output-folder: ../ +namespace: com.azure.storage.file +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +``` + +### Query Parameters +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + if (!$.DirectoryPath) { + $.DirectoryPath = { + "name": "directoryPath", + "in": "path", + "description": "The path of the target directory.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "x-ms-skip-url-encoding": false + }; + } + if (!$.FilePath) { + $.FilePath = { + "name": "filePath", + "in": "path", + "description": "The path of the target file.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "x-ms-skip-url-encoding": false + }; + } + if (!$.ShareName) { + $.ShareName = { + "name": "shareName", + "in": "path", + "description": "The name of the target share.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }; + } +``` + +### /?restype=service&comp=properties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.FileServiceProperties) { + const props = $.FileServiceProperties = $.StorageServiceProperties; + props.xml = { "name": "StorageServiceProperties" }; + delete $.StorageServiceProperties; + } +- from: swagger-document + where: $.parameters + transform: > + if (!$.FileServiceProperties) { + const props = $.FileServiceProperties = $.StorageServiceProperties; + props.name = "FileServiceProperties"; + props.description = "The FileStorage properties."; + props.schema = { "$ref": props.schema.$ref.replace(/[#].*$/, "#/definitions/FileServiceProperties") }; + delete $.StorageServiceProperties; + } +- from: swagger-document + where: $["x-ms-paths"]["/?restype=service&comp=properties"] + transform: > + const param = $.put.parameters[0]; + if (param && param["$ref"] && param["$ref"].endsWith("StorageServiceProperties")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/FileServiceProperties"); + $.put.parameters[0] = { "$ref": path }; + } + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && def["$ref"].endsWith("StorageServiceProperties")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/FileServiceProperties"); + $.get.responses["200"].schema = { "$ref": path }; + } +``` + +### /{shareName}?restype=share +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=filepermission +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=filepermission"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } + param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=properties"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=snapshot +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=snapshot"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=acl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=acl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + + +### /{shareName}?restype=share&comp=stats +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=stats"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}/{directoryPath}?restype=directory +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory"] = $["/{shareName}/{directory}?restype=directory"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + op.delete.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.delete.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory"]; + op.put.responses["201"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-change-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{directoryPath}?restype=directory&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory&comp=properties"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory&comp=properties"] = $["/{shareName}/{directory}?restype=directory&comp=properties"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory&comp=properties"]; + op.put.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{directoryPath}?restype=directory&comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory&comp=metadata"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory&comp=metadata"] = $["/{shareName}/{directory}?restype=directory&comp=metadata"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory&comp=metadata"]; + } +``` + +### /{shareName}/{directoryPath}?restype=directory&comp=list +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory&comp=list"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory&comp=list"] = $["/{shareName}/{directory}?restype=directory&comp=list"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory&comp=list"]; + } +``` + +### /{shareName}/{directoryPath}?comp=listhandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?comp=listhandles"]) { + const op = $["/{shareName}/{directoryPath}?comp=listhandles"] = $["/{shareName}/{directory}?comp=listhandles"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?comp=listhandles"]; + } +``` + +### /{shareName}/{directoryPath}?comp=forceclosehandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?comp=forceclosehandles"]) { + const op = $["/{shareName}/{directoryPath}?comp=forceclosehandles"] = $["/{shareName}/{directory}?comp=forceclosehandles"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?comp=forceclosehandles"]; + } +``` + +### /{shareName}/{filePath} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}"]) { + const op = $["/{shareName}/{filePath}"] = $["/{shareName}/{directory}/{fileName}"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + op.head.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.head.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete op.head.responses.default.schema; + op.delete.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.delete.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}"]; + op.put.responses["201"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-change-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + op.get.responses["206"].headers["x-ms-file-creation-time"].format = "date-time"; + op.get.responses["206"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.get.responses["206"].headers["x-ms-file-change-time"].format = "date-time"; + op.head.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.head.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.head.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{filePath}?comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=properties"]) { + const op = $["/{shareName}/{filePath}?comp=properties"] = $["/{shareName}/{directory}/{fileName}?comp=properties"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=properties"]; + op.put.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{filePath}?comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=metadata"]) { + const op = $["/{shareName}/{filePath}?comp=metadata"] = $["/{shareName}/{directory}/{fileName}?comp=metadata"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=metadata"]; + } +``` + +### /{shareName}/{filePath}?comp=range +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=range"]) { + const op = $["/{shareName}/{filePath}?comp=range"] = $["/{shareName}/{directory}/{fileName}?comp=range"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=range"]; + } +``` + +### /{shareName}/{filePath}?comp=range&fromURL +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=range&fromURL"]) { + const op = $["/{shareName}/{filePath}?comp=range&fromURL"] = $["/{shareName}/{directory}/{fileName}?comp=range&fromURL"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=range&fromURL"]; + } +``` + +### /{shareName}/{filePath}?comp=rangelist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=rangelist"]) { + const op = $["/{shareName}/{filePath}?comp=rangelist"] = $["/{shareName}/{directory}/{fileName}?comp=rangelist"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=rangelist"]; + } +``` + +### /{shareName}/{filePath}?comp=copy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=copy"]) { + const op = $["/{shareName}/{filePath}?comp=copy"] = $["/{shareName}/{directory}/{fileName}?comp=copy"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=copy"]; + } +``` + +### /{shareName}/{filePath}?comp=copy©id={CopyId} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=copy©id={CopyId}"]) { + const op = $["/{shareName}/{filePath}?comp=copy©id={CopyId}"] = $["/{shareName}/{directory}/{fileName}?comp=copy©id={CopyId}"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=copy©id={CopyId}"]; + } +``` + +### /{shareName}/{filePath}?comp=listhandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=listhandles"]) { + const op = $["/{shareName}/{filePath}?comp=listhandles"] = $["/{shareName}/{directory}/{fileName}?comp=listhandles"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=listhandles"]; + } +``` + +### /{shareName}/{filePath}?comp=forceclosehandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=forceclosehandles"]) { + const op = $["/{shareName}/{filePath}?comp=forceclosehandles"] = $["/{shareName}/{directory}/{fileName}?comp=forceclosehandles"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=forceclosehandles"]; + } +``` + +### ShareProperties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.ShareProperties.properties.Metadata) { + const path = $.ShareItem.properties.Metadata.$ref; + $.ShareProperties.properties.Metadata = { "$ref": path }; + } +``` + +### ShareUsageBytes +``` yaml +directive: +- from: swagger-document + where: $.definitions.ShareStats.properties.ShareUsageBytes + transform: > + $.description = "The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value may not include all recently created or recently resized files."; + $.format = "int64"; +``` + +### ApiVersionParameter +``` yaml +directive: +- from: swagger-document + where: $.parameters.ApiVersionParameter + transform: > + $.enum = [ "2019-02-02" ]; +``` + +### Convert FileCreationTime and FileLastWriteTime to String to Support 'now' +``` yaml +directive: +- from: swagger-document + where: $.parameters.FileCreationTime + transform: > + delete $.format; +- from: swagger-document + where: $.parameters.FileLastWriteTime + transform: > + delete $.format; +``` + +### FileRangeWriteFromUrl Constant +``` yaml +directive: +- from: swagger-document + where: $.parameters.FileRangeWriteFromUrl + transform: > + delete $.default; + delete $["x-ms-enum"]; + $["x-ms-parameter-location"] = "method"; +``` + +### Add the CustomFileAndDirectoryListingDeserializer attribute +``` yaml +directive: +- from: FilesAndDirectoriesListSegment.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 FilesAndDirectoriesListSegment {", + "@JsonDeserialize(using = CustomFileAndDirectoryListingDeserializer.class)\npublic final class FilesAndDirectoriesListSegment {"); +``` diff --git a/sdk/storage/azure-storage-file/swagger/file.json b/sdk/storage/azure-storage-file/swagger/file.json deleted file mode 100644 index 26efc70f6af0..000000000000 --- a/sdk/storage/azure-storage-file/swagger/file.json +++ /dev/null @@ -1,3810 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure File 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": { - "File_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 File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [{ - "$ref": "#/parameters/FileServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - } - } - }, - "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 File service, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [{ - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - } - }, - "schema": { - "$ref": "#/definitions/FileServiceProperties" - } - }, - "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" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListSharesSegment", - "description": "The List Shares Segment operation returns a list of the shares and share snapshots under the specified account.", - "parameters": [{ - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListSharesInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - } - }, - "schema": { - "$ref": "#/definitions/ListSharesResponse" - } - }, - "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" - ] - }] - }, - "/{shareName}?restype=share": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_Create", - "description": "Creates a new share under the specified account. If the share with the same name already exists, the operation fails.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ShareQuota" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success, Share created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the share, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties or metadata updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ], - "operationId": "Share_GetProperties", - "description": "Returns all user-defined metadata and system properties for the specified share or share snapshot. The data returned does not include the share's list of files.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs that contain the user-defined metadata of the share.", - "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, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-share-quota": { - "x-ms-client-name": "Quota", - "type": "integer", - "description": "Returns the current share quota in GB." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "share" - ], - "operationId": "Share_Delete", - "description": "Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/DeleteSnapshots" - } - ], - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ] - }] - }, - "/{shareName}?restype=share&comp=snapshot": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_CreateSnapshot", - "description": "Creates a read-only snapshot of a share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success, Share snapshot created.", - "headers": { - "x-ms-snapshot": { - "x-ms-client-name": "Snapshot", - "type": "string", - "description": "This header is a DateTime value that uniquely identifies the share snapshot. The value of this header may be used in subsequent requests to access the share snapshot. This value is opaque." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the share snapshot, in quotes. A share snapshot cannot be modified, so the ETag of a given share snapshot never changes. However, if new metadata was supplied with the Snapshot Share request then the ETag of the share snapshot differs from that of the base share. If no metadata was specified with the request, the ETag of the share snapshot is identical to that of the base share at the time the share snapshot was taken." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. A share snapshot cannot be modified, so the last modified time of a given share snapshot never changes. However, if new metadata was supplied with the Snapshot Share request then the last modified time of the share snapshot differs from that of the base share. If no metadata was specified with the request, the last modified time of the share snapshot is identical to that of the base share at the time the share snapshot was taken." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "snapshot" - ] - } - ] - }, - "/{shareName}?restype=share&comp=properties": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_SetQuota", - "description": "Sets quota for the specified share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ShareQuota" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{shareName}?restype=share&comp=metadata": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_SetMetadata", - "description": "Sets one or more user-defined name-value pairs for the specified share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{shareName}?restype=share&comp=acl": { - "get": { - "tags": [ - "share" - ], - "operationId": "Share_GetAccessPolicy", - "description": "Returns information about stored access policies specified on the share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ], - "operationId": "Share_SetAccessPolicy", - "description": "Sets a stored access policy for use with shared access signatures.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/ShareAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{shareName}?restype=share&comp=stats": { - "get": { - "tags": [ - "share" - ], - "operationId": "Share_GetStatistics", - "description": "Retrieves statistics related to the share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ShareStats" - } - }, - "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": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/{shareName}/{directoryPath}?restype=directory": { - "put": { - "tags": [ - "directory" - ], - "operationId": "Directory_Create", - "description": "Creates a new directory under the specified share or parent directory.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success, Directory created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the directory, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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" - } - } - } - }, - "get": { - "tags": [ - "directory" - ], - "operationId": "Directory_GetProperties", - "description": "Returns all system properties for the specified directory, and can also be used to check the existence of a directory. The data returned does not include the files in the directory or any subdirectories.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs that contain metadata for the directory.", - "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, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the Directory was last modified. Operations on files within the directory do not affect the last modified time of the directory." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "directory" - ], - "operationId": "Directory_Delete", - "description": "Removes the specified empty directory. Note that the directory must be empty before it can be deleted.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "directory" - ] - }] - }, - "/{shareName}/{directoryPath}?restype=directory&comp=metadata": { - "put": { - "tags": [ - "directory" - ], - "operationId": "Directory_SetMetadata", - "description": "Updates user defined metadata for the specified directory.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK).", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the directory, in quotes." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "directory" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{shareName}/{directoryPath}?restype=directory&comp=list": { - "get": { - "tags": [ - "directory" - ], - "operationId": "Directory_ListFilesAndDirectoriesSegment", - "description": "Returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "Specifies the format in which the results are returned. Currently this value 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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ListFilesAndDirectoriesSegmentResponse" - } - }, - "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": [ - "directory" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{shareName}/{directoryPath}?comp=listhandles": { - "get":{ - "tags": [ - "directory" - ], - "operationId": "Directory_ListHandles", - "description": "Lists handles for directory.", - "parameters":[ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Recursive" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "Specifies the format in which the results are returned. Currently this value 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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ListHandlesResponse" - } - }, - "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": [ - "listhandles" - ] - } - ] - }, - "/{shareName}/{directoryPath}?comp=forceclosehandles": { - "put": { - "tags": [ - "directory" - ], - "operationId": "Directory_ForceCloseHandles", - "description": "Closes all handles open for given directory.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/HandleId" - }, - { - "$ref": "#/parameters/Recursive" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-marker": { - "x-ms-client-name": "marker", - "type": "string", - "description": "A string describing next handle to be closed. It is returned when more handles need to be closed to complete the request." - }, - "x-ms-number-of-handles-closed": { - "x-ms-client-name": "numberOfHandlesClosed", - "type": "integer", - "description": "Contains count of number of handles closed." - } - } - }, - "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": [ - "forceclosehandles" - ] - } - ] - }, - "/{shareName}/{filePath}": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_Create", - "description": "Creates a new file or replaces a file. Note it only initializes the file with no content.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "name": "x-ms-content-length", - "x-ms-client-name": "fileContentLength", - "in": "header", - "description": "Specifies the maximum size for the file, up to 1 TB.", - "required": true, - "type": "integer", - "format": "int64" - }, - { - "$ref": "#/parameters/FileType" - }, - { - "$ref": "#/parameters/FileContentType" - }, - { - "$ref": "#/parameters/FileContentEncoding" - }, - { - "$ref": "#/parameters/FileContentLanguage" - }, - { - "$ref": "#/parameters/FileCacheControl" - }, - { - "$ref": "#/parameters/FileContentMD5" - }, - { - "$ref": "#/parameters/FileContentDisposition" - }, - { - "$ref": "#/parameters/Metadata" - } - ], - "responses": { - "201": { - "description": "Success, File created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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" - } - } - } - }, - "get": { - "tags": [ - "file" - ], - "operationId": "File_Download", - "description": "Reads or downloads a file from the system, including its metadata and properties.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/GetRangeContentMD5" - } - ], - "responses": { - "200": { - "description": "Succeeded to read the entire file.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the file was last modified. Any operation that modifies the file or its properties updates the last modified time." - }, - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs associated with this file as user-defined metadata.", - "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 content type specified for the file. The default content type is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned if the client requested a subset of the file 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, in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the file has an MD5 hash and the request is to read the full file, this response header is returned so that the client can check for message content integrity. If the request is to read a specified range and the 'x-ms-range-get-content-md5' is set to true, then the request returns an MD5 hash for the range, as long as the range size is less than or equal to 4 MB. If neither of these sets of conditions is true, then no value is returned for the 'Content-MD5' header." - }, - "Content-Encoding": { - "type": "string", - "description": "Returns the value that was specified for the Content-Encoding request header." - }, - "Cache-Control": { - "type": "string", - "description": "Returned if it was previously specified for the file." - }, - "Content-Disposition": { - "type": "string", - "description": "Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process the response." - }, - "Content-Language": { - "type": "string", - "description": "Returns the value that was specified for the Content-Language request header." - }, - "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 File service used to execute the request." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial file content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt." - }, - "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 cause of fatal or non-fatal copy operation failure." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for the last attempted Copy File operation where this file was the destination file." - }, - "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 File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied." - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file." - }, - "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-content-md5": { - "x-ms-client-name": "FileContentMD5", - "type": "string", - "format": "byte", - "description": "If the file 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 file'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." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the file is unencrypted, or if only parts of the file/application metadata are encrypted)." - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "206": { - "description": "Succeeded to read a specified range of the file.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the file was last modified. Any operation that modifies the file or its properties updates the last modified time." - }, - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs associated with this file as user-defined metadata.", - "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 content type specified for the file. The default content type is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned if the client requested a subset of the file 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, in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the file has an MD5 hash and the request is to read the full file, this response header is returned so that the client can check for message content integrity. If the request is to read a specified range and the 'x-ms-range-get-content-md5' is set to true, then the request returns an MD5 hash for the range, as long as the range size is less than or equal to 4 MB. If neither of these sets of conditions is true, then no value is returned for the 'Content-MD5' header." - }, - "Content-Encoding": { - "type": "string", - "description": "Returns the value that was specified for the Content-Encoding request header." - }, - "Cache-Control": { - "type": "string", - "description": "Returned if it was previously specified for the file." - }, - "Content-Disposition": { - "type": "string", - "description": "Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process the response." - }, - "Content-Language": { - "type": "string", - "description": "Returns the value that was specified for the Content-Language request header." - }, - "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 File service used to execute the request." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial file content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt." - }, - "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 cause of fatal or non-fatal copy operation failure." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for the last attempted Copy File operation where this file was the destination file." - }, - "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 File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied." - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file." - }, - "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-content-md5": { - "x-ms-client-name": "FileContentMD5", - "type": "string", - "format": "byte", - "description": "If the file 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 file'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." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the file is unencrypted, or if only parts of the file/application metadata are encrypted)." - } - }, - "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": [ - "file" - ], - "operationId": "File_GetProperties", - "description": "Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the file was last modified. The date format follows RFC 1123. Any operation that modifies the file or its properties updates the last modified time." - }, - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs associated with this file as user-defined metadata.", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-type": { - "x-ms-client-name": "FileType", - "description": "Returns the type File. Reserved for future use.", - "type": "string", - "enum": [ - "File" - ] - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The size of the file in bytes. This header returns the value of the 'x-ms-content-length' header that is stored with the file." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the file. 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, in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the Content-MD5 header has been set for the file, the Content-MD5 response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "If the Content-Encoding request header has previously been set for the file, the Content-Encoding value is returned in this header." - }, - "Cache-Control": { - "type": "string", - "description": "If the Cache-Control request header has previously been set for the file, the Cache-Control value is returned in this header." - }, - "Content-Disposition": { - "type": "string", - "description": "Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process the response." - }, - "Content-Language": { - "type": "string", - "description": "Returns the value that was specified for the Content-Language request header." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt." - }, - "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 cause of fatal or non-fatal copy operation failure." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for the last attempted Copy File operation where this file was the destination file." - }, - "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 File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied." - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file." - }, - "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-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the file is unencrypted, or if only parts of the file/application metadata are encrypted)." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - } - } - }, - "delete": { - "tags": [ - "file" - ], - "operationId": "File_Delete", - "description": "removes the file from the storage account.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - - ] - }, - "/{shareName}/{filePath}?comp=properties": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_SetHTTPHeaders", - "description": "Sets HTTP headers on the file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "name": "x-ms-content-length", - "x-ms-client-name": "fileContentLength", - "in": "header", - "description": "Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared.", - "required": false, - "type": "integer", - "format": "int64" - }, - { - "$ref": "#/parameters/FileContentType" - }, - { - "$ref": "#/parameters/FileContentEncoding" - }, - { - "$ref": "#/parameters/FileContentLanguage" - }, - { - "$ref": "#/parameters/FileCacheControl" - }, - { - "$ref": "#/parameters/FileContentMD5" - }, - { - "$ref": "#/parameters/FileContentDisposition" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the directory was last modified. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "properties" - ] - }] - }, - "/{shareName}/{filePath}?comp=metadata": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_SetMetadata", - "description": "Updates user-defined metadata for the specified file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK).", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "metadata" - ] - }] - }, - "/{shareName}/{filePath}?comp=range": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_UploadRange", - "description": "Upload a range of bytes to a file.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/OptionalBody" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "description": "Specifies the range of bytes to be written. Both the start and end of the range must be specified. For an update operation, the range can be up to 4 MB in size. For a clear operation, the range can be up to the value of the file's full size. The File service accepts only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be specified in the following format: bytes=startByte-endByte.", - "required": true, - "type": "string" - }, - { - "name": "x-ms-write", - "x-ms-client-name": "FileRangeWrite", - "in": "header", - "description": "Specify one of the following options: - 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. - 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 set the Range header to a value that indicates the range to clear, up to maximum file size.", - "required": true, - "type": "string", - "enum": [ - "update", - "clear" - ], - "default": "update", - "x-ms-enum": { - "name": "FileRangeWriteType", - "modelAsString": false - } - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success (Created).", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the directory was last modified. Any operation that modifies the share or its properties or metadata updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "This header is returned so that the client can check for message content integrity. The value of this header is computed by the File service; it is not necessarily the same value as may have been specified in the request 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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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": [ - "range" - ] - }] - }, - "/{shareName}/{filePath}?comp=rangelist": { - "get": { - "tags": [ - "file" - ], - "operationId": "File_GetRangeList", - "description": "Returns the list of valid ranges for a file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "description": "Specifies the range of bytes over which to list ranges, inclusively.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The date/time that the file was last modified. Any operation that modifies the file, including an update of the file's metadata or properties, changes the file's last modified time." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "x-ms-content-length": { - "x-ms-client-name": "FileContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the file 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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/RangeList" - } - }, - "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": [ - "rangelist" - ] - }] - }, - "/{shareName}/{filePath}?comp=copy": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_StartCopy", - "description": "Copies a blob or file to a destination file within the storage account.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/CopySource" - } - ], - "responses": { - "202": { - "description": "The copy file has been accepted with the specified copy status.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "If the copy is completed, contains the ETag of the destination file. If the copy is not complete, contains the ETag of the empty file created at the start of the copy." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date/time that the copy operation to the destination file completed." - }, - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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 File or Get File Properties to check the status of this copy operation, or pass to Abort Copy File 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": [ - - ] - }, - "/{shareName}/{filePath}?comp=copy©id={CopyId}": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_AbortCopy", - "description": "Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/CopyId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/CopyActionAbort" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "204": { - "description": "The delete request was accepted and the file 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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A 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" - ] - }] - }, - "/{shareName}/{filePath}?comp=listhandles": { - "get":{ - "tags": [ - "file" - ], - "operationId": "File_ListHandles", - "description": "Lists handles for file", - "parameters":[ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "Specifies the format in which the results are returned. Currently this value 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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ListHandlesResponse" - } - }, - "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": [ - "listhandles" - ] - } - ] - }, - "/{shareName}/{filePath}?comp=forceclosehandles": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_ForceCloseHandles", - "description": "Closes all handles open for given file", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/HandleId" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "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 File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-marker": { - "x-ms-client-name": "marker", - "type": "string", - "description": "A string describing next handle to be closed. It is returned when more handles need to be closed to complete the request." - }, - "x-ms-number-of-handles-closed": { - "x-ms-client-name": "numberOfHandlesClosed", - "type": "integer", - "description": "Contains count of number of handles closed." - } - } - }, - "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": [ - "forceclosehandles" - ] - } - ] - } - }, - "definitions": { - "AccessPolicy": { - "description": "An Access policy.", - "type": "object", - "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" - } - } - }, - "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", - "CannotDeleteFileOrDirectory", - "ClientCacheFlushDelay", - "DeletePending", - "DirectoryNotEmpty", - "FileLockConflict", - "InvalidFileOrDirectoryPathName", - "ParentNotFound", - "ReadOnlyAttribute", - "ShareAlreadyExists", - "ShareBeingDeleted", - "ShareDisabled", - "ShareNotFound", - "SharingViolation", - "ShareSnapshotInProgress", - "ShareSnapshotCountExceeded", - "ShareSnapshotOperationNotSupported", - "ShareHasSnapshots", - "ContainerQuotaDowngradeNotAllowed" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "FilesAndDirectoriesListSegment": { - "description": "Abstract for entries that can be listed from Directory.", - "type": "object", - "required": [ - "DirectoryItems", - "FileItems" - ], - "properties": { - "DirectoryItems": { - "type": "array", - "items": { - "$ref": "#/definitions/DirectoryItem" - } - }, - "FileItems": { - "type": "array", - "items": { - "$ref": "#/definitions/FileItem" - } - } - }, - "xml": { - "name": "Entries" - } - }, - "DirectoryItem": { - "xml": { - "name": "Directory" - }, - "description": "A listed directory item.", - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string" - } - } - }, - "FileItem": { - "xml": { - "name": "File" - }, - "description": "A listed file item.", - "type": "object", - "required": [ - "Name", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/FileProperty" - } - } - }, - "FileProperty": { - "description": "File properties.", - "type": "object", - "required": [ - "Content-Length" - ], - "properties": { - "Content-Length": { - "description": "Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties.", - "type": "integer", - "format": "int64" - } - } - }, - "HandleItem" : { - "xml": { - "name": "Handle" - }, - "description": "A listed Azure Storage handle item.", - "type": "object", - "required": [ - "HandleId", - "Path", - "FileId", - "SessionId", - "ClientIp", - "OpenTime" - ], - "properties": { - "HandleId": { - "type": "string", - "description": "XSMB service handle ID" - }, - "Path": { - "type": "string", - "description": "File or directory name including full path starting from share root" - }, - "FileId": { - "type": "string", - "description": "FileId uniquely identifies the file or directory." - }, - "ParentId": { - "type": "string", - "description": "ParentId uniquely identifies the parent directory of the object." - }, - "SessionId": { - "type": "string", - "description": "SMB session ID in context of which the file handle was opened" - }, - "ClientIp": { - "type": "string", - "description": "Client IP that opened the handle" - }, - "OpenTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Time when the session that previously opened the handle has last been reconnected. (UTC)" - }, - "LastReconnectTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Time handle was last connected to (UTC)" - } - } - }, - "ListFilesAndDirectoriesSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of directories and files.", - "type": "object", - "required": [ - "ServiceEndpoint", - "ShareName", - "DirectoryPath", - "Prefix", - "NextMarker", - "Segment" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ShareName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ShareSnapshot": { - "type": "string", - "xml": { - "attribute": true - } - }, - "DirectoryPath": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Segment": { - "$ref": "#/definitions/FilesAndDirectoriesListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListHandlesResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of handles.", - "type": "object", - "required": [ - "NextMarker" - ], - "properties": { - "HandleList": { - "type": "array", - "items": { - "$ref": "#/definitions/HandleItem" - }, - "xml": { - "name": "Entries", - "wrapped": true - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListSharesResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of shares.", - "type": "object", - "required": [ - "ServiceEndpoint", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "ShareItems": { - "type": "array", - "items": { - "$ref": "#/definitions/ShareItem" - }, - "xml": { - "name": "Shares", - "wrapped": true - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "Metrics": { - "description": "Storage Analytics metrics for file service.", - "required": [ - "Version", - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the File service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "Range": { - "description": "An Azure Storage file range.", - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "description": "Start of the range." - }, - "End": { - "type": "integer", - "format": "int64", - "description": "End of the range." - } - }, - "xml": { - "name": "Range" - } - }, - "RangeList": { - "description": "A list of non-overlapping valid ranges, sorted by increasing address range.", - "type": "array", - "items": { - "$ref": "#/definitions/Range" - }, - "xml": { - "wrapped": true, - "name": "Ranges" - } - }, - "StorageError": { - "type": "object", - "properties": { - "Message": { - "type": "string" - } - } - }, - "RetentionPolicy": { - "description": "The retention policy.", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and the user is responsible for deleting it.", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics data should be retained. All data older than this value will be deleted. Metrics data is deleted on a best-effort basis after the retention period expires.", - "type": "integer", - "minimum": 1, - "maximum": 365 - } - } - }, - "ShareItem": { - "xml": { - "name": "Share" - }, - "description": "A listed Azure Storage share item.", - "type": "object", - "required": [ - "Name", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Snapshot": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/ShareProperties" - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - } - }, - "ShareProperties": { - "description": "Properties of a share.", - "type": "object", - "required": [ - "Last-Modified", - "Etag", - "Quota" - ], - "properties": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "Quota": { - "type": "integer" - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - } - }, - "ShareStats": { - "description": "Stats for the share.", - "type": "object", - "required": [ - "ShareUsageBytes" - ], - "properties": { - "ShareUsageBytes": { - "description": "The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value may not include all recently created or recently resized files.", - "type": "integer", - "format": "int64" - } - } - }, - "SignedIdentifier": { - "description": "Signed identifier.", - "type": "object", - "required": [ - "Id" - ], - "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" - } - }, - "FileServiceProperties": { - "description": "Storage service properties.", - "type": "object", - "properties": { - "HourMetrics": { - "description": "A summary of request statistics grouped by API in hourly aggregates for files.", - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "description": "A summary of request statistics grouped by API in minute aggregates for files.", - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule" - }, - "xml": { - "wrapped": true - } - } - }, - "xml": { - "name": "StorageServiceProperties" - } - } - }, - "parameters": { - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "description": "Specifies the version of the operation to use for this request.", - "required": true, - "type": "string", - "enum": [ - "2018-11-09" - ] - }, - "ContentLength": { - "name": "Content-Length", - "x-ms-client-name": "contentLength", - "in": "header", - "description": "Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero.", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method" - }, - "ContentMD5": { - "name": "Content-MD5", - "x-ms-client-name": "contentMD5", - "in": "header", - "description": "An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 header is specified, the File service compares the hash of the content that has arrived with the header value that was sent. If the two hashes do not match, the operation will fail with error code 400 (Bad Request).", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method" - }, - "CopyActionAbort": { - "name": "x-ms-copy-action", - "x-ms-client-name": "copyActionAbortConstant", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "abort" - ], - "x-ms-parameter-location": "method" - }, - "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 File operation." - }, - "CopySource": { - "name": "x-ms-copy-source", - "x-ms-client-name": "copySource", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source." - }, - "DeleteSnapshots": { - "name": "x-ms-delete-snapshots", - "x-ms-client-name": "deleteSnapshots", - "description": "Specifies the option include to delete the base share and all of its snapshots.", - "in": "header", - "required": false, - "type": "string", - "enum": [ - "include" - ], - "x-ms-enum": { - "name": "DeleteSnapshotsOptionType", - "modelAsString": false - }, - "x-ms-parameter-location": "method" - }, - "DirectoryPath": { - "name": "directoryPath", - "in": "path", - "description": "The path of the target directory.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-skip-url-encoding": false - }, - "FileCacheControl": { - "name": "x-ms-cache-control", - "x-ms-client-name": "fileCacheControl", - "description": "Sets the file's cache control. The File service stores this value but does not use or modify it.", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentDisposition": { - "name": "x-ms-content-disposition", - "x-ms-client-name": "fileContentDisposition", - "description": "Sets the file's Content-Disposition header.", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentEncoding": { - "name": "x-ms-content-encoding", - "x-ms-client-name": "fileContentEncoding", - "in": "header", - "description": "Specifies which content encodings have been applied to the file.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentLanguage": { - "name": "x-ms-content-language", - "x-ms-client-name": "fileContentLanguage", - "in": "header", - "description": "Specifies the natural languages used by this resource.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentMD5": { - "name": "x-ms-content-md5", - "x-ms-client-name": "fileContentMD5", - "in": "header", - "description": "Sets the file's MD5 hash.", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentType": { - "name": "x-ms-content-type", - "x-ms-client-name": "fileContentType", - "in": "header", - "description": "Sets the MIME content type of the file. The default type is 'application/octet-stream'.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FilePath": { - "name": "filePath", - "in": "path", - "description": "The path of the target file.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-skip-url-encoding": false - }, - "FileType": { - "name": "x-ms-type", - "x-ms-client-name": "fileTypeConstant", - "in": "header", - "required": true, - "description": "Dummy constant parameter, file type can only be file.", - "type": "string", - "enum": [ - "file" - ], - "x-ms-parameter-location": "method" - }, - "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 this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size." - }, - "HandleId": { - "name": "x-ms-handle-id", - "x-ms-client-name": "handleId", - "in": "header", - "description": "Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "ListSharesInclude": { - "name": "include", - "in": "query", - "description": "Include this parameter to specify one or more datasets to include in the response.", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "snapshots", - "metadata" - ], - "x-ms-enum": { - "name": "ListSharesIncludeType", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method" - }, - "Marker": { - "name": "marker", - "in": "query", - "description": "A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "description": "Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items.", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method" - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "description": "A name-value pair to associate with a file storage object.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "OptionalBody": { - "name": "optionalbody", - "in": "body", - "description": "Initial data.", - "required": false, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "description": "Filters the results to return only entries whose name begins with the specified prefix.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "Range": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "description": "Return file data only from the specified byte range.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "Recursive": { - "name": "x-ms-recursive", - "x-ms-client-name": "recursive", - "in": "header", - "description": "Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files.", - "required": false, - "type": "boolean", - "x-ms-parameter-location": "method" - }, - "Url": { - "name": "url", - "in": "path", - "description": "The URL of the service account, share, directory or file that is the target of the desired operation.", - "required": true, - "type": "string", - "x-ms-skip-url-encoding": true - }, - "ShareAcl": { - "name": "shareAcl", - "in": "body", - "description": "The ACL for the share.", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method" - }, - "ShareName": { - "name": "shareName", - "in": "path", - "description": "The name of the target share.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "ShareQuota": { - "name": "x-ms-share-quota", - "x-ms-client-name": "quota", - "in": "header", - "description": "Specifies the maximum size of the share, in gigabytes.", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method" - }, - "ShareSnapshot": { - "name": "sharesnapshot", - "in": "query", - "description": "The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "FileServiceProperties": { - "name": "FileServiceProperties", - "in": "body", - "description": "The FileStorage properties.", - "required": true, - "schema": { - "$ref": "#/definitions/FileServiceProperties" - }, - "x-ms-parameter-location": "method" - }, - "Timeout": { - "name": "timeout", - "in": "query", - "description": "The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations.", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method" - } - } -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index f80a2c884c44..59c3bf1a60cf 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] | @@ -32,13 +32,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 +77,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 +104,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 +114,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 +136,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 +144,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 +153,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 +163,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 +203,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 +245,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 +267,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 +276,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 +299,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 +339,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 +409,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..886d42a15b28 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -15,7 +15,8 @@ azure-storage-queue 12.0.0-preview.3 - 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,6 +32,10 @@ HEAD + + com.azure.storage.queue + + com.azure @@ -42,11 +47,6 @@ azure-storage-common 12.0.0-preview.3 - - org.slf4j - slf4j-api - - com.azure azure-core-test @@ -55,13 +55,8 @@ com.azure - azure-identity - 1.0.0-preview.3 - test - - - junit - junit + azure-core-http-netty + 1.0.0-preview.4 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..2b4669293e3e --- /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.response() + .bodyAsString() + .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..edfe85f21f7f 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,7 +62,7 @@ * @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; @@ -62,28 +74,9 @@ public final class QueueAsyncClient { * @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,22 @@ 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 +149,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 +194,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 +245,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 +296,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.request(), + response.statusCode(), + response.headers(), + response.value(), + null, + response.deserializedHeaders())); + + 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 +340,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.accessPolicy() != null && permission.accessPolicy().start() != null) { + permission.accessPolicy().start( + permission.accessPolicy().start().truncatedTo(ChronoUnit.SECONDS)); + } + if (permission.accessPolicy() != null && permission.accessPolicy().expiry() != null) { + permission.accessPolicy().expiry( + permission.accessPolicy().expiry().truncatedTo(ChronoUnit.SECONDS)); + } + } + } + + return postProcessResponse(client.queues() + .setAccessPolicyWithRestResponseAsync(queueName, permissions, null, null, context)) .map(VoidResponse::new); } @@ -261,11 +391,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); } @@ -285,10 +438,10 @@ public Mono clearMessages() { * @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 + * @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,11 +451,11 @@ 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.

                  @@ -316,15 +469,21 @@ public Mono> enqueueMessage(String messageText) { * @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} + * @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); - return client.messages().enqueueWithRestResponseAsync(queueName, message, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, Context.NONE) + return postProcessResponse(client.messages() + .enqueueWithRestResponseAsync(queueName, message, visibilityTimeoutInSeconds, timeToLiveInSeconds, + null, null, context)) .map(response -> new SimpleResponse<>(response, response.value().get(0))); } @@ -343,10 +502,10 @@ public Mono> enqueueMessage(String messageText, Durati * @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 + * @throws StorageException If the queue doesn't exist */ - public Flux dequeueMessages() { - return dequeueMessages(1, Duration.ofSeconds(30)); + public PagedFlux dequeueMessages() { + return dequeueMessages(1, null); } /** @@ -367,10 +526,10 @@ public Flux dequeueMessages() { * @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 + * @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 dequeueMessages(maxMessages, null); } /** @@ -394,13 +553,23 @@ public Flux dequeueMessages(Integer maxMessages) { * @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 + * @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) { 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(this.client.messages() + .dequeueWithRestResponseAsync(queueName, maxMessages, visibilityTimeoutInSeconds, + null, null, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value(), + null, + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -420,7 +589,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); } @@ -444,11 +613,20 @@ public Flux peekMessages() { * 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 + * @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) { + Function>> retriever = + marker -> postProcessResponse(this.client.messages() + .peekWithRestResponseAsync(queueName, maxMessages, null, null, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value(), + null, + response.deserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -458,7 +636,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.updateMessage#String-String-String-Duration} * *

                  For more information, see the * Azure Docs.

                  @@ -470,12 +648,44 @@ public Flux peekMessages(Integer maxMessages) { * 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, + * @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) { + public Mono updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { + return updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout).flatMap(FluxUtil::toMono); + } + + /** + * 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.updateMessageWithResponse#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#popReceipt() 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> 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().messageText(messageText); - return client.messageIds().updateWithRestResponseAsync(queueName, messageId, message, popReceipt, (int) visibilityTimeout.getSeconds(), Context.NONE) + return postProcessResponse(client.messageIds() + .updateWithRestResponseAsync(queueName, messageId, message, popReceipt, + (int) visibilityTimeout.getSeconds(), context)) .map(this::getUpdatedMessageResponse); } @@ -486,7 +696,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,13 +725,79 @@ 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.canonicalName(this.queueName, sharedKeyCredential.accountName()); + + 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 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..014edbf410d3 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,12 @@ // 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.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.queue.models.DequeuedMessage; @@ -11,10 +15,12 @@ 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 java.net.URL; import java.time.Duration; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -66,11 +72,10 @@ 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. + * @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, Context.NONE); } /** @@ -80,17 +85,18 @@ 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-Context} * *

                  For more information, see the * Azure Docs.

                  * * @param metadata Metadata to associate with the queue + * @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. */ - public VoidResponse create(Map metadata) { - return client.create(metadata).block(); + public VoidResponse createWithResponse(Map metadata, Context context) { + return client.createWithResponse(metadata, context).block(); } /** @@ -105,11 +111,30 @@ public VoidResponse create(Map metadata) { *

                  For more information, see the * Azure Docs.

                  * + * @throws StorageException If the queue doesn't exist + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + /** + * Permanently deletes the queue. + * + *

                  Code Samples

                  + * + *

                  Delete a queue

                  + * + * {@codesnippet com.azure.storage.queue.queueClient.deleteWithResponse#Context} + * + *

                  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 + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws StorageException If the queue doesn't exist */ - public VoidResponse delete() { - return client.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return client.deleteWithResponse(context).block(); } /** @@ -126,10 +151,31 @@ 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(Context.NONE).value(); + } + + /** + * Retrieves metadata and approximate message count of the queue. + * + *

                  Code Samples

                  + * + *

                  Get the properties of the queue

                  + * + * {@codesnippet com.azure.storage.queue.queueClient.getPropertiesWithResponse#Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @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 + */ + public Response getPropertiesWithResponse(Context context) { + return client.getPropertiesWithResponse(context).block(); } /** @@ -151,11 +197,37 @@ 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, 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-Context} + * + *

                  Clear the queue's metadata

                  + * + * {@codesnippet com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param metadata Metadata to set on the queue + * @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 */ - public VoidResponse setMetadata(Map metadata) { - return client.setMetadata(metadata).block(); + public VoidResponse setMetadataWithResponse(Map metadata, Context context) { + return client.setMetadataWithResponse(metadata, context).block(); } /** @@ -171,10 +243,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 +256,39 @@ 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, 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-Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param permissions Access policies to set on the queue + * @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. */ - public VoidResponse setAccessPolicy(List permissions) { - return client.setAccessPolicy(permissions).block(); + public VoidResponse setAccessPolicyWithResponse(List permissions, Context context) { + return client.setAccessPolicyWithResponse(permissions, context).block(); } /** @@ -210,11 +303,30 @@ public VoidResponse setAccessPolicy(List permissions) { *

                  For more information, see the * Azure Docs.

                  * + * @throws StorageException If the queue doesn't exist + */ + public void clearMessages() { + clearMessagesWithResponse(Context.NONE); + } + + /** + * Deletes all messages in the queue. + * + *

                  Code Samples

                  + * + *

                  Clear the messages

                  + * + * {@codesnippet com.azure.storage.queue.queueClient.clearMessagesWithResponse#Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @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 */ - public VoidResponse clearMessages() { - return client.clearMessages().block(); + public VoidResponse clearMessagesWithResponse(Context context) { + return client.clearMessagesWithResponse(context).block(); } /** @@ -233,10 +345,10 @@ public VoidResponse clearMessages() { * @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 + * @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, Context.NONE).value(); } /** @@ -246,11 +358,11 @@ 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-Context} * *

                  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-liveTime#String-Duration-Duration-Context} * *

                  For more information, see the * Azure Docs.

                  @@ -261,14 +373,15 @@ public Response enqueueMessage(String messageText) { * 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 + * @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#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} + * @throws StorageException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} * are outside of the allowed limits. */ - 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, Context context) { + return client.enqueueMessageWithResponse(messageText, visibilityTimeout, timeToLive, context).block(); } /** @@ -286,9 +399,9 @@ public Response enqueueMessage(String messageText, Duration vis * @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 + * @throws StorageException If the queue doesn't exist */ - public Iterable dequeueMessages() { + public PagedIterable dequeueMessages() { return dequeueMessages(1, Duration.ofSeconds(30)); } @@ -310,9 +423,9 @@ public Iterable dequeueMessages() { * @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 + * @throws StorageException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds */ - public Iterable dequeueMessages(Integer maxMessages) { + public PagedIterable dequeueMessages(Integer maxMessages) { return dequeueMessages(maxMessages, Duration.ofSeconds(30)); } @@ -337,11 +450,11 @@ public Iterable dequeueMessages(Integer maxMessages) { * @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 + * @throws StorageException If the queue doesn't exist or {@code maxMessages} or {@code visibilityTimeout} is * outside of the allowed bounds */ - public Iterable dequeueMessages(Integer maxMessages, Duration visibilityTimeout) { - return client.dequeueMessages(maxMessages, visibilityTimeout).toIterable(); + public PagedIterable dequeueMessages(Integer maxMessages, Duration visibilityTimeout) { + return new PagedIterable<>(client.dequeueMessages(maxMessages, visibilityTimeout)); } /** @@ -361,7 +474,7 @@ public Iterable dequeueMessages(Integer maxMessages, Duration v * * @return A {@link PeekedMessage} that contains metadata about the message. */ - public Iterable peekMessages() { + public PagedIterable peekMessages() { return peekMessages(null); } @@ -385,10 +498,10 @@ public Iterable peekMessages() { * 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 + * @throws StorageException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds */ - public Iterable peekMessages(Integer maxMessages) { - return client.peekMessages(maxMessages).toIterable(); + public PagedIterable peekMessages(Integer maxMessages) { + return new PagedIterable<>(client.peekMessages(maxMessages)); } /** @@ -398,7 +511,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.

                  @@ -410,11 +523,38 @@ public Iterable peekMessages(Integer maxMessages) { * 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, + * @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, Context.NONE).value(); + } + + /** + * 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-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 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#popReceipt() 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 updateMessageWithResponse(String messageText, String messageId, String popReceipt, Duration visibilityTimeout, Context context) { + return client.updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout, context).block(); } /** @@ -424,17 +564,84 @@ 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, Context.NONE); + } + + /** + * Deletes the specified message in the queue + * + *

                  Code Samples

                  + * + *

                  Delete the first message

                  + * + * {@codesnippet com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-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. * @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 VoidResponse deleteMessageWithResponse(String messageId, String popReceipt, Context context) { + return client.deleteMessageWithResponse(messageId, popReceipt, context).block(); + } + + /** + * 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..bd62a22b3003 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,35 +2,18 @@ // 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; @@ -76,32 +59,33 @@ * @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}. */ - public QueueClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); + public QueueClientBuilder() { } + + private AzureQueueStorageImpl constructImpl() { + Objects.requireNonNull(queueName); - configuration = ConfigurationManager.getConfiguration(); + 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(); } /** @@ -139,46 +123,7 @@ public QueueClient buildClient() { * @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); } /** @@ -194,11 +139,12 @@ public QueueAsyncClient buildAsyncClient() { * @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 +153,12 @@ 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 +175,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/QueueSASPermission.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueSASPermission.java new file mode 100644 index 000000000000..ee99bfefcf87 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueSASPermission.java @@ -0,0 +1,170 @@ +// 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 read() { + return read; + } + + /** + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission read(boolean read) { + this.read = read; + return this; + } + + /** + * @return the add permission status. + */ + public boolean add() { + return add; + } + + /** + * Sets the add permission status. + * + * @param add Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission add(boolean add) { + this.add = add; + return this; + } + + /** + * @return the update permission status. + */ + public boolean update() { + return update; + } + + /** + * Sets the update permission status. + * + * @param update Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission update(boolean update) { + this.update = update; + return this; + } + /** + * @return the process permission status. + */ + public boolean process() { + return process; + } + + /** + * Sets the process permission status. + * + * @param process Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission process(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..d12babe2617a 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,33 +2,45 @@ // 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.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. @@ -47,20 +59,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 +79,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")); } } @@ -99,11 +107,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 +122,22 @@ 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 +151,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,7 +193,7 @@ public Mono deleteQueue(String queueName) { * * @return {@link QueueItem Queues} in the storage account */ - public Flux listQueues() { + public PagedFlux listQueues() { return listQueues(null, null); } @@ -181,7 +215,7 @@ 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) { + public PagedFlux listQueues(QueuesSegmentOptions options) { return listQueues(null, options); } @@ -195,46 +229,48 @@ public Flux listQueues(QueuesSegmentOptions options) { * @param options Options for listing queues * @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 listQueues(String marker, QueuesSegmentOptions options) { + final String prefix = (options != null) ? options.prefix() : null; + final Integer maxResults = (options != null) ? options.maxResults() : null; final List include = new ArrayList<>(); if (options != null) { - prefix = options.prefix(); - maxResults = options.maxResults(); if (options.includeMetadata()) { 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(this.client.services() + .listQueuesSegmentWithRestResponseAsync(prefix, nextMarker, maxResults, include, + null, null, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.request(), + response.statusCode(), + response.headers(), + response.value().queueItems(), + response.value().nextMarker(), + response.deserializedHeaders())); - 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,15 +281,19 @@ 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.

                  * - * @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) + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(client.services().getPropertiesWithRestResponseAsync(context)) .map(response -> new SimpleResponse<>(response, response.value())); } @@ -278,8 +318,46 @@ public Mono> getProperties() { * 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#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
                  • + *
                  + */ + 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#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#cors() 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
                  • @@ -291,8 +369,12 @@ public Mono> getProperties() { *
                  • {@link CorsRule#allowedMethods() 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 +392,76 @@ public Mono setProperties(StorageServiceProperties properties) { * * @return The geo replication information about the Queue service */ - public Mono> getStatistics() { - return client.services().getStatisticsWithRestResponseAsync(Context.NONE) + 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.value())); } + + /** + * 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..70782104a0b2 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 @@ -5,15 +5,23 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; 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.IPRange; +import com.azure.storage.common.SASProtocol; +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.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 java.net.URL; +import java.time.OffsetDateTime; import java.util.Map; /** @@ -74,10 +82,10 @@ 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, Context.NONE).value(); } /** @@ -88,15 +96,16 @@ public Response createQueue(String queueName) { * *

                  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-Context} * * @param queueName Name of the queue * @param metadata Metadata to associate with the queue + * @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 */ - public Response createQueue(String queueName, Map metadata) { - Response response = client.createQueue(queueName, metadata).block(); + public Response createQueueWithResponse(String queueName, Map metadata, Context context) { + Response response = client.createQueueWithResponse(queueName, metadata, context).block(); return new SimpleResponse<>(response, new QueueClient(response.value())); } @@ -111,11 +120,28 @@ 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, Context.NONE); + } + + /** + * Deletes a queue in the storage account + * + *

                  Code Samples

                  + * + *

                  Delete the queue "test"

                  + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-Context} + * + * @param queueName Name of the queue + * @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 */ - public VoidResponse deleteQueue(String queueName) { - return client.deleteQueue(queueName).block(); + public VoidResponse deleteQueueWithResponse(String queueName, Context context) { + return client.deleteQueueWithResponse(queueName, context).block(); } /** @@ -187,8 +213,28 @@ Iterable listQueues(String marker, QueuesSegmentOptions options) { * * @return Storage account Queue service properties */ - public Response getProperties() { - return client.getProperties().block(); + public StorageServiceProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * 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#Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @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 + */ + public Response getPropertiesWithResponse(Context context) { + return client.getPropertiesWithResponse(context).block(); } /** @@ -212,8 +258,46 @@ public Response getProperties() { * 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#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
                  • + *
                  + */ + public void setProperties(StorageServiceProperties properties) { + setPropertiesWithResponse(properties, 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#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#cors() CORS}. + * + *

                  Code Sample

                  + * + *

                  Clear CORS in the Queue service

                  + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-Context} + * + *

                  Enable Minute and Hour Metrics

                  + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param properties Storage account Queue service properties + * @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
                  • @@ -225,8 +309,8 @@ public Response getProperties() { *
                  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                  • *
                  */ - public VoidResponse setProperties(StorageServiceProperties properties) { - return client.setProperties(properties).block(); + public VoidResponse setPropertiesWithResponse(StorageServiceProperties properties, Context context) { + return client.setPropertiesWithResponse(properties, context).block(); } /** @@ -243,7 +327,66 @@ 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(Context.NONE).value(); + } + + /** + * Retrieves the geo replication information about the Queue service. + * + *

                  Code Samples

                  + * + *

                  Retrieve the geo replication information

                  + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @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 + */ + public Response getStatisticsWithResponse(Context context) { + return client.getStatisticsWithResponse(context).block(); + } + + /** + * 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..704aec0c11c5 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,33 +2,17 @@ // 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; @@ -73,30 +57,30 @@ * @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(); + public QueueServiceClientBuilder() { } + + 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(); } /** @@ -114,45 +98,7 @@ public QueueServiceClientBuilder() { * @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()); } /** @@ -184,158 +130,22 @@ public QueueServiceClient buildClient() { * @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; - } - - 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]); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed.")); } - 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..bcde5cd8981a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSASQueryParameters.java @@ -0,0 +1,92 @@ +// 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 identifier() { + 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..664777eb2d7f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSASSignatureValues.java @@ -0,0 +1,303 @@ +// 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 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues expiryTime(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 permissions() { + 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 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues ipRange(IPRange ipRange) { + this.ipRange = ipRange; + 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues 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 + * "/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 canonicalName(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 identifier() { + 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 identifier(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/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..36ee8d28120b --- /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.response(), e); + this.errorCode = StorageErrorCode.fromString(e.response().headers().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode errorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String serviceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int statusCode() { + return super.response().statusCode(); + } +} 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..a729ca372eac 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.messageId()); }, 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..c45260edbc34 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,7 +32,7 @@ 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().approximateMessagesCount(); // Peek all messages in queue. It is supposed to print "Hello World" 3 times. queueClient.peekMessages(count).forEach( 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..b833b66bfdbc --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java @@ -0,0 +1,496 @@ +// 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.statusCode()), + 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.value().messageId(), + response.value().expirationTime()), + 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.value().messageId(), + response.value().expirationTime()), + 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.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 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.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 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.messageText()), + 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.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 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.messageId(), peekMessage.dequeueCount()), + 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.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!") + ); + // 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.messageId(), + dequeuedMessage.popReceipt(), null).subscribe( + response -> System.out.println("Complete updating the message with status code:" + + response.statusCode()), + 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.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!") + ); + // 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.messageId(), dequeuedMessage.popReceipt()).subscribe( + response -> System.out.println("Complete deleting the message with status code: " + response.statusCode()), + 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.statusCode()) + ); + // 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.metadata(), + properties.approximateMessagesCount()); + }); + // 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.value(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), + properties.approximateMessagesCount()); + }); + // 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.printf("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.statusCode())); + // 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.statusCode())); + // 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.id(), result.accessPolicy().permission())); + // 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().permission("r") + .start(OffsetDateTime.now(ZoneOffset.UTC)) + .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); + client.setAccessPolicyWithResponse(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", + response.statusCode())); + // 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().permission("r") + .start(OffsetDateTime.now(ZoneOffset.UTC)) + .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); + client.setAccessPolicy(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("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.statusCode()) + ); + // 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() + .read(true) + .add(true) + .update(true) + .process(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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..d6e0fd9c9fb2 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,8 +4,9 @@ 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 static com.azure.storage.queue.SampleHelper.generateRandomName; @@ -26,10 +27,10 @@ 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, new Context("key1", "value1")); + System.out.println("Successfully create the queue! Status code: " + queueClientResponse.statusCode()); + } catch (StorageException e) { + System.out.println(String.format("Error creating a queue. Error message: %s", e.serviceMessage())); throw new RuntimeException(e); } QueueClient queueClient = queueClientResponse.value(); @@ -43,7 +44,7 @@ public static void main(String[] args) { queueClient.deleteMessage("wrong id", msg.popReceipt()); } ); - } 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 { @@ -58,7 +59,7 @@ public static void main(String[] args) { queueClient.deleteMessage(msg.messageId(), "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..bf70521376c6 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,42 +46,17 @@ 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; } /** @@ -82,28 +65,13 @@ public QueueAsyncClient createAsyncClientWithSASToken() { */ 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; } /** @@ -114,166 +82,76 @@ 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() + 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, Context)} */ public void createQueueMaxOverload() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.create#map - VoidResponse response = queueClient.create(Collections.singletonMap("queue", "metadataMap")); + + // BEGIN: com.azure.storage.queue.queueClient.createWithResponse#map-Context + VoidResponse response = client.createWithResponse(Collections.singletonMap("queue", "metadataMap"), + new Context(key1, value1)); 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 + // END: com.azure.storage.queue.queueClient.createWithResponse#map-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.messageId()); // 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, 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(); + + // BEGIN: com.azure.storage.queue.queueClient.enqueueMessageWithResponse#string-duration-duration-Context + EnqueuedMessage enqueuedMessage = client.enqueueMessageWithResponse("Hello, Azure", + Duration.ofSeconds(5), null, new Context(key1, value1)).value(); System.out.printf("Message %s expires at %s", enqueuedMessage.messageId(), enqueuedMessage.expirationTime()); - // END: com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration + // END: com.azure.storage.queue.queueClient.enqueueMessageWithResponse#string-duration-duration-Context } /** - * 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 - } - - /** - * Generates a code sample for using {@link QueueClient#enqueueMessage(String, Duration, Duration)} + * Generates a code sample for using {@link QueueClient#enqueueMessageWithResponse(String, 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(); + // BEGIN: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration-Context + EnqueuedMessage enqueuedMessage = client.enqueueMessageWithResponse("Goodbye, Azure", + null, Duration.ofSeconds(5), new Context(key1, value1)).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 + // END: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration-Context } /** * 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()); } @@ -281,85 +159,39 @@ public void dequeueMessage() { // 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()); } // 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)} */ public void dequeueMessageMaxOverload() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.dequeueMessages#integer-duration - for (DequeuedMessage dequeuedMessage : queueClient.dequeueMessages(5, Duration.ofSeconds(60))) { + for (DequeuedMessage dequeuedMessage : client.dequeueMessages(5, Duration.ofSeconds(60))) { System.out.printf("Dequeued %s and it becomes visible at %s", dequeuedMessage.messageId(), dequeuedMessage.timeNextVisible()); } // 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 - } - /** * 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()); } @@ -367,301 +199,258 @@ public void peekMessage() { // 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)} */ public void peekMessageMaxOverload() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.peekMessages#integer - queueClient.peekMessages(5).forEach( + client.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( - 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!") - ); - // END: com.azure.storage.queue.queueAsyncClient.peekMessages#integer - } - /** * 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", + UpdatedMessage response = client.updateMessage("newText", dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), null); - System.out.println("Complete updating the message with status code " + response.statusCode()); + + 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, 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-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.messageId(), dequeuedMessage.popReceipt(), null, new Context(key1, value1)); + + System.out.println("Complete updating the message with status code " + response.statusCode()); + } ); - // END: com.azure.storage.queue.queueAsyncClient.updateMessage + // END: com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-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.messageId(), dequeuedMessage.popReceipt()); + 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, 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-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.messageId(), + dequeuedMessage.popReceipt(), new Context(key1, value1)); + System.out.println("Complete deleting the message with status code " + response.statusCode()); + } ); - // END: com.azure.storage.queue.queueAsyncClient.deleteMessage + // END: com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-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(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#Context + VoidResponse response = client.deleteWithResponse(new Context(key1, value1)); + System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + // END: com.azure.storage.queue.queueClient.deleteWithResponse#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(); + QueueProperties properties = client.getProperties(); System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), properties.approximateMessagesCount()); // 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(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#Context + QueueProperties properties = client.getPropertiesWithResponse(new Context(key1, value1)).value(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), + properties.approximateMessagesCount()); + // END: com.azure.storage.queue.queueClient.getPropertiesWithResponse#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, 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-Context + client.setMetadataWithResponse(Collections.singletonMap("queue", "metadataMap"), new Context(key1, value1)); + System.out.printf("Setting metadata completed."); + // END: com.azure.storage.queue.queueClient.setMetadataWithResponse#map-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, 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-Context + VoidResponse response = client.setMetadataWithResponse(null, new Context(key1, value1)); + System.out.printf("Clearing metadata completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-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()) { + for (SignedIdentifier permission : client.getAccessPolicy()) { System.out.printf("Access policy %s allows these permissions: %s", permission.id(), permission.accessPolicy().permission()); } // 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 + // BEGIN: com.azure.storage.queue.QueueClient.setAccessPolicy#List 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 + 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, Context)} */ - public void setAccessPolicyAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.setAccessPolicy + public void setAccessPolicyWithResponse() { + + // BEGIN: com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Context 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); - 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 + VoidResponse response = client.setAccessPolicyWithResponse(Collections.singletonList(permission), + new Context(key1, value1)); + System.out.printf("Setting access policies completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-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(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#Context + VoidResponse response = client.clearMessagesWithResponse(new Context(key1, value1)); + System.out.printf("Clearing messages completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueClient.clearMessagesWithResponse#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() + .read(true) + .add(true) + .update(true) + .process(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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..156d4adb9f5b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java @@ -0,0 +1,301 @@ +// 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.statusCode()), + 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.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 QueueServiceAsyncClient#listQueues(QueuesSegmentOptions)} + */ + public void listQueuesAsyncWithOverload() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions + client.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!") + ); + // 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.statusCode()) + ); + // 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.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + }); + // 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.value(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + }); + // 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.statusCode())); + // 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.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(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.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + client.setPropertiesWithResponse(properties) + .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", + response.statusCode())); + // 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.geoReplication().status(), stats.geoReplication().lastSyncTime()); + }); + // 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.value(); + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); + }); + // 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() + .blob(true) + .file(true) + .queue(true) + .table(true); + AccountSASResourceType resourceType = new AccountSASResourceType() + .container(true) + .object(true) + .service(true); + AccountSASPermission permission = new AccountSASPermission() + .read(true) + .add(true) + .create(true) + .write(true) + .delete(true) + .list(true) + .processMessages(true) + .update(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("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..105308159e62 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,13 +4,21 @@ 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.util.Collections; import java.util.Map; @@ -18,6 +26,11 @@ * 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,42 +43,17 @@ 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; } /** @@ -74,26 +62,12 @@ public QueueServiceAsyncClient createAsyncClientWithSASToken() { */ 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; } /** @@ -104,264 +78,208 @@ 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() + 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, 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")); + // BEGIN: com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-Context + Response response = client.createQueueWithResponse("myqueue", + Collections.singletonMap("queue", "metadata"), new Context(key1, value1)); 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 + // END: com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-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( + client.listQueues().forEach( queueItem -> System.out.printf("Queue %s exists in the account", queueItem.name()) ); // 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)} )} */ public void listQueuesWithOverload() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions - queueServiceClient.listQueues(new QueuesSegmentOptions().prefix("azure")).forEach( + client.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!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions - } - /** * 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, 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-Context + VoidResponse response = client.deleteQueueWithResponse("myqueue", + new Context(key1, value1)); + System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + // END: com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-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()); // 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(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#Context + StorageServiceProperties properties = client.getPropertiesWithResponse( + new Context(key1, value1)).value(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + // END: com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#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(); + StorageServiceProperties properties = client.getProperties(); properties.cors(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, 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-Context + StorageServiceProperties properties = client.getProperties(); + properties.cors(Collections.emptyList()); + VoidResponse response = client.setPropertiesWithResponse(properties, new Context(key1, value1)); + System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-Context } /** - * Generates a code sample for using {@link QueueServiceClient#setProperties(StorageServiceProperties)} with metrics enabled. + * Generates a code sample for using {@link QueueServiceClient#setPropertiesWithResponse(StorageServiceProperties, Context)} with metrics enabled. */ - public void setPropertiesEnableMetrics() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); + public void setPropertiesWithResponseEnableMetrics() { + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-Context + StorageServiceProperties properties = client.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - VoidResponse response = queueServiceClient.setProperties(properties); + VoidResponse response = client.setPropertiesWithResponse(properties, new Context(key1, value1)); System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); - // END: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties + // END: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-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(); + public void setPropertiesEnableMetrics() { + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties + StorageServiceProperties properties = client.getProperties(); 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 + 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()); // 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(Context)} + */ + public void getStatisticsWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#Context + StorageServiceStats stats = client.getStatisticsWithResponse(new Context(key1, value1)).value(); + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); + // END: com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#Context + } + + /** + * Generates a code sample for using {@link QueueServiceClient#generateAccountSAS(AccountSASService, + * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IPRange, SASProtocol)} */ - 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 generateAccountSAS() { + // BEGIN: com.azure.storage.queue.queueServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol + AccountSASService service = new AccountSASService() + .blob(true) + .file(true) + .queue(true) + .table(true); + AccountSASResourceType resourceType = new AccountSASResourceType() + .container(true) + .object(true) + .service(true); + AccountSASPermission permission = new AccountSASPermission() + .read(true) + .add(true) + .create(true) + .write(true) + .delete(true) + .list(true) + .processMessages(true) + .update(true); + OffsetDateTime startTime = OffsetDateTime.now().minusDays(1); + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + IPRange ipRange = new IPRange() + .ipMin("0.0.0.0") + .ipMax("255.255.255.255"); + SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP; + String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + + String sas = client.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, version, + ipRange, sasProtocol); + // END: com.azure.storage.queue.queueServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IPRange-SASProtocol } } diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/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..28510d3814a4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy @@ -0,0 +1,157 @@ +// 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.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.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().prefix(methodName.toLowerCase())).each { + queueItem -> cleanupQueueServiceClient.deleteQueue(queueItem.name()) + } + } + } + + /** + * 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..75691ae44260 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy @@ -0,0 +1,439 @@ +// 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.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.Ignore +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), 201) + } + + def "Delete exist queue"() { + given: + queueClient.create() + when: + def deleteQueueResponse = queueClient.deleteWithResponse(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) + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().approximateMessagesCount() == 0 + testMetadata.equals(getPropertiesResponse.value().metadata()) + } + + 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) + when: + def getPropertiesResponseBefore = queueClient.getPropertiesWithResponse(null) + def setMetadataResponse = queueClient.setMetadataWithResponse(metadataInSet, null) + def getPropertiesResponseAfter = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponseBefore, 200) + expectMetadataInCreate.equals(getPropertiesResponseBefore.value().metadata()) + QueueTestHelper.assertResponseStatusCode(setMetadataResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesResponseAfter, 200) + expectMetadataInSet.equals(getPropertiesResponseAfter.value().metadata()) + 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() + .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)) + def permission = new SignedIdentifier() + .id("testpermission") + .accessPolicy(accessPolicy) + when: + def setAccessPolicyResponse = queueClient.setAccessPolicyWithResponse(Collections.singletonList(permission), 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() + .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)) + + def permission = new SignedIdentifier() + .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") + .accessPolicy(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() + .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)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 3; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(accessPolicy)) + } + queueClient.create() + when: + def setAccessPolicyResponse = queueClient.setAccessPolicyWithResponse(permissions, null) + 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() + .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)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 6; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(accessPolicy)) + } + queueClient.create() + when: + queueClient.setAccessPolicyWithResponse(permissions, null) + 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) + def peekMsgIter = queueClient.peekMessages().iterator() + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + expectMsg.equals(peekMsgIter.next().messageText()) + !peekMsgIter.hasNext() + } + + def "Enqueue empty message"() { + given: + queueClient.create() + def expectMsg = "" + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse(expectMsg, null, null, null) + def peekMsgIter = queueClient.peekMessages().iterator() + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + peekMsgIter.next().messageText() == null + !peekMsgIter.hasNext() + } + + def "Enqueue time to live"() { + given: + queueClient.create() + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse("test message", + Duration.ofSeconds(0), Duration.ofSeconds(2), 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.messageText()) + } + + 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().messageText()) + expectMsg2.equals(dequeueMsgIter.next().messageText()) + } + + 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.messageText()) + } + + 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).iterator() + then: + expectMsg1.equals(peekMsgIter.next().messageText()) + expectMsg2.equals(peekMsgIter.next().messageText()) + !peekMsgIter.hasNext() + } + + def "Peek too many message"() { + given: + queueClient.create() + when: + queueClient.peekMessages(33).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) + def clearMsgResponse = queueClient.clearMessagesWithResponse(null) + def getPropertiesAfterResponse = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().approximateMessagesCount() == 3 + QueueTestHelper.assertResponseStatusCode(clearMsgResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + getPropertiesAfterResponse.value().approximateMessagesCount() == 0 + } + + def "Clear messages error"() { + when: + queueClient.clearMessagesWithResponse(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) + def deleteMsgResponse = queueClient.deleteMessageWithResponse(dequeueMsg.messageId(), dequeueMsg.popReceipt(), null) + def getPropertiesAfterResponse = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().approximateMessagesCount() == 3 + QueueTestHelper.assertResponseStatusCode(deleteMsgResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + getPropertiesAfterResponse.value().approximateMessagesCount() == 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.messageId() : dequeueMessageIter.messageId() + "Random" + def deletePopReceipt = popReceipt ? dequeueMessageIter.popReceipt() : dequeueMessageIter.popReceipt() + "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.messageId(), dequeueMsg.popReceipt(), Duration.ofSeconds(1), null) + QueueTestHelper.sleepInRecord(Duration.ofSeconds(2)) + def peekMsgIter = queueClient.peekMessages().iterator().next() + then: + QueueTestHelper.assertResponseStatusCode(updateMsgResponse, 204) + updateMsg.equals(peekMsgIter.messageText()) + } + + @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.messageId() : dequeueMessageIter.messageId() + "Random" + def updatePopReceipt = popReceipt ? dequeueMessageIter.popReceipt() : dequeueMessageIter.popReceipt() + "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..60e471bc4e6d --- /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.value().approximateMessagesCount() == 0 + assert testMetadata.equals(it.value().metadata()) + }.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.value().metadata()) + }.verifyComplete() + setMetadataVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) } + .verifyComplete() + getPropertiesVerifierAfter.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert expectMetadataInSet.equals(it.value().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() + .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)) + def permission = new SignedIdentifier() + .id("testpermission") + .accessPolicy(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() + .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)) + + def permission = new SignedIdentifier() + .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") + .accessPolicy(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() + .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)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 3; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(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() + .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)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 6; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(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.messageText()) + 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.messageText() == 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.messageText()) + }.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.messageText()) + }.assertNext { + assert expectMsg2.equals(it.messageText()) + }.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.messageText()) + }.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.messageText()) + }.assertNext { + assert expectMsg2.equals(it.messageText()) + }.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.value().approximateMessagesCount() == 3 + }.verifyComplete() + clearMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 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.messageId(), dequeueMsg.popReceipt())) + def getPropertiesAfterVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 3 + + }.verifyComplete() + deleteMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 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.messageId() : dequeueMessage.messageId() + "Random" + def deletePopReceipt = popReceipt ? dequeueMessage.popReceipt() : dequeueMessage.popReceipt() + "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.messageId(), dequeueMsg.popReceipt(), 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.messageText()) + }.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.messageId() : dequeueMessage.messageId() + "Random" + def updatePopReceipt = popReceipt ? dequeueMessage.popReceipt() : dequeueMessage.popReceipt() + "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..7fc9d7656042 --- /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.read() == read + perms.add() == add + perms.update() == update + perms.process() == 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() + .read(read) + .add(add) + .update(update) + .process(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().canonicalName(queueName, accountName) + + then: + serviceSASSignatureValues.canonicalName() == "/queue/" + accountName + "/" + queueName + } + + @Test + def "Test QueueSAS enqueue dequeue with permissions"() { + setup: + queueClient.create() + EnqueuedMessage resp = queueClient.enqueueMessage("test") + + def permissions = new QueueSASPermission() + .read(true) + .add(true) + .process(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") + 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().messageText() + "sastest" == dequeueMsgIterPermissions.next().messageText() + + when: + clientPermissions.updateMessage("testing", resp.messageId(), resp.popReceipt(), 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() + .read(true) + .add(true) + .process(true) + .update(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") + 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.messageId(), resp.popReceipt(), Duration.ZERO) + def dequeueMsgIterPermissions = clientPermissions.dequeueMessages(1).iterator() + + then: + notThrown(StorageException) + "testing" == dequeueMsgIterPermissions.next().messageText() + + 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() + .read(true) + .add(true) + .update(true) + .process(true) + def expiryTime = getUTCNow().plusDays(1).truncatedTo(ChronoUnit.SECONDS) + def startTime = getUTCNow().minusDays(1).truncatedTo(ChronoUnit.SECONDS) + + SignedIdentifier identifier = new SignedIdentifier() + .id(testResourceName.randomUuid()) + .accessPolicy(new AccessPolicy().permission(permissions.toString()) + .expiry(expiryTime).start(startTime)) + queueClient.setAccessPolicy(Arrays.asList(identifier)) + + when: + def sasIdentifier = queueClient.generateSAS(identifier.id()) + + 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().messageText() + "sastest" == dequeueMsgIterIdentifier.next().messageText() + } + + @Test + def "Test Account QueueServiceSAS create queue delete queue"() { + def service = new AccountSASService() + .queue(true) + def resourceType = new AccountSASResourceType() + .container(true) + .service(true) + .object(true) + def permissions = new AccountSASPermission() + .read(true) + .create(true) + .delete(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() + .queue(true) + def resourceType = new AccountSASResourceType() + .container(true) + .service(true) + .object(true) + def permissions = new AccountSASPermission() + .list(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..84adb06ec1ed --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy @@ -0,0 +1,170 @@ +// 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) + def enqueueMessageResponse = queueClientResponse.value().enqueueMessageWithResponse("Testing service client creating a queue", 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) + def enqueueMessageResponse = queueClientResponse.value().enqueueMessageWithResponse("Testing service client creating a queue", 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) + 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) + 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) + 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().name(queueName + version) + .metadata(Collections.singletonMap("metadata" + version, "value" + version)) + testQueues.add(queue) + primaryQueueServiceClient.createQueueWithResponse(queue.name(), queue.metadata(), null) + } + when: + def queueListIter = primaryQueueServiceClient.listQueues(options) + then: + queueListIter.each { + QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + primaryQueueServiceClient.deleteQueue(it.name()) + } + testQueues.size() == 0 + where: + options | _ + new QueuesSegmentOptions().prefix("queueserviceapitestslistqueues") | _ + new QueuesSegmentOptions().prefix("queueserviceapitestslistqueues").maxResults(2) | _ + new QueuesSegmentOptions().prefix("queueserviceapitestslistqueues").includeMetadata(true) | _ + } + + def "List empty queues"() { + when: + primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + then: + !primaryQueueServiceClient.listQueues(new QueuesSegmentOptions().prefix(methodName)).iterator().hasNext() + } + + def "Get and set properties"() { + given: + def originalProperties = primaryQueueServiceClient.getProperties() + def retentionPolicy = new RetentionPolicy().enabled(true) + .days(3) + def logging = new Logging().version("1.0") + .delete(true) + .write(true) + .retentionPolicy(retentionPolicy) + def metrics = new Metrics().enabled(true) + .includeAPIs(false) + .retentionPolicy(retentionPolicy) + .version("1.0") + def updatedProperties = new StorageServiceProperties().logging(logging) + .hourMetrics(metrics) + .minuteMetrics(metrics) + .cors(new ArrayList<>()) + + when: + def getResponseBefore = primaryQueueServiceClient.getProperties() + def setResponse = primaryQueueServiceClient.setPropertiesWithResponse(updatedProperties, 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..e361393f2555 --- /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().name(queueName + version) + .metadata(Collections.singletonMap("metadata" + version, "value" + version)) + testQueues.add(queue) + primaryQueueServiceAsyncClient.createQueueWithResponse(queue.name(), queue.metadata()).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().prefix("queueserviceasyncapitestslistqueues") | _ + new QueuesSegmentOptions().prefix("queueserviceasyncapitestslistqueues").maxResults(2) | _ + new QueuesSegmentOptions().prefix("queueserviceasyncapitestslistqueues").includeMetadata(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().enabled(true) + .days(3) + def logging = new Logging().version("1.0") + .delete(true) + .write(true) + .retentionPolicy(retentionPolicy) + def metrics = new Metrics().enabled(true) + .includeAPIs(false) + .retentionPolicy(retentionPolicy) + .version("1.0") + def updatedProperties = new StorageServiceProperties().logging(logging) + .hourMetrics(metrics) + .minuteMetrics(metrics) + .cors(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..fc7e77a2d705 --- /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.statusCode() + } + + static boolean assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, StorageErrorCode errMessage) { + return throwable instanceof StorageException && + ((StorageException) throwable).statusCode() == expectedStatusCode && + ((StorageException) throwable).errorCode() == errMessage + } + + static boolean assertQueuesAreEqual(QueueItem expected, QueueItem actual) { + if (expected == null) { + return actual == null + } else { + if (!Objects.equals(expected.name(), actual.name())) { + return false + } + if (expected.metadata() != null && !ImplUtils.isNullOrEmpty(actual.metadata())) { + return expected.metadata().equals(actual.metadata()) + } + return true + } + } + + static boolean assertQueueServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()) && + assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()) && + assertLoggingAreEqual(expected.logging(), actual.logging()) && + assertCorsAreEqual(expected.cors(), actual.cors()) + } + } + + static boolean assertMetricsAreEqual(Metrics expected, Metrics actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.enabled(), actual.enabled()) && + Objects.equals(expected.includeAPIs(), actual.includeAPIs()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertLoggingAreEqual(Logging expected, Logging actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.read(), actual.read()) && + Objects.equals(expected.write(), actual.write()) && + Objects.equals(expected.delete(), actual.delete()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.days(), actual.days()) && + Objects.equals(expected.enabled(), actual.enabled()) + } + } + + 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.allowedHeaders(), actual.allowedHeaders()) && + Objects.equals(expected.allowedMethods(), actual.allowedMethods()) && + Objects.equals(expected.allowedOrigins(), actual.allowedOrigins()) && + Objects.equals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()) + } + } + + static boolean assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { + if (expected == null) { + return actual == null + } + if (expected.accessPolicy() == null) { + return actual.accessPolicy() == null + } + return Objects.equals(expected.id(), actual.id()) && + Objects.equals(expected.accessPolicy().permission(), actual.accessPolicy().permission()) && + Objects.equals(expected.accessPolicy().start(), actual.accessPolicy().start()) && + Objects.equals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()) + } + + 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..70ef8754925a 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -36,9 +36,13 @@ stages: Artifacts: - name: azure-storage-common safeName: azurestoragecommon + stagingProfileId: 88192f04117501 - name: azure-storage-blob safeName: azurestorageblob + stagingProfileId: 88192f04117501 - name: azure-storage-file safeName: azurestoragefile + stagingProfileId: 88192f04117501 - name: azure-storage-queue safeName: azurestoragequeue + 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..147f70964743 100644 --- a/sdk/storage/pom.service.xml +++ b/sdk/storage/pom.service.xml @@ -12,6 +12,7 @@ ../core/azure-core ../core/azure-core-test + ../core/azure-core-http-netty ../identity/azure-identity azure-storage-common azure-storage-blob 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..0d15dd67d620 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.3.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.3 + 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/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/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..8536f6f34706 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,7 +51,8 @@ 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 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;